From c6911e8c976719b2d2022db641e60b632eb5f495 Mon Sep 17 00:00:00 2001 From: Romuald Caplier Date: Thu, 20 Jun 2024 14:16:05 +0200 Subject: [PATCH] refactor(metadata-editor): changed resourceFileName to imageAltText. --- .../overview-upload/overview-upload.component.html | 2 +- .../overview-upload.component.spec.ts | 10 +++++----- .../overview-upload/overview-upload.component.ts | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.html b/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.html index 97d6aea100..54da3e35a7 100644 --- a/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.html +++ b/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.html @@ -1,7 +1,7 @@ { it('should get all resources corresponding to the metadata UUID on init', () => { expect(recordsApiService.getAllResources).toHaveBeenCalledWith(metadataUuid) - expect(component.resourceFileName).toEqual('filenameGet') + expect(component.imageAltText).toEqual('filenameGet') expect(component.resourceUrl).toEqual('urlGet') }) @@ -63,7 +63,7 @@ describe('OverviewUploadComponent', () => { someFile, 'public' ) - expect(component.resourceFileName).toEqual('filenamePut') + expect(component.imageAltText).toEqual('filenamePut') expect(component.resourceUrl).toEqual('urlPut') }) @@ -74,18 +74,18 @@ describe('OverviewUploadComponent', () => { 'someUrl', 'public' ) - expect(component.resourceFileName).toEqual('filenamePutUrl') + expect(component.imageAltText).toEqual('filenamePutUrl') expect(component.resourceUrl).toEqual('urlPutUrl') }) it('should delete the resource corresponding to the metadata UUID on delete', () => { - component.resourceFileName = 'filenameDelete' + component.imageAltText = 'filenameDelete' component.handleDelete() expect(recordsApiService.delResource).toHaveBeenCalledWith( metadataUuid, 'filenameDelete' ) - expect(component.resourceFileName).toBeNull() + expect(component.imageAltText).toBeNull() expect(component.resourceUrl).toBeNull() }) }) diff --git a/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts b/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts index 4e437f3064..66535d5533 100644 --- a/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts +++ b/libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.ts @@ -20,7 +20,7 @@ import { UiInputsModule } from '@geonetwork-ui/ui/inputs' export class OverviewUploadComponent implements OnInit { @Input() metadataUuid: string - resourceFileName: string + imageAltText: string resourceUrl: string constructor( @@ -32,7 +32,7 @@ export class OverviewUploadComponent implements OnInit { this.recordsApiService .getAllResources(this.metadataUuid) .subscribe((resources) => { - this.resourceFileName = resources[0]?.filename + this.imageAltText = resources[0]?.filename this.resourceUrl = resources[0]?.url this.cd.markForCheck() }) @@ -42,7 +42,7 @@ export class OverviewUploadComponent implements OnInit { this.recordsApiService .putResource(this.metadataUuid, file, 'public') .subscribe((resource) => { - this.resourceFileName = resource.filename + this.imageAltText = resource.filename this.resourceUrl = resource.url this.cd.markForCheck() }) @@ -52,7 +52,7 @@ export class OverviewUploadComponent implements OnInit { this.recordsApiService .putResourceFromURL(this.metadataUuid, url, 'public') .subscribe((resource) => { - this.resourceFileName = resource.filename + this.imageAltText = resource.filename this.resourceUrl = resource.url this.cd.markForCheck() }) @@ -60,9 +60,9 @@ export class OverviewUploadComponent implements OnInit { handleDelete() { this.recordsApiService - .delResource(this.metadataUuid, this.resourceFileName) + .delResource(this.metadataUuid, this.imageAltText) .subscribe(() => { - this.resourceFileName = null + this.imageAltText = null this.resourceUrl = null this.cd.markForCheck() })