mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 20:26:13 +01:00
Merge pull request #1898 from wknet123/dev-sync
Updates for clearing filter values after actions.
This commit is contained in:
commit
c3be926426
@ -11,7 +11,7 @@
|
||||
</select>
|
||||
</div>
|
||||
<div class="item-divider"></div>
|
||||
<grid-filter filterPlaceholder='{{"AUDIT_LOG.FILTER_PLACEHOLDER" | translate}}' (filter)="doFilter($event)"></grid-filter>
|
||||
<grid-filter filterPlaceholder='{{"AUDIT_LOG.FILTER_PLACEHOLDER" | translate}}' (filter)="doFilter($event)" [currentValue]="currentTerm"></grid-filter>
|
||||
<span (click)="refresh()" class="refresh-btn">
|
||||
<clr-icon shape="refresh" [hidden]="inProgress" ng-disabled="inProgress"></clr-icon>
|
||||
<span class="spinner spinner-inline" [hidden]="inProgress === false"></span>
|
||||
|
@ -22,6 +22,7 @@ export class RecentLogComponent implements OnInit {
|
||||
private logsCache: AuditLog[];
|
||||
private onGoing: boolean = false;
|
||||
private lines: number = 10; //Support 10, 25 and 50
|
||||
currentTerm: string;
|
||||
|
||||
constructor(
|
||||
private session: SessionService,
|
||||
@ -35,6 +36,7 @@ export class RecentLogComponent implements OnInit {
|
||||
}
|
||||
|
||||
private handleOnchange($event: any) {
|
||||
this.currentTerm = '';
|
||||
if ($event && $event.target && $event.target["value"]) {
|
||||
this.lines = $event.target["value"];
|
||||
if (this.lines < 10) {
|
||||
@ -57,7 +59,7 @@ export class RecentLogComponent implements OnInit {
|
||||
this.recentLogs = this.logsCache.filter(log => log.username != "");
|
||||
return;
|
||||
}
|
||||
|
||||
this.currentTerm = terms;
|
||||
this.recentLogs = this.logsCache.filter(log => this.isMatched(terms, log));
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
<add-member [projectId]="projectId" (added)="addedMember($event)"></add-member>
|
||||
</div>
|
||||
<div class="flex-xs-middle option-right">
|
||||
<grid-filter filterPlaceholder='{{"MEMBER.FILTER_PLACEHOLDER" | translate}}' (filter)="doSearch($event)"></grid-filter>
|
||||
<grid-filter filterPlaceholder='{{"MEMBER.FILTER_PLACEHOLDER" | translate}}' (filter)="doSearch($event)" [currentValue]="searchMember"></grid-filter>
|
||||
<a href="javascript:void(0)" (click)="refresh()">
|
||||
<clr-icon shape="refresh"></clr-icon>
|
||||
</a>
|
||||
|
@ -43,6 +43,8 @@ export class MemberComponent implements OnInit, OnDestroy {
|
||||
currentUser: SessionUser;
|
||||
hasProjectAdminRole: boolean;
|
||||
|
||||
searchMember: string;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
@ -108,6 +110,7 @@ export class MemberComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
addedMember() {
|
||||
this.searchMember = '';
|
||||
this.retrieve(this.projectId, '');
|
||||
}
|
||||
|
||||
@ -138,7 +141,8 @@ export class MemberComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
doSearch(searchMember) {
|
||||
this.retrieve(this.projectId, searchMember);
|
||||
this.searchMember = searchMember;
|
||||
this.retrieve(this.projectId, this.searchMember);
|
||||
}
|
||||
|
||||
refresh() {
|
||||
|
@ -20,7 +20,7 @@
|
||||
<a href="javascript:void(0)" clrDropdownItem (click)="doFilterProjects(1)">{{projectTypes[1] | translate}}</a>
|
||||
</div>
|
||||
</clr-dropdown>
|
||||
<grid-filter filterPlaceholder='{{"PROJECT.FILTER_PLACEHOLDER" | translate}}' (filter)="doSearchProjects($event)"></grid-filter>
|
||||
<grid-filter filterPlaceholder='{{"PROJECT.FILTER_PLACEHOLDER" | translate}}' (filter)="doSearchProjects($event)" [currentValue]="projectName"></grid-filter>
|
||||
<a href="javascript:void(0)" (click)="refresh()">
|
||||
<clr-icon shape="refresh"></clr-icon>
|
||||
</a>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<create-edit-destination (reload)="reload($event)"></create-edit-destination>
|
||||
</div>
|
||||
<div class="flex-items-xs-middle option-right">
|
||||
<grid-filter filterPlaceholder='{{"REPLICATION.FILTER_TARGETS_PLACEHOLDER" | translate}}' (filter)="doSearchTargets($event)"></grid-filter>
|
||||
<grid-filter filterPlaceholder='{{"REPLICATION.FILTER_TARGETS_PLACEHOLDER" | translate}}' (filter)="doSearchTargets($event)" [currentValue]="targetName"></grid-filter>
|
||||
<a href="javascript:void(0)" (click)="refreshTargets()">
|
||||
<clr-icon shape="refresh"></clr-icon>
|
||||
</a>
|
||||
|
@ -87,6 +87,7 @@ export class DestinationComponent implements OnInit {
|
||||
}
|
||||
|
||||
reload() {
|
||||
this.targetName = '';
|
||||
this.retrieve('');
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
<a href="javascript:void(0)" clrDropdownItem *ngFor="let r of ruleStatus" (click)="doFilterPolicyStatus(r.key)"> {{r.description | translate}}</a>
|
||||
</div>
|
||||
</clr-dropdown>
|
||||
<grid-filter filterPlaceholder='{{"REPLICATION.FILTER_POLICIES_PLACEHOLDER" | translate}}' (filter)="doSearchPolicies($event)"></grid-filter>
|
||||
<grid-filter filterPlaceholder='{{"REPLICATION.FILTER_POLICIES_PLACEHOLDER" | translate}}' (filter)="doSearchPolicies($event)" [currentValue]="search.policyName"></grid-filter>
|
||||
<a href="javascript:void(0)" (click)="refreshPolicies()">
|
||||
<clr-icon shape="refresh"></clr-icon>
|
||||
</a>
|
||||
@ -23,14 +23,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<list-policy [policies]="changedPolicies" [projectless]="false" [selectedId]="initSelectedId" (selectOne)="selectOne($event)" (editOne)="openEditPolicy($event)" (reload)="reloadPolicies($event)"></list-policy>
|
||||
<list-policy [policies]="changedPolicies" [projectless]="false" [selectedId]="initSelectedId" (selectOne)="selectOnePolicy($event)" (editOne)="openEditPolicy($event)" (reload)="reloadPolicies($event)"></list-policy>
|
||||
</div>
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="row flex-items-xs-between">
|
||||
<h5 class="flex-items-xs-bottom option-left-down" style="margin-left: 14px;">{{'REPLICATION.REPLICATION_JOBS' | translate}}</h5>
|
||||
<div class="flex-items-xs-bottom option-right-down">
|
||||
<button class="btn btn-link" (click)="toggleSearchJobOptionalName(currentJobSearchOption)">{{toggleJobSearchOption[currentJobSearchOption] | translate}}</button>
|
||||
<grid-filter filterPlaceholder='{{"REPLICATION.FILTER_JOBS_PLACEHOLDER" | translate}}' (filter)="doSearchJobs($event)"></grid-filter>
|
||||
<grid-filter filterPlaceholder='{{"REPLICATION.FILTER_JOBS_PLACEHOLDER" | translate}}' (filter)="doSearchJobs($event)" [currentValue]="search.repoName" ></grid-filter>
|
||||
<a href="javascript:void(0)" (click)="refreshJobs()">
|
||||
<clr-icon shape="refresh"></clr-icon>
|
||||
</a>
|
||||
@ -47,8 +47,8 @@
|
||||
</div>
|
||||
</clr-dropdown>
|
||||
<div class="flex-items-xs-middle">
|
||||
<clr-icon shape="date"></clr-icon><input type="date" #fromTime (change)="doJobSearchByTimeRange(fromTime.value, 'begin')">
|
||||
<clr-icon shape="date"></clr-icon><input type="date" #toTime (change)="doJobSearchByTimeRange(toTime.value, 'end')">
|
||||
<clr-icon shape="date"></clr-icon><input type="date" #fromTime (change)="doJobSearchByStartTime(fromTime.value)">
|
||||
<clr-icon shape="date"></clr-icon><input type="date" #toTime (change)="doJobSearchByEndTime(toTime.value)">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -68,7 +68,7 @@ export class ReplicationComponent implements OnInit {
|
||||
changedJobs: Job[];
|
||||
initSelectedId: number;
|
||||
|
||||
policies: Policy[];
|
||||
policies: Policy[];retrieve
|
||||
jobs: Job[];
|
||||
|
||||
jobsTotalRecordCount: number;
|
||||
@ -144,7 +144,6 @@ export class ReplicationComponent implements OnInit {
|
||||
if(state) {
|
||||
this.search.page = state.page.to + 1;
|
||||
}
|
||||
console.log('Received policy ID ' + this.search.policyId + ' by clicked row.');
|
||||
this.replicationService
|
||||
.listJobs(this.search.policyId, this.search.status, this.search.repoName,
|
||||
this.search.startTime, this.search.endTime, this.search.page, this.search.pageSize)
|
||||
@ -157,7 +156,6 @@ export class ReplicationComponent implements OnInit {
|
||||
for(let i = 0; i < this.jobs.length; i++) {
|
||||
let j = this.jobs[i];
|
||||
if(j.status == 'retrying' || j.status == 'error') {
|
||||
console.log('Error in jobs were found.')
|
||||
this.messageHandlerService.showError('REPLICATION.FOUND_ERROR_IN_JOBS', '');
|
||||
break;
|
||||
}
|
||||
@ -167,9 +165,13 @@ export class ReplicationComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
selectOne(policy: Policy) {
|
||||
selectOnePolicy(policy: Policy) {
|
||||
if(policy) {
|
||||
this.search.policyId = policy.id;
|
||||
this.search.repoName = '';
|
||||
this.search.status = ''
|
||||
this.currentJobSearchOption = 0;
|
||||
this.currentJobStatus = { 'key': '', 'description': 'REPLICATION.ALL'};
|
||||
this.fetchPolicyJobs();
|
||||
}
|
||||
}
|
||||
@ -180,7 +182,6 @@ export class ReplicationComponent implements OnInit {
|
||||
}
|
||||
|
||||
doFilterPolicyStatus(status: string) {
|
||||
console.log('Do filter policies with status:' + status);
|
||||
this.currentRuleStatus = this.ruleStatus.find(r=>r.key === status);
|
||||
if(status.trim() === '') {
|
||||
this.changedPolicies = this.policies;
|
||||
@ -190,13 +191,9 @@ export class ReplicationComponent implements OnInit {
|
||||
}
|
||||
|
||||
doFilterJobStatus(status: string) {
|
||||
console.log('Do filter jobs with status:' + status);
|
||||
this.currentJobStatus = this.jobStatus.find(r=>r.key === status);
|
||||
if(status.trim() === '') {
|
||||
this.changedJobs = this.jobs;
|
||||
} else {
|
||||
this.changedJobs = this.jobs.filter(job=>job.status === status);
|
||||
}
|
||||
this.search.status = status;
|
||||
this.doSearchJobs(this.search.repoName);
|
||||
}
|
||||
|
||||
doSearchJobs(repoName: string) {
|
||||
@ -223,21 +220,20 @@ export class ReplicationComponent implements OnInit {
|
||||
(option === 1) ? this.currentJobSearchOption = 0 : this.currentJobSearchOption = 1;
|
||||
}
|
||||
|
||||
doJobSearchByTimeRange(strDate: string, target: string) {
|
||||
doJobSearchByStartTime(strDate: string) {
|
||||
if(!strDate || strDate.trim() === '') {
|
||||
strDate = 0 + '';
|
||||
}
|
||||
(strDate === '0') ? this.search.startTime = '' : this.search.startTime = (new Date(strDate).getTime() / 1000) + '';
|
||||
this.fetchPolicyJobs();
|
||||
}
|
||||
|
||||
doJobSearchByEndTime(strDate: string) {
|
||||
if(!strDate || strDate.trim() === '') {
|
||||
strDate = 0 + '';
|
||||
}
|
||||
let oneDayOffset = 3600 * 24;
|
||||
switch(target) {
|
||||
case 'begin':
|
||||
this.search.startTime = (new Date(strDate).getTime() / 1000) + '';
|
||||
break;
|
||||
case 'end':
|
||||
this.search.endTime = (new Date(strDate).getTime() / 1000 + oneDayOffset) + '';
|
||||
break;
|
||||
}
|
||||
console.log('Search jobs filtered by time range, begin: ' + this.search.startTime + ', end:' + this.search.endTime);
|
||||
(strDate === '0') ? this.search.endTime = '' : this.search.endTime = (new Date(strDate).getTime() / 1000 + oneDayOffset) + '';
|
||||
this.fetchPolicyJobs();
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
|
||||
<div class="row flex-items-xs-right option-right">
|
||||
<div class="flex-items-xs-middle">
|
||||
<grid-filter filterPlaceholder='{{"REPLICATION.FILTER_POLICIES_PLACEHOLDER" | translate}}' (filter)="doSearchPolicies($event)"></grid-filter>
|
||||
<grid-filter filterPlaceholder='{{"REPLICATION.FILTER_POLICIES_PLACEHOLDER" | translate}}' (filter)="doSearchPolicies($event)" [currentValue]="policyName"></grid-filter>
|
||||
<a href="javascript:void(0)" (click)="refreshPolicies()"><clr-icon shape="refresh"></clr-icon></a>
|
||||
</div>
|
||||
<create-edit-policy [projectId]="projectId" (reload)="reloadPolicies($event)"></create-edit-policy>
|
||||
|
@ -71,6 +71,7 @@ export class TotalReplicationComponent implements OnInit {
|
||||
|
||||
reloadPolicies(isReady: boolean) {
|
||||
if(isReady) {
|
||||
this.policyName = '';
|
||||
this.retrievePolicies();
|
||||
}
|
||||
}
|
||||
|
@ -12,16 +12,14 @@ import 'rxjs/add/operator/distinctUntilChanged';
|
||||
styleUrls: ['filter.component.css']
|
||||
})
|
||||
|
||||
export class FilterComponent implements OnInit{
|
||||
private placeHolder: string = "";
|
||||
private currentValue: string = "";
|
||||
private leadingSpacesAdded: boolean = false;
|
||||
private filerAction: Function;
|
||||
export class FilterComponent implements OnInit {
|
||||
|
||||
private placeHolder: string = "";
|
||||
private filterTerms = new Subject<string>();
|
||||
|
||||
@Output("filter") private filterEvt = new EventEmitter<string>();
|
||||
|
||||
@Input() currentValue;
|
||||
@Input("filterPlaceholder")
|
||||
public set flPlaceholder(placeHolder: string) {
|
||||
this.placeHolder = placeHolder;
|
||||
@ -34,6 +32,7 @@ export class FilterComponent implements OnInit{
|
||||
.subscribe(terms => {
|
||||
this.filterEvt.emit(terms);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
valueChange(): void {
|
||||
|
@ -5,7 +5,7 @@
|
||||
<span>
|
||||
<button [class.hide-create]="!canCreateUser" type="submit" class="btn btn-link custom-add-button" (click)="addNewUser()"><clr-icon shape="add"></clr-icon> {{'USER.ADD_ACTION' | translate}}</button>
|
||||
</span>
|
||||
<grid-filter class="filter-pos" filterPlaceholder='{{"USER.FILTER_PLACEHOLDER" | translate}}' (filter)="doFilter($event)"></grid-filter>
|
||||
<grid-filter class="filter-pos" filterPlaceholder='{{"USER.FILTER_PLACEHOLDER" | translate}}' (filter)="doFilter($event)" [currentValue]="currentTerm"></grid-filter>
|
||||
<span class="refresh-btn" (click)="refreshUser()">
|
||||
<clr-icon shape="refresh" [hidden]="inProgress" ng-disabled="inProgress"></clr-icon>
|
||||
<span class="spinner spinner-inline" [hidden]="inProgress === false"></span>
|
||||
|
@ -30,6 +30,8 @@ export class UserComponent implements OnInit, OnDestroy {
|
||||
private adminColumn: string = "";
|
||||
private deletionSubscription: Subscription;
|
||||
|
||||
currentTerm: string;
|
||||
|
||||
@ViewChild(NewUserModalComponent)
|
||||
private newUserDialog: NewUserModalComponent;
|
||||
|
||||
@ -107,6 +109,7 @@ export class UserComponent implements OnInit, OnDestroy {
|
||||
|
||||
//Filter items by keywords
|
||||
doFilter(terms: string): void {
|
||||
this.currentTerm = terms;
|
||||
this.originalUsers.then(users => {
|
||||
if (terms.trim() === "") {
|
||||
this.users = users;
|
||||
@ -175,6 +178,7 @@ export class UserComponent implements OnInit, OnDestroy {
|
||||
.then(() => {
|
||||
//Remove it from current user list
|
||||
//and then view refreshed
|
||||
this.currentTerm = '';
|
||||
this.originalUsers.then(users => {
|
||||
this.users = users.filter(u => u.user_id != user.user_id);
|
||||
this.msgHandler.showSuccess("USER.DELETE_SUCCESS");
|
||||
@ -188,6 +192,7 @@ export class UserComponent implements OnInit, OnDestroy {
|
||||
//Refresh the user list
|
||||
refreshUser(): void {
|
||||
//Start to get
|
||||
this.currentTerm = '';
|
||||
this.onGoing = true;
|
||||
|
||||
this.originalUsers = this.userService.getUsers()
|
||||
|
Loading…
Reference in New Issue
Block a user