[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
This commit is contained in:
MichalKinas
2024-12-05 15:04:52 +01:00
committed by GitHub
parent fe8d5039bc
commit 93157d2e60
7 changed files with 33 additions and 4 deletions

View File

@@ -590,6 +590,14 @@
"description": "Toggles resizable state of the column", "description": "Toggles resizable state of the column",
"type": "boolean" "type": "boolean"
}, },
"draggable": {
"description": "Toggles draggable state of the column",
"type": "boolean"
},
"isHidden": {
"description": "Toggles hidden state of the column",
"type": "boolean"
},
"template": { "template": {
"description": "Column template id", "description": "Column template id",
"type": "string" "type": "string"
@@ -597,6 +605,10 @@
"desktopOnly": { "desktopOnly": {
"description": "Display column only for large screens", "description": "Display column only for large screens",
"type": "boolean" "type": "boolean"
},
"maxTextLength": {
"description": "Maximum text length before truncation",
"type": "number"
} }
} }
}, },

View File

@@ -51,7 +51,9 @@ describe('UniqueSearchNameValidator', () => {
}); });
it('should return error when name is not unique', (done) => { 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' }); expect(result).toEqual({ message: 'APP.BROWSE.SEARCH.SAVE_SEARCH.SEARCH_NAME_NOT_UNIQUE_ERROR' });
done(); done();
}); });

View File

@@ -34,7 +34,9 @@ export class UniqueSearchNameValidator implements AsyncValidator {
validate(control: AbstractControl): Observable<ValidationErrors | null> { validate(control: AbstractControl): Observable<ValidationErrors | null> {
return this.savedSearchesService.getSavedSearches().pipe( return this.savedSearchesService.getSavedSearches().pipe(
map((searches) => 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)) catchError(() => of(null))
); );

View File

@@ -30,7 +30,8 @@ export const savedSearchesListSchema = {
title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.LIST.NAME', title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.LIST.NAME',
class: 'adf-ellipsis-cell', class: 'adf-ellipsis-cell',
sortable: false, sortable: false,
draggable: false draggable: false,
maxTextLength: 250
}, },
{ {
type: 'text', type: 'text',
@@ -38,7 +39,8 @@ export const savedSearchesListSchema = {
title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.LIST.DESCRIPTION', title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.LIST.DESCRIPTION',
class: 'adf-ellipsis-cell', class: 'adf-ellipsis-cell',
sortable: false, sortable: false,
draggable: false draggable: false,
maxTextLength: 250
} }
] ]
}; };

View File

@@ -67,6 +67,7 @@ describe('SaveSearchSidenavComponent', () => {
id: 'manage-saved-searches', id: 'manage-saved-searches',
icon: '', icon: '',
title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.NAVBAR.MANAGE_BUTTON', title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.NAVBAR.MANAGE_BUTTON',
description: 'APP.BROWSE.SEARCH.SAVE_SEARCH.NAVBAR.MANAGE_BUTTON',
route: 'saved-searches', route: 'saved-searches',
url: 'saved-searches' url: 'saved-searches'
} }
@@ -84,6 +85,7 @@ describe('SaveSearchSidenavComponent', () => {
expect(component.item.children[0]).toEqual({ expect(component.item.children[0]).toEqual({
icon: '', icon: '',
title: '1', title: '1',
description: '1',
route: 'search?q=abc', route: 'search?q=abc',
url: 'search?q=abc', url: 'search?q=abc',
id: 'search1' id: 'search1'

View File

@@ -69,6 +69,7 @@ export class SaveSearchSidenavComponent implements OnInit {
id: 'search' + child.name, id: 'search' + child.name,
icon: '', icon: '',
title: child.name, title: child.name,
description: child.name,
route: `search?q=${child.encodedUrl}`, route: `search?q=${child.encodedUrl}`,
url: `search?q=${child.encodedUrl}` url: `search?q=${child.encodedUrl}`
})) }))
@@ -78,6 +79,7 @@ export class SaveSearchSidenavComponent implements OnInit {
id: this.manageSearchesId, id: this.manageSearchesId,
icon: '', icon: '',
title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.NAVBAR.MANAGE_BUTTON', title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.NAVBAR.MANAGE_BUTTON',
description: 'APP.BROWSE.SEARCH.SAVE_SEARCH.NAVBAR.MANAGE_BUTTON',
route: 'saved-searches', route: 'saved-searches',
url: 'saved-searches' url: 'saved-searches'
}); });

View File

@@ -1,3 +1,5 @@
@import '@alfresco/adf-core/lib/styles/mat-selectors';
.aca-sidenav { .aca-sidenav {
display: flex; display: flex;
flex: 1; flex: 1;
@@ -108,6 +110,11 @@
line-height: 32px; line-height: 32px;
justify-content: start; justify-content: start;
#{$mat-button-label} {
overflow: hidden;
text-overflow: ellipsis;
}
&--active { &--active {
color: var(--theme-sidenav-active-text-color); color: var(--theme-sidenav-active-text-color);
background: var(--theme-selected-background-color); background: var(--theme-selected-background-color);