From d12b3bdc2c7721ec56fdda922b344d525d5694d6 Mon Sep 17 00:00:00 2001 From: Shivangi Shree Date: Fri, 24 Jul 2026 12:25:31 +0530 Subject: [PATCH] [ACS-9106] Remove double checkbox (#5291) * [ACS-9106] Remove double checkbox * [ACS-9106] Add unit test for multiselect * [ACS-9106] Fix unit test code * [ACS-9106] Fix description of unit test * [ACS-9106] change the name of multiselect and add it to search component * [ACS-9106] Remove thumbnail component * [ACS-9106] Add thumbnail entry for search-results * [ACS-9106] Add action-menu above the icon * [ACS-9106] Add action-menu at correct place * [ACS-9106] Remove the logic of manually assigning column header * [ACS-9106] Remove ununsed class --- .../thumbnail-column.component.html | 10 -- .../thumbnail-column.component.scss | 9 -- .../thumbnail-column.component.spec.ts | 112 ------------------ .../thumbnail-column.component.ts | 80 ------------- .../search-results.component.html | 5 - .../search-results.component.ts | 2 - 6 files changed, 218 deletions(-) delete mode 100644 projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.html delete mode 100644 projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.scss delete mode 100644 projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.spec.ts delete mode 100644 projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.ts diff --git a/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.html b/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.html deleted file mode 100644 index 0f3600533..000000000 --- a/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - {{thumbnailUrl}} - - - - - - diff --git a/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.scss b/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.scss deleted file mode 100644 index 7bdefc56d..000000000 --- a/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.scss +++ /dev/null @@ -1,9 +0,0 @@ -@use '@angular/material' as mat; - -aca-custom-thumbnail-column { - @include mat.icon-overrides( - ( - color: var(--theme-accent-color) - ) - ); -} diff --git a/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.spec.ts b/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.spec.ts deleted file mode 100644 index e09cd05eb..000000000 --- a/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.spec.ts +++ /dev/null @@ -1,112 +0,0 @@ -/*! - * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * from Hyland Software. If not, see . - */ - -import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ThumbnailColumnComponent } from './thumbnail-column.component'; -import { TranslationService } from '@alfresco/adf-core'; - -describe('ThumbnailColumnComponent', () => { - let component: ThumbnailColumnComponent; - let fixture: ComponentFixture; - let translationServiceMock: any; - - beforeEach(() => { - translationServiceMock = { - instant: jasmine.createSpy('instant').and.returnValue('Locked by') - }; - - TestBed.configureTestingModule({ - imports: [ThumbnailColumnComponent], - providers: [{ provide: TranslationService, useValue: translationServiceMock }] - }); - - fixture = TestBed.createComponent(ThumbnailColumnComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should update thumbnailUrl and tooltip on context change', () => { - const context = { - row: { isSelected: true, node: { entry: { properties: { 'cm:lockOwner': { displayName: 'John Doe' } } } } }, - data: { getValue: () => 'material-icons://icon_name' }, - col: {} - }; - - component.ngOnChanges({ context: { currentValue: context, previousValue: null, firstChange: true, isFirstChange: () => true } }); - - expect(component.isIcon).toBeTrue(); - expect(component.thumbnailUrl).toBe('icon_name'); - expect(component.tooltip).toBe('Locked by John Doe'); - }); - - it('should handle non-icon thumbnails', () => { - const context = { - row: { isSelected: true, node: { entry: { properties: { 'cm:lockOwner': { displayName: 'John Doe' } } } } }, - data: { getValue: () => 'https://example.com/thumbnail.jpg' }, - col: {} - }; - - component.ngOnChanges({ context: { currentValue: context, previousValue: null, firstChange: true, isFirstChange: () => true } }); - - expect(component.isIcon).toBeFalse(); - expect(component.thumbnailUrl).toBe('https://example.com/thumbnail.jpg'); - expect(component.tooltip).toBe('Locked by John Doe'); - }); - - it('should clear thumbnailUrl and tooltip if context is null', () => { - component.ngOnChanges({ context: { currentValue: null, previousValue: {}, firstChange: false, isFirstChange: () => false } }); - - expect(component.thumbnailUrl).toBeNull(); - expect(component.tooltip).toBeNull(); - }); - - it('should return correct thumbnail from getThumbnail', () => { - const context = { - data: { getValue: () => 'thumbnail_url' }, - row: {}, - col: {} - }; - - const thumbnail = component['getThumbnail'](context); - expect(thumbnail).toBe('thumbnail_url'); - }); - - it('should return correct tooltip from getToolTip', () => { - const context = { - row: { node: { entry: { properties: { 'cm:lockOwner': { displayName: 'John Doe' } } } } } - }; - - const tooltip = component.getToolTip(context); - expect(tooltip).toBe('Locked by John Doe'); - }); - - it('should return empty tooltip if lockOwner is not present', () => { - const context = { - row: { node: { entry: { properties: {} } } } - }; - - const tooltip = component.getToolTip(context); - expect(tooltip).toBe(''); - }); -}); diff --git a/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.ts b/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.ts deleted file mode 100644 index c4b1b1a56..000000000 --- a/projects/aca-content/src/lib/components/dl-custom-components/thumbnail-column/thumbnail-column.component.ts +++ /dev/null @@ -1,80 +0,0 @@ -/*! - * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Alfresco Example Content Application - * - * This file is part of the Alfresco Example Content Application. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * The Alfresco Example Content Application is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The Alfresco Example Content Application is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * from Hyland Software. If not, see . - */ - -import { Component, inject, Input, OnChanges, SimpleChanges, ViewEncapsulation } from '@angular/core'; -import { TranslationService } from '@alfresco/adf-core'; -import { NgIf } from '@angular/common'; -import { MatIconModule } from '@angular/material/icon'; - -@Component({ - imports: [NgIf, MatIconModule], - selector: 'aca-custom-thumbnail-column', - templateUrl: './thumbnail-column.component.html', - styleUrls: ['./thumbnail-column.component.scss'], - encapsulation: ViewEncapsulation.None -}) -export class ThumbnailColumnComponent implements OnChanges { - private readonly translation = inject(TranslationService); - - @Input() - context: any; - - public thumbnailUrl?: string; - public tooltip?: string; - public isIcon = false; - - get isSelected(): boolean { - return !!this.context?.row?.isSelected; - } - - ngOnChanges(changes: SimpleChanges): void { - if (changes.context) { - const context = changes.context.currentValue; - - if (context) { - const icon = this.getThumbnail(context); - if (icon?.startsWith('material-icons://')) { - this.isIcon = true; - this.thumbnailUrl = icon.replace('material-icons://', ''); - } else { - this.isIcon = false; - this.thumbnailUrl = icon; - } - this.tooltip = this.getToolTip(context); - } else { - this.thumbnailUrl = null; - this.tooltip = null; - } - } - } - - getThumbnail({ data, row, col }): string { - return data.getValue(row, col); - } - - getToolTip({ row }): string { - const displayName = row.node?.entry?.properties?.['cm:lockOwner']?.displayName; - return displayName ? `${this.translation.instant('APP.LOCKED_BY')} ${displayName}` : ''; - } -} diff --git a/projects/aca-content/src/lib/components/search/search-results/search-results.component.html b/projects/aca-content/src/lib/components/search/search-results/search-results.component.html index f137e58f5..d7e8861d9 100644 --- a/projects/aca-content/src/lib/components/search/search-results/search-results.component.html +++ b/projects/aca-content/src/lib/components/search/search-results/search-results.component.html @@ -110,17 +110,12 @@ [sr-title]="'ADF-DOCUMENT-LIST.LAYOUT.THUMBNAIL'" [sortable]="false" > - - - - -