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

View File

@ -58,4 +58,12 @@ export class ImagesComponent implements OnInit, AfterViewInit {
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;
tag?: string;
version?: string;
previous?: string;
}
export interface GetImageResponse {