From e8440838d8ebb28480ecb24cd1f540fccf2ab264 Mon Sep 17 00:00:00 2001 From: Irmantas Kaukas Date: Tue, 17 Dec 2024 09:43:41 +0100 Subject: [PATCH] fix: save and replace external IIIF image (DEV-4227) (#2013) --- .../edit-third-party-iiif-form.component.ts | 2 +- .../src/lib/still-image/still-image.component.ts | 2 +- .../src/lib/third-party-iiif/third-party-iiif.component.ts | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/vre/resource-editor/representations/src/lib/edit-third-party-iiif-form/edit-third-party-iiif-form.component.ts b/libs/vre/resource-editor/representations/src/lib/edit-third-party-iiif-form/edit-third-party-iiif-form.component.ts index a6dd8b9764..0d81462031 100644 --- a/libs/vre/resource-editor/representations/src/lib/edit-third-party-iiif-form/edit-third-party-iiif-form.component.ts +++ b/libs/vre/resource-editor/representations/src/lib/edit-third-party-iiif-form/edit-third-party-iiif-form.component.ts @@ -1,7 +1,6 @@ import { Component, Inject } from '@angular/core'; import { FormControl, FormGroup, Validators } from '@angular/forms'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { KnoraApiConnection } from '@dasch-swiss/dsp-js'; import { ThirdPartyIiifProps, ThirdPartyIiiifForm } from './edit-third-party-iiif-types'; @Component({ @@ -23,6 +22,7 @@ export class EditThirdPartyIiifFormComponent { submitData() { this.loading = true; + delete (this.thirdPartyIiifForm.value.fileValue as any)?.filename; this.dialogRef.close(this.thirdPartyIiifForm.value.fileValue); } } diff --git a/libs/vre/resource-editor/representations/src/lib/still-image/still-image.component.ts b/libs/vre/resource-editor/representations/src/lib/still-image/still-image.component.ts index c089fda1c7..dad0869ae7 100644 --- a/libs/vre/resource-editor/representations/src/lib/still-image/still-image.component.ts +++ b/libs/vre/resource-editor/representations/src/lib/still-image/still-image.component.ts @@ -121,7 +121,7 @@ export class StillImageComponent implements OnChanges, AfterViewInit, OnDestroy private _openExternal3iFImage(image: ReadStillImageExternalFileValue) { const i3f = IIIFUrl.createUrl(image.externalUrl); if (!i3f) { - throw new AppError('Error with IIIF URL'); + throw new AppError("Can't open external IIIF URL"); } this.osdService.viewer.open(i3f.infoJsonUrl); diff --git a/libs/vre/resource-editor/representations/src/lib/third-party-iiif/third-party-iiif.component.ts b/libs/vre/resource-editor/representations/src/lib/third-party-iiif/third-party-iiif.component.ts index c125ce645e..00384807db 100644 --- a/libs/vre/resource-editor/representations/src/lib/third-party-iiif/third-party-iiif.component.ts +++ b/libs/vre/resource-editor/representations/src/lib/third-party-iiif/third-party-iiif.component.ts @@ -101,7 +101,9 @@ export class ThirdPartyIiifComponent implements ControlValueAccessor, OnInit, On updateValue.id = this._initialFileValue.id; return updateValue; } else { - return new CreateStillImageExternalFileValue(); + const fileValue = new CreateStillImageExternalFileValue(); + delete (fileValue as any).filename; + return fileValue; } }