diff --git a/frontend/src/app/component/file-uploader/file-uploader.component.ts b/frontend/src/app/component/file-uploader/file-uploader.component.ts index d726777..1dbf8ba 100644 --- a/frontend/src/app/component/file-uploader/file-uploader.component.ts +++ b/frontend/src/app/component/file-uploader/file-uploader.component.ts @@ -117,8 +117,8 @@ export class FileUploaderComponent implements OnInit { const metaData = this.loadMetaForFile(); if (metaData) { this.name = metaData.name; - this.longitude = metaData.longitude; - this.latitude = metaData.latitude; + this.longitude = metaData.longitude + ''; + this.latitude = metaData.latitude + ''; } }; @@ -162,7 +162,12 @@ export class FileUploaderComponent implements OnInit { } private loadMetaForFile() { - const metaData = metaFile.find(m => m.filename === this.currentFileName); + const metaData = (metaFile as { + filename: string, + latitude: number; + longitude: number; + name: string; + }[]).find(m => m.filename === this.currentFileName); this.logger.debug('Found corresponding meta', this.currentFileName, metaData); return metaData; } diff --git a/frontend/src/app/component/images/images.component.html b/frontend/src/app/component/images/images.component.html index 6cc6739..01ea103 100644 --- a/frontend/src/app/component/images/images.component.html +++ b/frontend/src/app/component/images/images.component.html @@ -5,15 +5,13 @@ Date File valid - - {{openImageExpansion}} {{i}} - +

{{image.name}}

@@ -66,23 +64,55 @@ [meta]=image (reload)="reload.emit()" > - + - - + + - Previous version meta + Previous versions -
- -

version: {{imageMeta.version}}

-

name: {{imageMeta.name}}

-

tag: {{imageMeta.tag}}

-

filename: {{imageMeta.filename}}

-

latitude: {{imageMeta.latitude}}

-

longitude: {{imageMeta.longitude}}

-
+ + + + + + + + + + +

version: {{relImage.version ? relImage.version : 0}}

+
+ + + + +
+ + + + +
+
+ + +
+

filename: {{relImage.filename}}

+

latitude: {{relImage.latitude}}

+

longitude: {{relImage.longitude}}

+
+
+
+
+
diff --git a/frontend/src/app/component/images/images.component.ts b/frontend/src/app/component/images/images.component.ts index f738930..5688178 100644 --- a/frontend/src/app/component/images/images.component.ts +++ b/frontend/src/app/component/images/images.component.ts @@ -20,8 +20,8 @@ export class ImagesComponent implements OnInit, AfterViewInit { pageSizeOptions: number[] = [5, 10, 25, 100]; lastPageEvent: PageEvent; - openImageExpansion = [[true, true], [false, false], [false, false], [false, false], [false, false]]; - ALL_CLOSED_DEFAULT: [[false, false], [false, false], [false, false], [false, false], [false, false]]; + ALL_CLOSED_DEFAULT = [...Array(5)].map(() => this.getDefaultBoolDict(false)); + openImageExpansion = this.ALL_CLOSED_DEFAULT; constructor( public restService: RestService, @@ -30,6 +30,12 @@ export class ImagesComponent implements OnInit, AfterViewInit { ) { } + private getDefaultBoolDict(value: boolean) { + return new Proxy({}, { + get: (target, name) => name in target ? target[name] : value + }); + } + ngOnInit(): void { this.lastPageEvent = {pageIndex: 0, pageSize: this.pageSizeOptions[0], length: this.images.length}; } @@ -53,13 +59,23 @@ export class ImagesComponent implements OnInit, AfterViewInit { }).catch(err => this.logger.error(err)); } - loadImage(i: number, id: string): void { - this.restService.getImage(id).toPromise().then(image => { - this.images[i].image_b64 = 'data:image/jpg;base64,' + image.image_data; - this.logger.debug('image_b64', i, id, this.images[i].image_b64); - }).catch(err => { - this.logger.error('loadImage', i, id, err); - }); + loadImage(i: number, id: string, relImage?: ImageMetadata): void { + if (!relImage) { + this.restService.getImage(id).toPromise().then(image => { + this.images[i].image_b64 = 'data:image/jpg;base64,' + image.image_data; + this.logger.debug('image_b64', i, id, this.images[i].image_b64); + }).catch(err => { + this.logger.error('loadImage', i, id, err); + }); + } else { + this.restService.getImage(id).toPromise().then(image => { + relImage.image_b64 = 'data:image/jpg;base64,' + image.image_data; + this.logger.debug('image_b64', i, id, relImage.image_b64); + }).catch(err => { + this.logger.error('loadImage', i, id, err); + }); + } + } filterOnlyNewestImageVersion() { diff --git a/frontend/src/app/component/landing/landing.component.ts b/frontend/src/app/component/landing/landing.component.ts index 6f3ac44..f8a9b81 100644 --- a/frontend/src/app/component/landing/landing.component.ts +++ b/frontend/src/app/component/landing/landing.component.ts @@ -28,7 +28,19 @@ export class LandingComponent implements OnInit { } loadImages(): void { - this.restService.getAllImages().toPromise().then(images => this.images = images).catch(err => this.logger.error(err)); + this.restService.getAllImages().toPromise().then(images => + this.images = images.sort((im1, im2) => { + if (im1.name > im2.name) { + return 1; + } + + if (im1.name < im2.name) { + return -1; + } + + return 0; + }) + ).catch(err => this.logger.error(err)); }