Merge pull request #8800 from jwangyangls/pull-time-sort

Add the sortBy width push time and pull time  of tags
This commit is contained in:
jwangyangls 2019-08-23 10:10:35 +08:00 committed by GitHub
commit 8dd7530280
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 [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 [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 *ngIf="!withAdmiral">{{'REPOSITORY.LABELS' | translate}}</clr-dg-column>
<clr-dg-column>{{'REPOSITORY.PUSH_TIME' | translate}}</clr-dg-column> <clr-dg-column [clrDgSortBy]="pushComparator">{{'REPOSITORY.PUSH_TIME' | translate}}</clr-dg-column>
<clr-dg-column>{{'REPOSITORY.PULL_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-placeholder>{{'TAG.PLACEHOLDER' | translate }}</clr-dg-placeholder>
<clr-dg-row *clrDgItems="let t of tags" [clrDgItem]='t'> <clr-dg-row *clrDgItems="let t of tags" [clrDgItem]='t'>
<clr-dg-cell class="truncated flex-max-width"> <clr-dg-cell class="truncated flex-max-width">

View File

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