Cleanup unused code (#3951)

* cleanup unused code

* cleanup unused code
This commit is contained in:
Denys Vuika
2024-07-17 14:31:48 -04:00
committed by GitHub
parent a441535549
commit 74384f09f8
5 changed files with 3 additions and 103 deletions

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
export interface ModalConfiguration {
focusedElementOnCloseSelector?: string;
}

View File

@@ -25,24 +25,6 @@
import { ContentActionRef } from '@alfresco/adf-extensions';
import { Route } from '@angular/router';
export interface SettingsGroupRef {
id: string;
name: string;
parameters: Array<SettingsParameterRef>;
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;
}

View File

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

View File

@@ -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<SettingsGroupRef> = [];
private _headerActions = new BehaviorSubject<Array<ContentActionRef>>([]);
private _toolbarActions = new BehaviorSubject<Array<ContentActionRef>>([]);
@@ -78,7 +77,6 @@ export class AppExtensionService implements RuleContext {
private _contextMenuActions = new BehaviorSubject<Array<ContentActionRef>>([]);
private _openWithActions = new BehaviorSubject<Array<ContentActionRef>>([]);
private _createActions = new BehaviorSubject<Array<ContentActionRef>>([]);
private _mainActions = new BehaviorSubject<ContentActionRef>(null);
private _sidebarActions = new BehaviorSubject<Array<ContentActionRef>>([]);
private _badges = new BehaviorSubject<Array<Badge>>([]);
private _filesDocumentListPreset = new BehaviorSubject<Array<DocumentListPresetRef>>([]);
@@ -151,8 +149,6 @@ export class AppExtensionService implements RuleContext {
return;
}
this.settingGroups = this.loader.getElements<SettingsGroupRef>(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<ContentActionRef>(config, 'features.create'));
this._mainActions.next(this.loader.getFeatures(config).mainAction);
this._badges.next(this.loader.getElements<Badge>(config, 'features.badges'));
this._filesDocumentListPreset.next(this.getDocumentListPreset(config, 'files'));
this._customMetadataPanels.next(this.loader.getElements<ContentActionRef>(config, 'features.customMetadataPanels'));
@@ -340,10 +335,6 @@ export class AppExtensionService implements RuleContext {
}
}
getNavigationGroups(): Array<NavBarGroupRef> {
return this.navbar;
}
getSidebarTabs(): Array<SidebarTabRef> {
return this.sidebarTabs.filter((action) => this.filterVisible(action));
}
@@ -377,17 +368,6 @@ export class AppExtensionService implements RuleContext {
);
}
getMainAction(): Observable<ContentActionRef> {
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<Array<Badge>> {
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<SettingsGroupRef> {
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));

View File

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