From da44b4cee02696f2286c1b6bb7964db2605e474b Mon Sep 17 00:00:00 2001 From: dominikiwanekhyland <141320833+dominikiwanekhyland@users.noreply.github.com> Date: Fri, 27 Sep 2024 10:39:00 +0200 Subject: [PATCH] =?UTF-8?q?ACS-8824=20[ACA]=20View=20Details=20/=20The=20u?= =?UTF-8?q?ser=20cannot=20edit=20node=20properties=20af=E2=80=A6=20(#10246?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ACS-8824 [ACA] View Details / The user cannot edit node properties after failing to change node name with special characters * ACS-8824 [ACA] View Details / The user cannot edit node properties after failing to change node name with special characters --- .../services/basic-properties.service.ts | 13 +++++++++++-- .../card-view-textitem.component.spec.ts | 4 ++-- .../card-view-textitem.component.ts | 1 - 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/content-services/src/lib/content-metadata/services/basic-properties.service.ts b/lib/content-services/src/lib/content-metadata/services/basic-properties.service.ts index 83541e9059..5530fef7d8 100644 --- a/lib/content-services/src/lib/content-metadata/services/basic-properties.service.ts +++ b/lib/content-services/src/lib/content-metadata/services/basic-properties.service.ts @@ -17,7 +17,13 @@ import { inject, Injectable } from '@angular/core'; import { Node } from '@alfresco/js-api'; -import { CardViewDateItemModel, CardViewTextItemModel, FileSizePipe, TranslationService } from '@alfresco/adf-core'; +import { + CardViewDateItemModel, + CardViewItemMatchValidator, + CardViewTextItemModel, + FileSizePipe, + TranslationService +} from '@alfresco/adf-core'; @Injectable({ providedIn: 'root' @@ -37,7 +43,10 @@ export class BasicPropertiesService { label: 'CORE.METADATA.BASIC.NAME', value: node.name, key: 'properties.cm:name', - editable: true + editable: true, + validators: [ + new CardViewItemMatchValidator('[\\/\\*\\\\"\\\\]') + ] }), new CardViewTextItemModel({ label: 'CORE.METADATA.BASIC.TITLE', diff --git a/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.spec.ts b/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.spec.ts index 2f9002595f..3133f8cabf 100644 --- a/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.spec.ts +++ b/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.spec.ts @@ -581,7 +581,7 @@ describe('CardViewTextItemComponent', () => { expect(cardViewUpdateService.update).toHaveBeenCalledWith(property, 'updated-value'); }); - it('should trigger the update event if the editedValue is NOT valid', async () => { + it('should NOT trigger the update event if the editedValue is invalid', async () => { const cardViewUpdateService = TestBed.inject(CardViewUpdateService); spyOn(cardViewUpdateService, 'update'); component.property.isValid = () => false; @@ -589,7 +589,7 @@ describe('CardViewTextItemComponent', () => { updateTextField(component.property.key, '@invalid-value'); await fixture.whenStable(); - expect(cardViewUpdateService.update).toHaveBeenCalled(); + expect(cardViewUpdateService.update).not.toHaveBeenCalled(); }); it('should trigger the update event if the editedValue is valid', async () => { diff --git a/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.ts b/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.ts index b38d53d67a..467238c0ce 100644 --- a/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.ts +++ b/lib/core/src/lib/card-view/components/card-view-textitem/card-view-textitem.component.ts @@ -149,7 +149,6 @@ export class CardViewTextItemComponent extends BaseCardView