[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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 33 additions and 4 deletions

View File

@ -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"
}
}
},

View File

@ -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();
});

View File

@ -34,7 +34,9 @@ export class UniqueSearchNameValidator implements AsyncValidator {
validate(control: AbstractControl): Observable<ValidationErrors | null> {
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))
);

View File

@ -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
}
]
};

View File

@ -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'

View File

@ -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'
});

View File

@ -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);