Add the sortBy width push time and pull time of tags

Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
Yogi_Wang 2019-08-23 07:32:20 +08:00
parent 8701007714
commit 26483836b3
2 changed files with 6 additions and 4 deletions

View File

@ -85,8 +85,8 @@
<clr-dg-column [clrDgSortBy]="createdComparator">{{'REPOSITORY.CREATED' | translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'docker_version'" *ngIf="!withClair">{{'REPOSITORY.DOCKER_VERSION' | translate}}</clr-dg-column>
<clr-dg-column *ngIf="!withAdmiral">{{'REPOSITORY.LABELS' | translate}}</clr-dg-column>
<clr-dg-column>{{'REPOSITORY.PUSH_TIME' | translate}}</clr-dg-column>
<clr-dg-column>{{'REPOSITORY.PULL_TIME' | translate}}</clr-dg-column>
<clr-dg-column [clrDgSortBy]="pushComparator">{{'REPOSITORY.PUSH_TIME' | translate}}</clr-dg-column>
<clr-dg-column [clrDgSortBy]="pullComparator">{{'REPOSITORY.PULL_TIME' | translate}}</clr-dg-column>
<clr-dg-placeholder>{{'TAG.PLACEHOLDER' | translate }}</clr-dg-placeholder>
<clr-dg-row *clrDgItems="let t of tags" [clrDgItem]='t'>
<clr-dg-cell class="truncated flex-max-width">

View File

@ -107,6 +107,8 @@ export class TagComponent implements OnInit, AfterViewInit {
showlabel: boolean;
createdComparator: Comparator<Tag> = new CustomComparator<Tag>("created", "date");
pullComparator: Comparator<Tag> = new CustomComparator<Tag>("pull_time", "date");
pushComparator: Comparator<Tag> = new CustomComparator<Tag>("push_time", "date");
loading = false;
copyFailed = false;
@ -272,7 +274,7 @@ export class TagComponent implements OnInit, AfterViewInit {
this.tags = doFiltering<Tag>(tags, state);
this.tags = doSorting<Tag>(this.tags, state);
this.tags = this.tags.map(tag => {
tag.push_time = tag.push_time === AVAILABLE_TIME ? '' : tag.push_time;
tag.pull_time = tag.pull_time === AVAILABLE_TIME ? '' : tag.pull_time;
return tag;
});
this.loading = false;
@ -543,7 +545,7 @@ export class TagComponent implements OnInit, AfterViewInit {
}
});
this.tags = items.map(tag => {
tag.push_time = tag.push_time === AVAILABLE_TIME ? '' : tag.push_time;
tag.pull_time = tag.pull_time === AVAILABLE_TIME ? '' : tag.pull_time;
return tag;
});
let signedName: { [key: string]: string[] } = {};