only display images without previous tag;

This commit is contained in:
Marco Zeisler 2021-01-16 15:17:39 +01:00
parent 3550076756
commit 80d6fd1c16
3 changed files with 13 additions and 4 deletions

View File

@ -7,8 +7,8 @@
</div> </div>
<mat-expansion-panel <mat-expansion-panel
*ngFor="let image of images | slice:paginationGetStart():paginationGetEnd(); let i = index" *ngFor="let image of filterOnlyNewestImageVersion() | slice:paginationGetStart():paginationGetEnd()"
(opened)="loadImage(i + paginationGetStart(), image.filename.split('.')[0])" (opened)="loadImage(getImageIndex(image), image.filename.split('.')[0])"
> >
<mat-expansion-panel-header (click)="$event.stopPropagation()"> <mat-expansion-panel-header (click)="$event.stopPropagation()">
<h4 style="width: 25em" <h4 style="width: 25em"
@ -69,8 +69,8 @@
</ng-template> </ng-template>
</mat-expansion-panel> </mat-expansion-panel>
<mat-paginator *ngIf="images.length > 0" <mat-paginator *ngIf="filterOnlyNewestImageVersion().length > 0"
[length]="images.length" [length]="filterOnlyNewestImageVersion().length"
[pageSize]="pageSizeOptions[0]" [pageSize]="pageSizeOptions[0]"
[pageSizeOptions]="pageSizeOptions" [pageSizeOptions]="pageSizeOptions"
(page)="lastPageEvent = $event" (page)="lastPageEvent = $event"

View File

@ -58,4 +58,12 @@ export class ImagesComponent implements OnInit, AfterViewInit {
this.logger.error('loadImage', i, id, err); this.logger.error('loadImage', i, id, err);
}); });
} }
filterOnlyNewestImageVersion() {
return this.images.filter(image => !image.previous);
}
getImageIndex(image: ImageMetadata) {
return this.images.findIndex(img => image === img);
}
} }

View File

@ -21,6 +21,7 @@ export interface ImageMetadata {
image_b64?: string; image_b64?: string;
tag?: string; tag?: string;
version?: string; version?: string;
previous?: string;
} }
export interface GetImageResponse { export interface GetImageResponse {