Skip to content

Commit

Permalink
[ACS-9012] Truncate text in saved searches description (#4265)
Browse files Browse the repository at this point in the history
* [ACS-9012] Truncate text in saved searches description

* [ACS-9012] Truncate name column and navigation menu items

* [ACS-9012] Unit test fixes
  • Loading branch information
MichalKinas authored Dec 5, 2024
1 parent fe8d503 commit 93157d2
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 4 deletions.
12 changes: 12 additions & 0 deletions extension.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -590,13 +590,25 @@
"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"
},
"desktopOnly": {
"description": "Display column only for large screens",
"type": "boolean"
},
"maxTextLength": {
"description": "Maximum text length before truncation",
"type": "number"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ 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',
key: 'description',
title: 'APP.BROWSE.SEARCH.SAVE_SEARCH.LIST.DESCRIPTION',
class: 'adf-ellipsis-cell',
sortable: false,
draggable: false
draggable: false,
maxTextLength: 250
}
]
};
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand All @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
}))
Expand All @@ -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'
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '@alfresco/adf-core/lib/styles/mat-selectors';

.aca-sidenav {
display: flex;
flex: 1;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 93157d2

Please sign in to comment.