From 93157d2e601f9ce7135efdca8815b9fe1cf522c3 Mon Sep 17 00:00:00 2001 From: MichalKinas <113341662+MichalKinas@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:04:52 +0100 Subject: [PATCH] [ACS-9012] Truncate text in saved searches description (#4265) * [ACS-9012] Truncate text in saved searches description * [ACS-9012] Truncate name column and navigation menu items * [ACS-9012] Unit test fixes --- extension.schema.json | 12 ++++++++++++ .../dialog/unique-search-name-validator.spec.ts | 4 +++- .../dialog/unique-search-name-validator.ts | 4 +++- .../list/smart-list/saved-searches-list-schema.ts | 6 ++++-- .../sidenav/save-search-sidenav.component.spec.ts | 2 ++ .../sidenav/save-search-sidenav.component.ts | 2 ++ .../lib/components/sidenav/sidenav.component.scss | 7 +++++++ 7 files changed, 33 insertions(+), 4 deletions(-) diff --git a/extension.schema.json b/extension.schema.json index 8664fe4d9a..fa82ce759c 100644 --- a/extension.schema.json +++ b/extension.schema.json @@ -590,6 +590,14 @@ "description": "Toggles resizable state of the column", "type": "boolean" }, + "draggable": { + "description": "Toggles draggable state of the column", + "type": "boolean" + }, + "isHidden": { + "description": "Toggles hidden state of the column", + "type": "boolean" + }, "template": { "description": "Column template id", "type": "string" @@ -597,6 +605,10 @@ "desktopOnly": { "description": "Display column only for large screens", "type": "boolean" + }, + "maxTextLength": { + "description": "Maximum text length before truncation", + "type": "number" } } }, diff --git a/projects/aca-content/src/lib/components/search/search-save/dialog/unique-search-name-validator.spec.ts b/projects/aca-content/src/lib/components/search/search-save/dialog/unique-search-name-validator.spec.ts index c76de1b5da..18db696c54 100644 --- a/projects/aca-content/src/lib/components/search/search-save/dialog/unique-search-name-validator.spec.ts +++ b/projects/aca-content/src/lib/components/search/search-save/dialog/unique-search-name-validator.spec.ts @@ -51,7 +51,9 @@ describe('UniqueSearchNameValidator', () => { }); it('should return error when name is not unique', (done) => { - validator.validate(new FormControl({ value: 'test', disabled: false })).subscribe((result) => { + const form = new FormControl({ value: 'test', disabled: false }); + form.markAsDirty(); + validator.validate(form).subscribe((result) => { expect(result).toEqual({ message: 'APP.BROWSE.SEARCH.SAVE_SEARCH.SEARCH_NAME_NOT_UNIQUE_ERROR' }); done(); }); diff --git a/projects/aca-content/src/lib/components/search/search-save/dialog/unique-search-name-validator.ts b/projects/aca-content/src/lib/components/search/search-save/dialog/unique-search-name-validator.ts index 3b0b8ac038..b69300e279 100644 --- a/projects/aca-content/src/lib/components/search/search-save/dialog/unique-search-name-validator.ts +++ b/projects/aca-content/src/lib/components/search/search-save/dialog/unique-search-name-validator.ts @@ -34,7 +34,9 @@ export class UniqueSearchNameValidator implements AsyncValidator { validate(control: AbstractControl): Observable { return this.savedSearchesService.getSavedSearches().pipe( map((searches) => - searches.some((search) => search.name === control.value) ? { message: 'APP.BROWSE.SEARCH.SAVE_SEARCH.SEARCH_NAME_NOT_UNIQUE_ERROR' } : null + searches.some((search) => search.name === control.value && control.dirty) + ? { message: 'APP.BROWSE.SEARCH.SAVE_SEARCH.SEARCH_NAME_NOT_UNIQUE_ERROR' } + : null ), catchError(() => of(null)) ); diff --git a/projects/aca-content/src/lib/components/search/search-save/list/smart-list/saved-searches-list-schema.ts b/projects/aca-content/src/lib/components/search/search-save/list/smart-list/saved-searches-list-schema.ts index 29352ebbd2..545ca4ecb3 100644 --- a/projects/aca-content/src/lib/components/search/search-save/list/smart-list/saved-searches-list-schema.ts +++ b/projects/aca-content/src/lib/components/search/search-save/list/smart-list/saved-searches-list-schema.ts @@ -30,7 +30,8 @@ export const savedSearchesListSchema = { title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.LIST.NAME', class: 'adf-ellipsis-cell', sortable: false, - draggable: false + draggable: false, + maxTextLength: 250 }, { type: 'text', @@ -38,7 +39,8 @@ export const savedSearchesListSchema = { title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.LIST.DESCRIPTION', class: 'adf-ellipsis-cell', sortable: false, - draggable: false + draggable: false, + maxTextLength: 250 } ] }; diff --git a/projects/aca-content/src/lib/components/search/search-save/sidenav/save-search-sidenav.component.spec.ts b/projects/aca-content/src/lib/components/search/search-save/sidenav/save-search-sidenav.component.spec.ts index 43e70c3135..121925526e 100644 --- a/projects/aca-content/src/lib/components/search/search-save/sidenav/save-search-sidenav.component.spec.ts +++ b/projects/aca-content/src/lib/components/search/search-save/sidenav/save-search-sidenav.component.spec.ts @@ -67,6 +67,7 @@ describe('SaveSearchSidenavComponent', () => { id: 'manage-saved-searches', icon: '', title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.NAVBAR.MANAGE_BUTTON', + description: 'APP.BROWSE.SEARCH.SAVE_SEARCH.NAVBAR.MANAGE_BUTTON', route: 'saved-searches', url: 'saved-searches' } @@ -84,6 +85,7 @@ describe('SaveSearchSidenavComponent', () => { expect(component.item.children[0]).toEqual({ icon: '', title: '1', + description: '1', route: 'search?q=abc', url: 'search?q=abc', id: 'search1' diff --git a/projects/aca-content/src/lib/components/search/search-save/sidenav/save-search-sidenav.component.ts b/projects/aca-content/src/lib/components/search/search-save/sidenav/save-search-sidenav.component.ts index 9fb736e73a..06e786738e 100644 --- a/projects/aca-content/src/lib/components/search/search-save/sidenav/save-search-sidenav.component.ts +++ b/projects/aca-content/src/lib/components/search/search-save/sidenav/save-search-sidenav.component.ts @@ -69,6 +69,7 @@ export class SaveSearchSidenavComponent implements OnInit { id: 'search' + child.name, icon: '', title: child.name, + description: child.name, route: `search?q=${child.encodedUrl}`, url: `search?q=${child.encodedUrl}` })) @@ -78,6 +79,7 @@ export class SaveSearchSidenavComponent implements OnInit { id: this.manageSearchesId, icon: '', title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.NAVBAR.MANAGE_BUTTON', + description: 'APP.BROWSE.SEARCH.SAVE_SEARCH.NAVBAR.MANAGE_BUTTON', route: 'saved-searches', url: 'saved-searches' }); diff --git a/projects/aca-content/src/lib/components/sidenav/sidenav.component.scss b/projects/aca-content/src/lib/components/sidenav/sidenav.component.scss index fad9059ab5..1799ca59f0 100644 --- a/projects/aca-content/src/lib/components/sidenav/sidenav.component.scss +++ b/projects/aca-content/src/lib/components/sidenav/sidenav.component.scss @@ -1,3 +1,5 @@ +@import '@alfresco/adf-core/lib/styles/mat-selectors'; + .aca-sidenav { display: flex; flex: 1; @@ -108,6 +110,11 @@ line-height: 32px; justify-content: start; + #{$mat-button-label} { + overflow: hidden; + text-overflow: ellipsis; + } + &--active { color: var(--theme-sidenav-active-text-color); background: var(--theme-selected-background-color);