From ae244dc6a714db08218871f198d9a909580ea984 Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Tue, 29 Aug 2023 13:24:51 +0200 Subject: [PATCH 01/15] [ACS-5601] Add badges to name column component --- extension.schema.json | 24 ++++++++ .../name-column/name-column.component.html | 48 +++++++-------- .../name-column/name-column.component.scss | 8 ++- .../name-column/name-column.component.spec.ts | 30 ++++++++++ .../name-column/name-column.component.ts | 18 +++++- projects/aca-shared/src/lib/models/types.ts | 5 ++ .../services/app.extension.service.spec.ts | 59 +++++++++++++++++++ .../src/lib/services/app.extension.service.ts | 8 ++- 8 files changed, 172 insertions(+), 28 deletions(-) diff --git a/extension.schema.json b/extension.schema.json index 36f68a1481..92c6bfa420 100644 --- a/extension.schema.json +++ b/extension.schema.json @@ -640,6 +640,30 @@ "$ref": "node_modules/@alfresco/adf-core/app.config.schema.json#/definitions/search-configuration" } ] + }, + "badges": { + "description": "List of badges to display in the name column", + "type": "array", + "items": { "$ref": "#/definitions/badge" }, + "minItems": 1 + }, + "badge": { + "type": "object", + "required": ["id", "icon", "tooltip"], + "properties": { + "id": { + "description": "Unique identifier. Must be in the format '[namespace]:[name]'.", + "type": "string" + }, + "icon": { + "description": "Badge icon to display.", + "type": "string" + }, + "tooltip": { + "description": "Badge tooltip to display on hover.", + "type": "string" + } + } } }, diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html index cdb2cc3fe3..b130a27923 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html @@ -1,25 +1,27 @@ -
- - {{ displayText$ | async }} - +
+
+ + {{ displayText$ | async }} + - - - + + + +
+
+ + + +
diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss index 2adc67c0fb..8f28c82871 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss @@ -1,6 +1,12 @@ +.adf-datatable-content-cell.adf-name-column.aca-custom-name-column { + position: unset; +} + .aca-custom-name-column { - display: block; + display: flex; align-items: center; + justify-content: space-between; + width: 100%; .aca-name-column-container { aca-locked-by { diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts index 5daf9ddacf..9f122333cf 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts @@ -28,10 +28,15 @@ import { StoreModule } from '@ngrx/store'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { HttpClientModule } from '@angular/common/http'; import { TranslateModule } from '@ngx-translate/core'; +import { AppExtensionService } from '@alfresco/aca-shared'; +import { of } from 'rxjs'; +import { ContentActionType } from '@alfresco/adf-extensions'; +import { By } from '@angular/platform-browser'; describe('CustomNameColumnComponent', () => { let fixture: ComponentFixture; let component: CustomNameColumnComponent; + let appExtensionService: AppExtensionService; beforeEach(() => { TestBed.configureTestingModule({ @@ -41,6 +46,7 @@ describe('CustomNameColumnComponent', () => { fixture = TestBed.createComponent(CustomNameColumnComponent); component = fixture.componentInstance; + appExtensionService = TestBed.inject(AppExtensionService); }); it('should not render lock element if file is not locked', () => { @@ -114,4 +120,28 @@ describe('CustomNameColumnComponent', () => { component.onLinkClick(event); expect(event.stopPropagation).toHaveBeenCalled(); }); + + it('should get badges when component initializes', () => { + component.context = { + row: { + node: { + entry: { + isFile: true, + id: 'nodeId' + } + }, + getValue: (key: string) => key + } + }; + spyOn(appExtensionService, 'getBadges').and.returnValue( + of([{ id: 'test', type: ContentActionType.custom, icon: 'warning', tooltip: 'test tooltip' }]) + ); + component.ngOnInit(); + fixture.detectChanges(); + const badges = fixture.debugElement.queryAll(By.css('.adf-datatable-cell-badge')).map((badge) => badge.nativeElement); + expect(appExtensionService.getBadges).toHaveBeenCalled(); + expect(badges.length).toBe(1); + expect(badges[0].innerText).toBe('warning'); + expect(badges[0].attributes['title'].value).toBe('test tooltip'); + }); }); diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts index e3a1e87a7d..794b55147e 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts @@ -28,13 +28,14 @@ import { Actions, ofType } from '@ngrx/effects'; import { Subject } from 'rxjs'; import { filter, takeUntil } from 'rxjs/operators'; import { NodeActionTypes } from '@alfresco/aca-shared/store'; -import { LockedByComponent, isLocked } from '@alfresco/aca-shared'; +import { LockedByComponent, isLocked, AppExtensionService, Badge } from '@alfresco/aca-shared'; import { CommonModule } from '@angular/common'; import { TranslateModule } from '@ngx-translate/core'; +import { IconModule } from '@alfresco/adf-core'; @Component({ standalone: true, - imports: [CommonModule, TranslateModule, LockedByComponent, ContentPipeModule], + imports: [CommonModule, TranslateModule, LockedByComponent, ContentPipeModule, IconModule], selector: 'aca-custom-name-column', templateUrl: './name-column.component.html', styleUrls: ['./name-column.component.scss'], @@ -48,8 +49,15 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On isFile: boolean; isFileWriteLocked: boolean; + badges: Badge[]; - constructor(element: ElementRef, private cd: ChangeDetectorRef, private actions$: Actions, private nodesService: NodesApiService) { + constructor( + element: ElementRef, + private cd: ChangeDetectorRef, + private actions$: Actions, + private nodesService: NodesApiService, + private appExtensionService: AppExtensionService + ) { super(element, nodesService); } @@ -86,6 +94,10 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On this.isFileWriteLocked = isLocked(this.node); this.cd.detectChanges(); }); + + this.appExtensionService.getBadges(this.node).subscribe((badges) => { + this.badges = badges; + }); } onLinkClick(event: Event) { diff --git a/projects/aca-shared/src/lib/models/types.ts b/projects/aca-shared/src/lib/models/types.ts index 76e6ab5d1d..ae8ac84bf3 100644 --- a/projects/aca-shared/src/lib/models/types.ts +++ b/projects/aca-shared/src/lib/models/types.ts @@ -22,6 +22,7 @@ * from Hyland Software. If not, see . */ +import { ContentActionRef } from '@alfresco/adf-extensions'; import { Route } from '@angular/router'; export interface SettingsGroupRef { @@ -45,3 +46,7 @@ export interface SettingsParameterRef { export interface ExtensionRoute extends Route { parentRoute?: string; } + +export interface Badge extends ContentActionRef { + tooltip: string; +} diff --git a/projects/aca-shared/src/lib/services/app.extension.service.spec.ts b/projects/aca-shared/src/lib/services/app.extension.service.spec.ts index e934155d32..966b8865ba 100644 --- a/projects/aca-shared/src/lib/services/app.extension.service.spec.ts +++ b/projects/aca-shared/src/lib/services/app.extension.service.spec.ts @@ -43,6 +43,7 @@ import { provideMockStore } from '@ngrx/store/testing'; import { hasQuickShareEnabled } from '@alfresco/aca-shared/rules'; import { MatIconRegistry } from '@angular/material/icon'; import { DomSanitizer } from '@angular/platform-browser'; +import { NodeEntry } from '@alfresco/js-api'; describe('AppExtensionService', () => { let service: AppExtensionService; @@ -1677,4 +1678,62 @@ describe('AppExtensionService', () => { done(); }); }); + + it('should get badges from config', (done) => { + extensions.setEvaluators({ + 'action.enabled': () => true + }); + + applyConfig({ + $id: 'test', + $name: 'test', + $version: '1.0.0', + $license: 'MIT', + $vendor: 'Good company', + $runtime: '1.5.0', + features: { + badges: [ + { + id: 'action1-id', + icon: 'warning', + tooltip: 'test tooltip', + type: 'custom', + rules: { + visible: 'action.enabled' + } + }, + { + id: 'action2-id', + icon: 'settings', + tooltip: 'test tooltip2', + type: 'custom', + rules: { + visible: 'action.enabled' + } + } + ] + } + }); + + const node: NodeEntry = { + entry: { + id: 'testId', + name: 'testName', + nodeType: 'test', + isFile: true, + isFolder: false, + modifiedAt: undefined, + createdAt: undefined, + modifiedByUser: undefined, + createdByUser: undefined + } + }; + + service.getBadges(node).subscribe((badges) => { + expect(badges.length).toBe(2); + expect(badges[0].id).toEqual('action1-id'); + expect(badges[1].id).toEqual('action2-id'); + done(); + }); + }); }); diff --git a/projects/aca-shared/src/lib/services/app.extension.service.ts b/projects/aca-shared/src/lib/services/app.extension.service.ts index bb32e031ab..5f16ee1c73 100644 --- a/projects/aca-shared/src/lib/services/app.extension.service.ts +++ b/projects/aca-shared/src/lib/services/app.extension.service.ts @@ -53,7 +53,7 @@ import { AppConfigService, AuthenticationService, LogService } from '@alfresco/a import { BehaviorSubject, Observable } from 'rxjs'; import { RepositoryInfo, NodeEntry } from '@alfresco/js-api'; import { ViewerRules } from '../models/viewer.rules'; -import { SettingsGroupRef } from '../models/types'; +import { Badge, SettingsGroupRef } from '../models/types'; import { NodePermissionService } from '../services/node-permission.service'; import { filter, map } from 'rxjs/operators'; import { ModalConfiguration } from '../models/modal-configuration'; @@ -80,6 +80,7 @@ export class AppExtensionService implements RuleContext { private _createActions = new BehaviorSubject>([]); private _mainActions = new BehaviorSubject(null); private _sidebarActions = new BehaviorSubject>([]); + private _badges = new BehaviorSubject>([]); private _filesDocumentListPreset = new BehaviorSubject>([]); documentListPresets: { @@ -158,6 +159,7 @@ export class AppExtensionService implements RuleContext { this._openWithActions.next(this.loader.getContentActions(config, 'features.viewer.openWith')); this._createActions.next(this.loader.getElements(config, 'features.create')); this._mainActions.next(this.loader.getFeatures(config).mainAction); + this._badges.next(this.loader.getElements(config, 'features.badges')); this._filesDocumentListPreset.next(this.getDocumentListPreset(config, 'files')); this.navbar = this.loadNavBar(config); @@ -370,6 +372,10 @@ export class AppExtensionService implements RuleContext { ); } + getBadges(node: NodeEntry): Observable> { + return this._badges.pipe(map((badges) => badges.filter((badge) => this.evaluateRule(badge.rules.visible, node)))); + } + private buildMenu(actionRef: ContentActionRef): ContentActionRef { if (actionRef.type === ContentActionType.menu && actionRef.children && actionRef.children.length > 0) { const children = actionRef.children.filter((action) => this.filterVisible(action)).map((action) => this.buildMenu(action)); From dd7e993dd314ff5aeec1ae3d90fd03f034aede7d Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Fri, 1 Sep 2023 13:13:25 +0200 Subject: [PATCH 02/15] [ACS-5601] Add on click handler to column badges --- .../name-column/name-column.component.html | 2 +- .../name-column/name-column.component.spec.ts | 23 ++++++++++++++++ .../name-column/name-column.component.ts | 4 +++ .../src/lib/models/modal-configuration.ts | 27 ------------------- .../src/lib/services/app.extension.service.ts | 3 +-- projects/aca-shared/src/public-api.ts | 1 - 6 files changed, 29 insertions(+), 31 deletions(-) delete mode 100644 projects/aca-shared/src/lib/models/modal-configuration.ts diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html index b130a27923..be083fda92 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html @@ -21,7 +21,7 @@
- +
diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts index 9f122333cf..dc8b997c24 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts @@ -144,4 +144,27 @@ describe('CustomNameColumnComponent', () => { expect(badges[0].innerText).toBe('warning'); expect(badges[0].attributes['title'].value).toBe('test tooltip'); }); + + it('should call provided handler on click', () => { + component.context = { + row: { + node: { + entry: { + isFile: true, + id: 'nodeId' + } + }, + getValue: (key: string) => key + } + }; + spyOn(appExtensionService, 'runActionById'); + spyOn(appExtensionService, 'getBadges').and.returnValue( + of([{ id: 'test', type: ContentActionType.custom, icon: 'warning', tooltip: 'test tooltip', actions: { click: 'test' } }]) + ); + component.ngOnInit(); + fixture.detectChanges(); + const badges = fixture.debugElement.queryAll(By.css('.adf-datatable-cell-badge')).map((badge) => badge.nativeElement); + badges[0].click(); + expect(appExtensionService.runActionById).toHaveBeenCalledWith('test', component.context.row.node); + }); }); diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts index 794b55147e..d18ae1a521 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts @@ -111,4 +111,8 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On this.onDestroy$$.next(true); this.onDestroy$$.complete(); } + + onBadgeClick(badge: Badge) { + this.appExtensionService.runActionById(badge.actions?.click, this.node); + } } diff --git a/projects/aca-shared/src/lib/models/modal-configuration.ts b/projects/aca-shared/src/lib/models/modal-configuration.ts deleted file mode 100644 index 838284b7fb..0000000000 --- a/projects/aca-shared/src/lib/models/modal-configuration.ts +++ /dev/null @@ -1,27 +0,0 @@ -/*! - * Copyright © 2005-2023 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 . - */ - -export interface ModalConfiguration { - focusedElementOnCloseSelector?: string; -} diff --git a/projects/aca-shared/src/lib/services/app.extension.service.ts b/projects/aca-shared/src/lib/services/app.extension.service.ts index 5f16ee1c73..393c0339e7 100644 --- a/projects/aca-shared/src/lib/services/app.extension.service.ts +++ b/projects/aca-shared/src/lib/services/app.extension.service.ts @@ -56,7 +56,6 @@ import { ViewerRules } from '../models/viewer.rules'; import { Badge, SettingsGroupRef } from '../models/types'; import { NodePermissionService } from '../services/node-permission.service'; import { filter, map } from 'rxjs/operators'; -import { ModalConfiguration } from '../models/modal-configuration'; @Injectable({ providedIn: 'root' @@ -498,7 +497,7 @@ export class AppExtensionService implements RuleContext { return false; } - runActionById(id: string, additionalPayload?: ModalConfiguration) { + runActionById(id: string, additionalPayload?: any) { const action = this.extensions.getActionById(id); if (action) { const { type, payload } = action; diff --git a/projects/aca-shared/src/public-api.ts b/projects/aca-shared/src/public-api.ts index 43b0c0f1bf..96c2419c21 100644 --- a/projects/aca-shared/src/public-api.ts +++ b/projects/aca-shared/src/public-api.ts @@ -45,7 +45,6 @@ export * from './lib/directives/pagination.directive'; export * from './lib/models/types'; export * from './lib/models/viewer.rules'; -export * from './lib/models/modal-configuration'; export * from './lib/routing/shared.guard'; From 413a9c7cba758e9148fa78efcfa3bd00453b3902 Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Tue, 26 Sep 2023 14:28:19 +0200 Subject: [PATCH 03/15] [ACS-5601] Fix badge hover color --- .../name-column/name-column.component.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss index 8f28c82871..c515811ab2 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss @@ -2,6 +2,10 @@ position: unset; } +.adf-datatable-list .adf-datatable-link:hover .aca-name-column-badges { + color: var(--adf-theme-foreground-text-color); +} + .aca-custom-name-column { display: flex; align-items: center; From bcd3b22ddbdf94c5c391631952eb120fd59ad917 Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Tue, 26 Sep 2023 14:44:43 +0200 Subject: [PATCH 04/15] [ACS-5601] Restore modal configuration, prettier fixes --- .../name-column/name-column.component.html | 6 ++--- .../src/lib/models/modal-configuration.ts | 27 +++++++++++++++++++ projects/aca-shared/src/public-api.ts | 1 + 3 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 projects/aca-shared/src/lib/models/modal-configuration.ts diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html index be083fda92..2d70c48582 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html @@ -1,11 +1,11 @@
-
+
. + */ + +export interface ModalConfiguration { + focusedElementOnCloseSelector?: string; +} diff --git a/projects/aca-shared/src/public-api.ts b/projects/aca-shared/src/public-api.ts index 96c2419c21..43b0c0f1bf 100644 --- a/projects/aca-shared/src/public-api.ts +++ b/projects/aca-shared/src/public-api.ts @@ -45,6 +45,7 @@ export * from './lib/directives/pagination.directive'; export * from './lib/models/types'; export * from './lib/models/viewer.rules'; +export * from './lib/models/modal-configuration'; export * from './lib/routing/shared.guard'; From 5560ce5bf83c938769751f96d1b3f9281f8438e2 Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Tue, 26 Sep 2023 19:33:56 +0200 Subject: [PATCH 05/15] [ACS-5601] Add missing tooltip translation --- .../dl-custom-components/name-column/name-column.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html index 2d70c48582..62869c1f4c 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html @@ -21,7 +21,7 @@
- +
From 96155087ac60adee8fa813860a5dfc4ea463bd2c Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Wed, 27 Sep 2023 16:49:22 +0200 Subject: [PATCH 06/15] [ACS-5601] Add process content services to extension service --- projects/aca-shared/src/lib/services/app.extension.service.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/aca-shared/src/lib/services/app.extension.service.ts b/projects/aca-shared/src/lib/services/app.extension.service.ts index 393c0339e7..11e920024c 100644 --- a/projects/aca-shared/src/lib/services/app.extension.service.ts +++ b/projects/aca-shared/src/lib/services/app.extension.service.ts @@ -50,6 +50,7 @@ import { mergeArrays } from '@alfresco/adf-extensions'; import { AppConfigService, AuthenticationService, LogService } from '@alfresco/adf-core'; +import { ProcessContentService } from '@alfresco/adf-process-services'; import { BehaviorSubject, Observable } from 'rxjs'; import { RepositoryInfo, NodeEntry } from '@alfresco/js-api'; import { ViewerRules } from '../models/viewer.rules'; @@ -118,6 +119,7 @@ export class AppExtensionService implements RuleContext { protected extensions: ExtensionService, public permissions: NodePermissionService, public appConfig: AppConfigService, + public processContent: ProcessContentService, protected matIconRegistry: MatIconRegistry, protected sanitizer: DomSanitizer, protected logger: LogService From 4e35c74e1039d23927ae765c4bf4099d6b8595c7 Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Mon, 2 Oct 2023 14:15:33 +0200 Subject: [PATCH 07/15] [ACS-5601] Add adf dynamic component to custom name column --- package.json | 1 + .../name-column/name-column.component.html | 5 ++++- .../name-column/name-column.component.scss | 20 +++++++++++-------- .../name-column/name-column.component.ts | 3 ++- projects/aca-shared/package.json | 1 + 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index a582c78f96..9abeb97a5c 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "@alfresco/adf-core": "6.4.0-6377399867", "@alfresco/adf-extensions": "6.4.0-6377399867", "@alfresco/eslint-plugin-eslint-angular": "6.4.0-6377399867", + "@alfresco/adf-process-services": "6.4.0-6377399867", "@alfresco/js-api": "7.1.0-1367", "@angular/animations": "14.1.3", "@angular/cdk": "14.1.3", diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html index 62869c1f4c..800e5d74a9 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html @@ -21,7 +21,10 @@
- + + + +
diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss index c515811ab2..42e3e823c7 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss @@ -1,17 +1,13 @@ -.adf-datatable-content-cell.adf-name-column.aca-custom-name-column { - position: unset; -} - -.adf-datatable-list .adf-datatable-link:hover .aca-name-column-badges { - color: var(--adf-theme-foreground-text-color); -} - .aca-custom-name-column { display: flex; align-items: center; justify-content: space-between; width: 100%; + .aca-name-column-badges { + display: flex; + } + .aca-name-column-container { aca-locked-by { display: flex; @@ -27,3 +23,11 @@ } } } + +.adf-datatable-content-cell.adf-name-column.aca-custom-name-column { + position: unset; +} + +.adf-datatable-list .adf-datatable-link:hover .aca-name-column-badges { + color: var(--adf-theme-foreground-text-color); +} diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts index d18ae1a521..a952f58f3c 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts @@ -32,10 +32,11 @@ import { LockedByComponent, isLocked, AppExtensionService, Badge } from '@alfres import { CommonModule } from '@angular/common'; import { TranslateModule } from '@ngx-translate/core'; import { IconModule } from '@alfresco/adf-core'; +import { ExtensionsModule } from '@alfresco/adf-extensions'; @Component({ standalone: true, - imports: [CommonModule, TranslateModule, LockedByComponent, ContentPipeModule, IconModule], + imports: [CommonModule, TranslateModule, LockedByComponent, ContentPipeModule, IconModule, ExtensionsModule], selector: 'aca-custom-name-column', templateUrl: './name-column.component.html', styleUrls: ['./name-column.component.scss'], diff --git a/projects/aca-shared/package.json b/projects/aca-shared/package.json index abfa150f1f..1467c4bca9 100644 --- a/projects/aca-shared/package.json +++ b/projects/aca-shared/package.json @@ -8,6 +8,7 @@ "@alfresco/adf-content-services": "^6.4.0-6341205853", "@alfresco/adf-core": "^6.4.0-6341205853", "@alfresco/adf-extensions": "^6.4.0-6341205853", + "@alfresco/adf-process-services": "^6.4.0-6341205853", "@alfresco/js-api": "^7.1.0-1349", "@angular/animations": "^14.1.3", "@angular/common": "^14.1.3", From 2651e2bde10890f0b636aea628e7dcd1d2841bd9 Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Mon, 2 Oct 2023 14:33:56 +0200 Subject: [PATCH 08/15] [ACS-5601] Add missing dosc and unit tests --- extension.schema.json | 4 + .../name-column/name-column.component.spec.ts | 92 ++++++++++--------- .../src/lib/services/app.extension.service.ts | 2 - 3 files changed, 52 insertions(+), 46 deletions(-) diff --git a/extension.schema.json b/extension.schema.json index 92c6bfa420..f946bfb8fd 100644 --- a/extension.schema.json +++ b/extension.schema.json @@ -662,6 +662,10 @@ "tooltip": { "description": "Badge tooltip to display on hover.", "type": "string" + }, + "component": { + "description": "Custom component id to display", + "type": "string" } } } diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts index dc8b997c24..e648a41523 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts @@ -121,50 +121,54 @@ describe('CustomNameColumnComponent', () => { expect(event.stopPropagation).toHaveBeenCalled(); }); - it('should get badges when component initializes', () => { - component.context = { - row: { - node: { - entry: { - isFile: true, - id: 'nodeId' - } - }, - getValue: (key: string) => key - } - }; - spyOn(appExtensionService, 'getBadges').and.returnValue( - of([{ id: 'test', type: ContentActionType.custom, icon: 'warning', tooltip: 'test tooltip' }]) - ); - component.ngOnInit(); - fixture.detectChanges(); - const badges = fixture.debugElement.queryAll(By.css('.adf-datatable-cell-badge')).map((badge) => badge.nativeElement); - expect(appExtensionService.getBadges).toHaveBeenCalled(); - expect(badges.length).toBe(1); - expect(badges[0].innerText).toBe('warning'); - expect(badges[0].attributes['title'].value).toBe('test tooltip'); - }); + describe('Name column badges', () => { + beforeEach(() => { + component.context = { + row: { + node: { + entry: { + isFile: true, + id: 'nodeId' + } + }, + getValue: (key: string) => key + } + }; + }); - it('should call provided handler on click', () => { - component.context = { - row: { - node: { - entry: { - isFile: true, - id: 'nodeId' - } - }, - getValue: (key: string) => key - } - }; - spyOn(appExtensionService, 'runActionById'); - spyOn(appExtensionService, 'getBadges').and.returnValue( - of([{ id: 'test', type: ContentActionType.custom, icon: 'warning', tooltip: 'test tooltip', actions: { click: 'test' } }]) - ); - component.ngOnInit(); - fixture.detectChanges(); - const badges = fixture.debugElement.queryAll(By.css('.adf-datatable-cell-badge')).map((badge) => badge.nativeElement); - badges[0].click(); - expect(appExtensionService.runActionById).toHaveBeenCalledWith('test', component.context.row.node); + it('should get badges when component initializes', () => { + spyOn(appExtensionService, 'getBadges').and.returnValue( + of([{ id: 'test', type: ContentActionType.custom, icon: 'warning', tooltip: 'test tooltip' }]) + ); + component.ngOnInit(); + fixture.detectChanges(); + const badges = fixture.debugElement.queryAll(By.css('.adf-datatable-cell-badge')).map((badge) => badge.nativeElement); + expect(appExtensionService.getBadges).toHaveBeenCalled(); + expect(badges.length).toBe(1); + expect(badges[0].innerText).toBe('warning'); + expect(badges[0].attributes['title'].value).toBe('test tooltip'); + }); + + it('should call provided handler on click', () => { + spyOn(appExtensionService, 'runActionById'); + spyOn(appExtensionService, 'getBadges').and.returnValue( + of([{ id: 'test', type: ContentActionType.custom, icon: 'warning', tooltip: 'test tooltip', actions: { click: 'test' } }]) + ); + component.ngOnInit(); + fixture.detectChanges(); + const badges = fixture.debugElement.queryAll(By.css('.adf-datatable-cell-badge')).map((badge) => badge.nativeElement); + badges[0].click(); + expect(appExtensionService.runActionById).toHaveBeenCalledWith('test', component.context.row.node); + }); + + it('should render dynamic component when badge has one provided', () => { + spyOn(appExtensionService, 'getBadges').and.returnValue( + of([{ id: 'test', type: ContentActionType.custom, icon: 'warning', tooltip: 'test tooltip', component: 'test-id' }]) + ); + component.ngOnInit(); + fixture.detectChanges(); + const dynamicComponent = fixture.debugElement.query(By.css('adf-dynamic-component')).nativeElement; + expect(dynamicComponent).toBeDefined(); + }); }); }); diff --git a/projects/aca-shared/src/lib/services/app.extension.service.ts b/projects/aca-shared/src/lib/services/app.extension.service.ts index 11e920024c..393c0339e7 100644 --- a/projects/aca-shared/src/lib/services/app.extension.service.ts +++ b/projects/aca-shared/src/lib/services/app.extension.service.ts @@ -50,7 +50,6 @@ import { mergeArrays } from '@alfresco/adf-extensions'; import { AppConfigService, AuthenticationService, LogService } from '@alfresco/adf-core'; -import { ProcessContentService } from '@alfresco/adf-process-services'; import { BehaviorSubject, Observable } from 'rxjs'; import { RepositoryInfo, NodeEntry } from '@alfresco/js-api'; import { ViewerRules } from '../models/viewer.rules'; @@ -119,7 +118,6 @@ export class AppExtensionService implements RuleContext { protected extensions: ExtensionService, public permissions: NodePermissionService, public appConfig: AppConfigService, - public processContent: ProcessContentService, protected matIconRegistry: MatIconRegistry, protected sanitizer: DomSanitizer, protected logger: LogService From 2e9b1c10697ee0ee5f722da023e9e8b77dd4073f Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Mon, 2 Oct 2023 16:10:53 +0200 Subject: [PATCH 09/15] [ACS-5601] Post rebase package lock update --- package-lock.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/package-lock.json b/package-lock.json index 03730947f0..58049ba153 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "@alfresco/adf-content-services": "6.4.0-6377399867", "@alfresco/adf-core": "6.4.0-6377399867", "@alfresco/adf-extensions": "6.4.0-6377399867", + "@alfresco/adf-process-services": "6.4.0-6377399867", "@alfresco/eslint-plugin-eslint-angular": "6.4.0-6377399867", "@alfresco/js-api": "7.1.0-1367", "@angular/animations": "14.1.3", @@ -205,6 +206,31 @@ "@angular/core": ">=14.1.3" } }, + "node_modules/@alfresco/adf-process-services": { + "version": "6.4.0-6377399867", + "resolved": "https://registry.npmjs.org/@alfresco/adf-process-services/-/adf-process-services-6.4.0-6377399867.tgz", + "integrity": "sha512-SvWB7vf4WmLiAG6G+rvALut9Nnd8HtvK4r86NbFtb3um24PqfR9pFEaNAsF8FZYkkwKobSxK4ptnQLbd/c8Dgg==", + "dependencies": { + "tslib": "^2.3.0" + }, + "peerDependencies": { + "@alfresco/adf-content-services": ">=6.4.0-6377399867", + "@alfresco/adf-core": ">=6.4.0-6377399867", + "@alfresco/js-api": ">=7.1.0-1349", + "@angular/animations": ">=14.1.3", + "@angular/cdk": ">=14.1.2", + "@angular/common": ">=14.1.3", + "@angular/compiler": ">=14.1.3", + "@angular/core": ">=14.1.3", + "@angular/forms": ">=14.1.3", + "@angular/material": ">=14.1.2", + "@angular/platform-browser": ">=14.1.3", + "@angular/platform-browser-dynamic": ">=14.1.3", + "@angular/router": ">=14.1.3", + "@ngx-translate/core": ">=14.0.0", + "moment": ">=2.22.2" + } + }, "node_modules/@alfresco/adf-testing": { "version": "6.4.0-6377399867", "resolved": "https://registry.npmjs.org/@alfresco/adf-testing/-/adf-testing-6.4.0-6377399867.tgz", From 71661b49b69183c0df79772bf52f6971ecc87ba2 Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Tue, 3 Oct 2023 08:24:05 +0200 Subject: [PATCH 10/15] [ACS-5601] CR fixes --- package-lock.json | 26 ------------------- package.json | 1 - .../name-column/name-column.component.html | 4 +-- .../name-column/name-column.component.ts | 9 ++++--- projects/aca-shared/package.json | 1 - 5 files changed, 8 insertions(+), 33 deletions(-) diff --git a/package-lock.json b/package-lock.json index 58049ba153..03730947f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,6 @@ "@alfresco/adf-content-services": "6.4.0-6377399867", "@alfresco/adf-core": "6.4.0-6377399867", "@alfresco/adf-extensions": "6.4.0-6377399867", - "@alfresco/adf-process-services": "6.4.0-6377399867", "@alfresco/eslint-plugin-eslint-angular": "6.4.0-6377399867", "@alfresco/js-api": "7.1.0-1367", "@angular/animations": "14.1.3", @@ -206,31 +205,6 @@ "@angular/core": ">=14.1.3" } }, - "node_modules/@alfresco/adf-process-services": { - "version": "6.4.0-6377399867", - "resolved": "https://registry.npmjs.org/@alfresco/adf-process-services/-/adf-process-services-6.4.0-6377399867.tgz", - "integrity": "sha512-SvWB7vf4WmLiAG6G+rvALut9Nnd8HtvK4r86NbFtb3um24PqfR9pFEaNAsF8FZYkkwKobSxK4ptnQLbd/c8Dgg==", - "dependencies": { - "tslib": "^2.3.0" - }, - "peerDependencies": { - "@alfresco/adf-content-services": ">=6.4.0-6377399867", - "@alfresco/adf-core": ">=6.4.0-6377399867", - "@alfresco/js-api": ">=7.1.0-1349", - "@angular/animations": ">=14.1.3", - "@angular/cdk": ">=14.1.2", - "@angular/common": ">=14.1.3", - "@angular/compiler": ">=14.1.3", - "@angular/core": ">=14.1.3", - "@angular/forms": ">=14.1.3", - "@angular/material": ">=14.1.2", - "@angular/platform-browser": ">=14.1.3", - "@angular/platform-browser-dynamic": ">=14.1.3", - "@angular/router": ">=14.1.3", - "@ngx-translate/core": ">=14.0.0", - "moment": ">=2.22.2" - } - }, "node_modules/@alfresco/adf-testing": { "version": "6.4.0-6377399867", "resolved": "https://registry.npmjs.org/@alfresco/adf-testing/-/adf-testing-6.4.0-6377399867.tgz", diff --git a/package.json b/package.json index 9abeb97a5c..a582c78f96 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "@alfresco/adf-core": "6.4.0-6377399867", "@alfresco/adf-extensions": "6.4.0-6377399867", "@alfresco/eslint-plugin-eslint-angular": "6.4.0-6377399867", - "@alfresco/adf-process-services": "6.4.0-6377399867", "@alfresco/js-api": "7.1.0-1367", "@angular/animations": "14.1.3", "@angular/cdk": "14.1.3", diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html index 800e5d74a9..b19de5842f 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html @@ -21,9 +21,9 @@
- + - +
diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts index a952f58f3c..dfeefcc7bb 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.ts @@ -96,9 +96,12 @@ export class CustomNameColumnComponent extends NameColumnComponent implements On this.cd.detectChanges(); }); - this.appExtensionService.getBadges(this.node).subscribe((badges) => { - this.badges = badges; - }); + this.appExtensionService + .getBadges(this.node) + .pipe(takeUntil(this.onDestroy$$)) + .subscribe((badges) => { + this.badges = badges; + }); } onLinkClick(event: Event) { diff --git a/projects/aca-shared/package.json b/projects/aca-shared/package.json index 1467c4bca9..abfa150f1f 100644 --- a/projects/aca-shared/package.json +++ b/projects/aca-shared/package.json @@ -8,7 +8,6 @@ "@alfresco/adf-content-services": "^6.4.0-6341205853", "@alfresco/adf-core": "^6.4.0-6341205853", "@alfresco/adf-extensions": "^6.4.0-6341205853", - "@alfresco/adf-process-services": "^6.4.0-6341205853", "@alfresco/js-api": "^7.1.0-1349", "@angular/animations": "^14.1.3", "@angular/common": "^14.1.3", From bf00696eb5641e76d894c5e1ceaff9410b78669c Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Tue, 3 Oct 2023 09:02:35 +0200 Subject: [PATCH 11/15] [ACS-5601] Unit test fix --- .../name-column/name-column.component.spec.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts index e648a41523..197725e7ce 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts @@ -32,6 +32,7 @@ import { AppExtensionService } from '@alfresco/aca-shared'; import { of } from 'rxjs'; import { ContentActionType } from '@alfresco/adf-extensions'; import { By } from '@angular/platform-browser'; +import { INITIAL_APP_STATE } from '../../../store/initial-state'; describe('CustomNameColumnComponent', () => { let fixture: ComponentFixture; @@ -40,7 +41,19 @@ describe('CustomNameColumnComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [HttpClientModule, TranslateModule.forRoot(), CustomNameColumnComponent, StoreModule.forRoot({ app: () => {} }, { initialState: {} })], + imports: [ + HttpClientModule, + TranslateModule.forRoot(), + CustomNameColumnComponent, + StoreModule.forRoot( + { app: (state) => state }, + { + initialState: { + app: INITIAL_APP_STATE + } + } + ) + ], providers: [Actions] }); From 12fb987e136399d69626c5a6013c6161b9d5c18e Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Tue, 3 Oct 2023 09:03:13 +0200 Subject: [PATCH 12/15] [ACS-5601] CR fix --- .../dl-custom-components/name-column/name-column.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html index b19de5842f..7981cb8599 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.html @@ -21,7 +21,7 @@
- + From fd0e5f41b4ba144cbe776e42d12cca53e2712d03 Mon Sep 17 00:00:00 2001 From: MichalKinas Date: Tue, 3 Oct 2023 10:26:39 +0200 Subject: [PATCH 13/15] [ACS-5601] Fix unit test, add contrast gray to badges --- .../name-column/name-column.component.scss | 4 ++++ .../name-column/name-column.component.spec.ts | 10 ++++++++-- projects/aca-content/src/lib/ui/theme.scss | 18 ++++++++---------- .../src/lib/ui/variables/variables.scss | 4 +++- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss index 42e3e823c7..6bc28dfef6 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.scss @@ -6,6 +6,10 @@ .aca-name-column-badges { display: flex; + + .adf-datatable-cell-badge { + color: var(--theme-contrast-gray); + } } .aca-name-column-container { diff --git a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts index 197725e7ce..fde887f474 100644 --- a/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts +++ b/projects/aca-content/src/lib/components/dl-custom-components/name-column/name-column.component.spec.ts @@ -32,7 +32,6 @@ import { AppExtensionService } from '@alfresco/aca-shared'; import { of } from 'rxjs'; import { ContentActionType } from '@alfresco/adf-extensions'; import { By } from '@angular/platform-browser'; -import { INITIAL_APP_STATE } from '../../../store/initial-state'; describe('CustomNameColumnComponent', () => { let fixture: ComponentFixture; @@ -49,7 +48,14 @@ describe('CustomNameColumnComponent', () => { { app: (state) => state }, { initialState: { - app: INITIAL_APP_STATE + app: { + selection: { + nodes: [], + libraries: [], + isEmpty: true, + count: 0 + } + } } } ) diff --git a/projects/aca-content/src/lib/ui/theme.scss b/projects/aca-content/src/lib/ui/theme.scss index 8afd57585c..08d30fa30c 100644 --- a/projects/aca-content/src/lib/ui/theme.scss +++ b/projects/aca-content/src/lib/ui/theme.scss @@ -4,14 +4,12 @@ @import 'variables/variables'; @include custom-theme($custom-theme); -$contrast-gray: #646569; - .mat-toolbar { color: var(--theme-text-color, rgba(0, 0, 0, 0.54)); } .adf-name-location-cell-location.adf-datatable-cell-value { - color: $contrast-gray; + color: var(--theme-contrast-gray); } .mat-tab-list { @@ -29,14 +27,14 @@ $contrast-gray: #646569; .mat-checkbox-label, mat-toolbar.mat-toolbar.mat-toolbar-multiple-row, mat-toolbar.mat-toolbar.mat-toolbar-single-row { - color: $contrast-gray; + color: var(--theme-contrast-gray); opacity: 1; } .adf-upload-dialog { &__header, &__content { - color: $contrast-gray; + color: var(--theme-contrast-gray); } } @@ -44,7 +42,7 @@ mat-toolbar.mat-toolbar.mat-toolbar-single-row { .adf-version-list-item { &-comment, &-date { - color: $contrast-gray; + color: var(--theme-contrast-gray); opacity: 1; } } @@ -52,19 +50,19 @@ mat-toolbar.mat-toolbar.mat-toolbar-single-row { .mat-chip.mat-standard-chip { background-color: #efefef; - color: $contrast-gray; + color: var(--theme-contrast-gray); } .adf-property-field { .adf-textitem-edit-icon.mat-icon { - color: $contrast-gray; + color: var(--theme-contrast-gray); } } .adf-property-field.adf-card-textitem-field:hover .adf-property-clear-value { - color: $contrast-gray; + color: var(--theme-contrast-gray); } .adf-empty-content__icon { - color: $contrast-gray; + color: var(--theme-contrast-gray); } diff --git a/projects/aca-content/src/lib/ui/variables/variables.scss b/projects/aca-content/src/lib/ui/variables/variables.scss index c68a38a8fc..8a11c08041 100644 --- a/projects/aca-content/src/lib/ui/variables/variables.scss +++ b/projects/aca-content/src/lib/ui/variables/variables.scss @@ -35,6 +35,7 @@ $action-button-text-color: rgba(33, 35, 40, 0.7); $page-layout-header-background-color: #fff; $search-chip-icon-color: #757575; $disabled-chip-background-color: #f5f5f5; +$contrast-gray: #646569; // CSS Variables $defaults: ( @@ -74,7 +75,8 @@ $defaults: ( --theme-action-button-text-color: $action-button-text-color, --theme-page-layout-header-background-color: $page-layout-header-background-color, --theme-search-chip-icon-color: $search-chip-icon-color, - --theme-disabled-chip-background-color: $disabled-chip-background-color + --theme-disabled-chip-background-color: $disabled-chip-background-color, + --theme-contrast-gray: $contrast-gray ); // propagates SCSS variables into the CSS variables scope From 20d0b2f0b33a5f8b9f6935747660320135a0aff6 Mon Sep 17 00:00:00 2001 From: "akash.rathod@hyland.com" Date: Tue, 3 Oct 2023 13:52:39 +0200 Subject: [PATCH 14/15] fix fail test and exclude one test --- e2e/playwright/viewer/exclude.tests.json | 4 +++- e2e/playwright/viewer/src/tests/viewer-action.spec.ts | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/e2e/playwright/viewer/exclude.tests.json b/e2e/playwright/viewer/exclude.tests.json index 0967ef424b..14b8e54beb 100644 --- a/e2e/playwright/viewer/exclude.tests.json +++ b/e2e/playwright/viewer/exclude.tests.json @@ -1 +1,3 @@ -{} +{ + "C286379": "https://alfresco.atlassian.net/browse/ACS-5601" +} diff --git a/e2e/playwright/viewer/src/tests/viewer-action.spec.ts b/e2e/playwright/viewer/src/tests/viewer-action.spec.ts index 5a778a24ab..7f45bb51b5 100644 --- a/e2e/playwright/viewer/src/tests/viewer-action.spec.ts +++ b/e2e/playwright/viewer/src/tests/viewer-action.spec.ts @@ -102,7 +102,6 @@ test.describe('viewer action file', () => { const download = await downloadPromise; expect(download.suggestedFilename(), 'File should found in download location').toBe(fileForEditOffline); expect(await personalFiles.viewer.isViewerOpened(), 'Viewer is closed after pressing Full screen').toBe(true); - await personalFiles.reload({ waitUntil: 'domcontentloaded' }); await personalFiles.acaHeader.clickViewerMoreActions(); expect(await personalFiles.matMenu.isMenuItemVisible('Cancel Editing'), 'Cancel Editing menu should be visible').toBe(true); }); @@ -112,7 +111,6 @@ test.describe('viewer action file', () => { await personalFiles.viewer.waitForViewerToOpen(); await personalFiles.acaHeader.clickViewerMoreActions(); await personalFiles.matMenu.clickMenuItem('Cancel Editing'); - await personalFiles.reload({ waitUntil: 'domcontentloaded' }); await personalFiles.acaHeader.clickViewerMoreActions(); expect(await personalFiles.matMenu.isMenuItemVisible('Edit Offline'), 'Edit offline menu should be visible').toBe(true); }); From 2c41392407f8b71f05d5f30bb32df559f6c175e0 Mon Sep 17 00:00:00 2001 From: "akash.rathod@hyland.com" Date: Tue, 3 Oct 2023 21:40:01 +0200 Subject: [PATCH 15/15] fix fail test and exclude one test --- .../navigation/src/tests/single-click.spec.ts | 18 ++++++------------ .../dataTable/data-table.component.ts | 2 +- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/e2e/playwright/navigation/src/tests/single-click.spec.ts b/e2e/playwright/navigation/src/tests/single-click.spec.ts index 6d48acc27c..9fc476a56c 100644 --- a/e2e/playwright/navigation/src/tests/single-click.spec.ts +++ b/e2e/playwright/navigation/src/tests/single-click.spec.ts @@ -56,7 +56,7 @@ test.describe('Single click on item name', () => { }); test.afterAll(async ({ nodesApiAction }) => { - await nodesApiAction.deleteNodes([deletedFolder1Id, deletedFile1Id], true); + await nodesApiAction.deleteNodes([deletedFolder1Id, deletedFile1Id, folder1Id, folderSearchId], true); }); test('[C284899] Hyperlink does not appear for items in the Trash', async ({ trashPage }) => { @@ -65,17 +65,11 @@ test.describe('Single click on item name', () => { expect(await trashPage.dataTable.getCellLinkByName(deletedFolder1).isVisible(), 'Link on name is present').toBe(false); }); - test.describe('on Personal Files', () => { - test.afterAll(async ({ nodesApiAction }) => { - await nodesApiAction.deleteNodes([folder1Id, folderSearchId], true); - }); - - test('[C280034] Navigate inside the folder when clicking the hyperlink on Personal Files', async ({ personalFiles }) => { - await personalFiles.navigate(); - await personalFiles.dataTable.getCellLinkByName(folder1).click(); - await personalFiles.dataTable.spinnerWaitForReload(); - expect(await personalFiles.breadcrumb.currentItem.innerText()).toBe(folder1); - }); + test('[C280034] Navigate inside the folder when clicking the hyperlink on Personal Files', async ({ personalFiles }) => { + await personalFiles.navigate(); + await personalFiles.dataTable.getCellLinkByName(folder1).click(); + await personalFiles.dataTable.spinnerWaitForReload(); + expect(await personalFiles.breadcrumb.currentItem.innerText()).toBe(folder1); }); test('[C284902] Navigate inside the library when clicking the hyperlink on File Libraries', async ({ myLibrariesPage }) => { diff --git a/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts b/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts index eb66e89699..e6e2292624 100644 --- a/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts +++ b/projects/aca-playwright-shared/src/page-objects/components/dataTable/data-table.component.ts @@ -65,7 +65,7 @@ export class DataTableComponent extends BaseComponent { * * @returns reference to cell element which contains link. */ - getCellLinkByName = (name: string): Locator => this.getChild('.adf-datatable-cell-value[role="link"]', { hasText: name }); + getCellLinkByName = (name: string): Locator => this.getChild('.adf-cell-value span', { hasText: name }); /** * Method used in cases where we want to localize the element by [aria-label]