From 22907c614f7121a486d491dcc4fefcddd2a558ef Mon Sep 17 00:00:00 2001 From: Paurikova2 Date: Tue, 8 Jul 2025 14:00:10 +0200 Subject: [PATCH 1/6] show msg about no files when item has no files, show no spinenr --- .../preview-section.component.html | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html index cd937f7b465..fb63e784f73 100644 --- a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html +++ b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html @@ -1,10 +1,24 @@ - -
-
-
{{'item.preview.loading-files' | translate}} - + + +
+ {{ 'item.view.box.no-files.message' | translate }}
-
-
- -
+ + +
+ +
+ + + + +
+
+
+ {{ 'item.preview.loading-files' | translate }} + +
+
+
\ No newline at end of file From e5f4a6d014c08eaf5011a5d9537833a3d10fbe73 Mon Sep 17 00:00:00 2001 From: Paurikova2 Date: Tue, 8 Jul 2025 14:33:24 +0200 Subject: [PATCH 2/6] check if files are array --- .../preview-section/preview-section.component.html | 2 +- .../preview-section/preview-section.component.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html index fb63e784f73..1d321735952 100644 --- a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html +++ b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html @@ -1,6 +1,6 @@ -
+
{{ 'item.view.box.no-files.message' | translate }}
diff --git a/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts b/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts index 3f485e70f08..3da38c5379f 100644 --- a/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts +++ b/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts @@ -32,5 +32,7 @@ export class PreviewSectionComponent implements OnInit { }); } - + isArrayAndEmpty(value: unknown): boolean { + return Array.isArray(value) && value.length === 0; + } } From e78a57b362724f99af50047e7747c131e856cde7 Mon Sep 17 00:00:00 2001 From: Paurikova2 Date: Tue, 8 Jul 2025 14:48:35 +0200 Subject: [PATCH 3/6] check files size --- .../preview-section/preview-section.component.html | 2 +- .../preview-section/preview-section.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html index 1d321735952..2af9f0c0134 100644 --- a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html +++ b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html @@ -1,6 +1,6 @@ -
+
{{ 'item.view.box.no-files.message' | translate }}
diff --git a/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts b/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts index 3da38c5379f..bc53f11d651 100644 --- a/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts +++ b/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts @@ -32,7 +32,7 @@ export class PreviewSectionComponent implements OnInit { }); } - isArrayAndEmpty(value: unknown): boolean { + isArrayAndEmpty(value: unknown): value is unknown[] { return Array.isArray(value) && value.length === 0; } } From 155ff771a0ad19692997a605ebba059d57e2dd3f Mon Sep 17 00:00:00 2001 From: Paurikova2 Date: Tue, 8 Jul 2025 14:50:11 +0200 Subject: [PATCH 4/6] fix error --- .../preview-section/preview-section.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html index 2af9f0c0134..21b74ea00e3 100644 --- a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html +++ b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html @@ -1,6 +1,6 @@ -
+
{{ 'item.view.box.no-files.message' | translate }}
From eacfd21aa005f824a2c275a1bc44804bb8a16ad6 Mon Sep 17 00:00:00 2001 From: Paurikova2 Date: Wed, 9 Jul 2025 10:35:15 +0200 Subject: [PATCH 5/6] optimize template with hasNoFiles flag --- .../preview-section/preview-section.component.html | 2 +- .../preview-section/preview-section.component.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html index 21b74ea00e3..3620225a08a 100644 --- a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html +++ b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html @@ -1,6 +1,6 @@ -
+
{{ 'item.view.box.no-files.message' | translate }}
diff --git a/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts b/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts index bc53f11d651..724a01b7002 100644 --- a/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts +++ b/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts @@ -16,6 +16,7 @@ export class PreviewSectionComponent implements OnInit { listOfFiles: BehaviorSubject = new BehaviorSubject([] as any); emailToContact: string; + hasNoFiles = true; constructor(protected registryService: RegistryService, private configService: ConfigurationDataService) {} // Modified @@ -26,13 +27,10 @@ export class PreviewSectionComponent implements OnInit { .pipe(getAllSucceededRemoteListPayload()) .subscribe((data: MetadataBitstream[]) => { this.listOfFiles.next(data); + this.hasNoFiles = !Array.isArray(data) || data.length === 0; }); this.configService.findByPropertyName('lr.help.mail')?.subscribe(remoteData => { this.emailToContact = remoteData.payload?.values?.[0]; }); } - - isArrayAndEmpty(value: unknown): value is unknown[] { - return Array.isArray(value) && value.length === 0; - } } From 0a3f32c064e04d21719df44f3f03d50823d7e4d3 Mon Sep 17 00:00:00 2001 From: Paurikova2 Date: Wed, 9 Jul 2025 17:28:45 +0200 Subject: [PATCH 6/6] used behaviourSubject for hasNoFiles / aynchronous --- .../preview-section/preview-section.component.html | 2 +- .../preview-section/preview-section.component.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html index 3620225a08a..de3462c6e8f 100644 --- a/src/app/item-page/simple/field-components/preview-section/preview-section.component.html +++ b/src/app/item-page/simple/field-components/preview-section/preview-section.component.html @@ -1,6 +1,6 @@ -
+
{{ 'item.view.box.no-files.message' | translate }}
diff --git a/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts b/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts index 724a01b7002..9968e942534 100644 --- a/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts +++ b/src/app/item-page/simple/field-components/preview-section/preview-section.component.ts @@ -16,7 +16,7 @@ export class PreviewSectionComponent implements OnInit { listOfFiles: BehaviorSubject = new BehaviorSubject([] as any); emailToContact: string; - hasNoFiles = true; + hasNoFiles: BehaviorSubject = new BehaviorSubject(true); constructor(protected registryService: RegistryService, private configService: ConfigurationDataService) {} // Modified @@ -27,7 +27,7 @@ export class PreviewSectionComponent implements OnInit { .pipe(getAllSucceededRemoteListPayload()) .subscribe((data: MetadataBitstream[]) => { this.listOfFiles.next(data); - this.hasNoFiles = !Array.isArray(data) || data.length === 0; + this.hasNoFiles.next(!Array.isArray(data) || data.length === 0); }); this.configService.findByPropertyName('lr.help.mail')?.subscribe(remoteData => { this.emailToContact = remoteData.payload?.values?.[0];