From 74384f09f8d80b428298ce0c73866d055e1f87df Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 17 Jul 2024 14:31:48 -0400 Subject: [PATCH] Cleanup unused code (#3951) * cleanup unused code * cleanup unused code --- .../src/lib/models/modal-configuration.ts | 27 ----------------- projects/aca-shared/src/lib/models/types.ts | 18 ----------- .../services/app.extension.service.spec.ts | 30 ------------------- .../src/lib/services/app.extension.service.ts | 30 ++----------------- projects/aca-shared/src/public-api.ts | 1 - 5 files changed, 3 insertions(+), 103 deletions(-) delete mode 100644 projects/aca-shared/src/lib/models/modal-configuration.ts 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 00712298d..000000000 --- a/projects/aca-shared/src/lib/models/modal-configuration.ts +++ /dev/null @@ -1,27 +0,0 @@ -/*! - * Copyright © 2005-2024 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/models/types.ts b/projects/aca-shared/src/lib/models/types.ts index 20022b914..9ea7af378 100644 --- a/projects/aca-shared/src/lib/models/types.ts +++ b/projects/aca-shared/src/lib/models/types.ts @@ -25,24 +25,6 @@ import { ContentActionRef } from '@alfresco/adf-extensions'; import { Route } from '@angular/router'; -export interface SettingsGroupRef { - id: string; - name: string; - parameters: Array; - rules?: { - visible?: string; - [key: string]: string; - }; -} - -export interface SettingsParameterRef { - id?: string; - name: string; - key: string; - type: 'string' | 'boolean'; - value?: any; -} - export interface ExtensionRoute extends Route { parentRoute?: 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 0d2ca15f7..75ce669ed 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 @@ -1695,36 +1695,6 @@ describe('AppExtensionService', () => { }); }); - it('should resolve main action', (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: { - mainAction: { - id: 'action-id', - title: 'action-title', - type: 'button', - rules: { - visible: 'action.enabled' - } - } - } - }); - - service.getMainAction().subscribe((action) => { - expect(action.id).toEqual('action-id'); - done(); - }); - }); - it('should get badges from config', (done) => { extensions.setEvaluators({ 'action.enabled': () => true 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 4ee4809ef..24e2fcf8e 100644 --- a/projects/aca-shared/src/lib/services/app.extension.service.ts +++ b/projects/aca-shared/src/lib/services/app.extension.service.ts @@ -53,9 +53,9 @@ import { AppConfigService, AuthenticationService, LogService } from '@alfresco/a import { BehaviorSubject, Observable } from 'rxjs'; import { NodeEntry, RepositoryInfo } from '@alfresco/js-api'; import { ViewerRules } from '../models/viewer.rules'; -import { Badge, SettingsGroupRef } from '../models/types'; +import { Badge } from '../models/types'; import { NodePermissionService } from '../services/node-permission.service'; -import { filter, map } from 'rxjs/operators'; +import { map } from 'rxjs/operators'; import { SearchCategory } from '@alfresco/adf-content-services'; @Injectable({ @@ -69,7 +69,6 @@ export class AppExtensionService implements RuleContext { contentMetadata: any; search: any; viewerRules: ViewerRules = {}; - settingGroups: Array = []; private _headerActions = new BehaviorSubject>([]); private _toolbarActions = new BehaviorSubject>([]); @@ -78,7 +77,6 @@ export class AppExtensionService implements RuleContext { private _contextMenuActions = new BehaviorSubject>([]); private _openWithActions = new BehaviorSubject>([]); private _createActions = new BehaviorSubject>([]); - private _mainActions = new BehaviorSubject(null); private _sidebarActions = new BehaviorSubject>([]); private _badges = new BehaviorSubject>([]); private _filesDocumentListPreset = new BehaviorSubject>([]); @@ -151,8 +149,6 @@ export class AppExtensionService implements RuleContext { return; } - this.settingGroups = this.loader.getElements(config, 'settings'); - this._headerActions.next(this.loader.getContentActions(config, 'features.header')); this._sidebarActions.next(this.loader.getContentActions(config, 'features.sidebar.toolbar')); this._toolbarActions.next(this.loader.getContentActions(config, 'features.toolbar')); @@ -161,7 +157,6 @@ export class AppExtensionService implements RuleContext { this._contextMenuActions.next(this.loader.getContentActions(config, 'features.contextMenu')); 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._customMetadataPanels.next(this.loader.getElements(config, 'features.customMetadataPanels')); @@ -340,10 +335,6 @@ export class AppExtensionService implements RuleContext { } } - getNavigationGroups(): Array { - return this.navbar; - } - getSidebarTabs(): Array { return this.sidebarTabs.filter((action) => this.filterVisible(action)); } @@ -377,17 +368,6 @@ export class AppExtensionService implements RuleContext { ); } - getMainAction(): Observable { - return this._mainActions.pipe( - filter((mainAction) => mainAction && this.filterVisible(mainAction)), - map((mainAction) => { - let actionCopy = this.copyAction(mainAction); - actionCopy = this.setActionDisabledFromRule(actionCopy); - return actionCopy; - }) - ); - } - getBadges(node: NodeEntry): Observable> { return this._badges.pipe(map((badges) => badges.filter((badge) => this.evaluateRule(badge.rules.visible, node)))); } @@ -486,10 +466,6 @@ export class AppExtensionService implements RuleContext { return this._contextMenuActions.pipe(map((contextMenuActions) => (!this.selection.isEmpty ? this.getAllowedActions(contextMenuActions) : []))); } - getSettingsGroups(): Array { - return this.settingGroups.filter((group) => this.filterVisible(group)); - } - copyAction(action: ContentActionRef): ContentActionRef { return { ...action, @@ -497,7 +473,7 @@ export class AppExtensionService implements RuleContext { }; } - filterVisible(action: ContentActionRef | SettingsGroupRef | SidebarTabRef | DocumentListPresetRef | SearchCategory): boolean { + filterVisible(action: ContentActionRef | SidebarTabRef | DocumentListPresetRef | SearchCategory): boolean { if (action?.rules?.visible) { if (Array.isArray(action.rules.visible)) { return action.rules.visible.every((rule) => this.extensions.evaluateRule(rule, this)); diff --git a/projects/aca-shared/src/public-api.ts b/projects/aca-shared/src/public-api.ts index 8549de94d..fd2e7196c 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'; export * from './lib/routing/plugin-enabled.guard';