mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[ACA-3379] Routing & skeleton for manage rules screen (#2575)
* [ACA-3379] Routing & skeleton for manage rules screen * Linting * Update routing so it's no longer lazy loaded * Reverted to using lazy-loaded routes * Remove action visibility from favourites, update e2e test data
This commit is contained in:
@@ -8,7 +8,8 @@
|
|||||||
"loginRoute": "login",
|
"loginRoute": "login",
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"aosPlugin": ${APP_CONFIG_PLUGIN_AOS},
|
"aosPlugin": ${APP_CONFIG_PLUGIN_AOS},
|
||||||
"contentService": ${APP_CONFIG_PLUGIN_CONTENT_SERVICE}
|
"contentService": ${APP_CONFIG_PLUGIN_CONTENT_SERVICE},
|
||||||
|
"folderRules": ${APP_CONFIG_PLUGIN_FOLDER_RULES}
|
||||||
},
|
},
|
||||||
"oauth2": {
|
"oauth2": {
|
||||||
"host": "${APP_CONFIG_OAUTH2_HOST}",
|
"host": "${APP_CONFIG_OAUTH2_HOST}",
|
||||||
|
@@ -548,6 +548,15 @@ export const APP_ROUTES: Routes = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'nodes/:nodeId',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
loadChildren: () => import('@alfresco/aca-folder-rules').then((m) => m.AcaFolderRulesModule)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '**',
|
path: '**',
|
||||||
component: GenericErrorComponent
|
component: GenericErrorComponent
|
||||||
|
@@ -74,7 +74,6 @@ import { forkJoin, Observable, of, zip } from 'rxjs';
|
|||||||
import { catchError, map, mergeMap, take, tap } from 'rxjs/operators';
|
import { catchError, map, mergeMap, take, tap } from 'rxjs/operators';
|
||||||
import { NodeActionsService } from './node-actions.service';
|
import { NodeActionsService } from './node-actions.service';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { EditRuleDialogSmartComponent } from '@alfresco/aca-folder-rules';
|
|
||||||
|
|
||||||
interface RestoredNode {
|
interface RestoredNode {
|
||||||
status: number;
|
status: number;
|
||||||
@@ -1079,13 +1078,4 @@ export class ContentManagementService {
|
|||||||
.onAction()
|
.onAction()
|
||||||
.subscribe(() => this.undoMoveNodes(moveResponse, initialParentId));
|
.subscribe(() => this.undoMoveNodes(moveResponse, initialParentId));
|
||||||
}
|
}
|
||||||
|
|
||||||
manageRules(node: any) {
|
|
||||||
if (node && node.entry) {
|
|
||||||
this.dialogRef.open(EditRuleDialogSmartComponent, {
|
|
||||||
minWidth: '70%',
|
|
||||||
panelClass: 'aca-edit-rule-dialog-container'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -428,14 +428,14 @@ export class NodeEffects {
|
|||||||
ofType<ManageRulesAction>(NodeActionTypes.ManageRules),
|
ofType<ManageRulesAction>(NodeActionTypes.ManageRules),
|
||||||
map((action) => {
|
map((action) => {
|
||||||
if (action && action.payload) {
|
if (action && action.payload) {
|
||||||
this.contentService.manageRules(action.payload);
|
this.store.dispatch(new NavigateRouteAction(['nodes', action.payload.entry.id, 'rules']));
|
||||||
} else {
|
} else {
|
||||||
this.store
|
this.store
|
||||||
.select(getAppSelection)
|
.select(getAppSelection)
|
||||||
.pipe(take(1))
|
.pipe(take(1))
|
||||||
.subscribe((selection) => {
|
.subscribe((selection) => {
|
||||||
if (selection && !selection.isEmpty) {
|
if (selection && !selection.isEmpty) {
|
||||||
this.contentService.manageRules(selection.nodes[0]);
|
this.store.dispatch(new NavigateRouteAction(['nodes', selection.first.entry.id, 'rules']));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -596,6 +596,18 @@
|
|||||||
"visible": "canManagePermissions"
|
"visible": "canManagePermissions"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "app.toolbar.rules",
|
||||||
|
"title": "ACA_FOLDER_RULES.ACTIONS.MANAGE_RULES",
|
||||||
|
"icon": "gavel",
|
||||||
|
"order": 1300,
|
||||||
|
"actions": {
|
||||||
|
"click": "MANAGE_RULES"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"visible": "rules.canManageFolderRules"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "app.toolbar.deleteLibrary",
|
"id": "app.toolbar.deleteLibrary",
|
||||||
"order": 100,
|
"order": 100,
|
||||||
@@ -813,6 +825,18 @@
|
|||||||
"visible": "canManagePermissions"
|
"visible": "canManagePermissions"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "app.context.menu.rules",
|
||||||
|
"title": "ACA_FOLDER_RULES.ACTIONS.MANAGE_RULES",
|
||||||
|
"icon": "gavel",
|
||||||
|
"order": 1600,
|
||||||
|
"actions": {
|
||||||
|
"click": "MANAGE_RULES"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"visible": "rules.canManageFolderRules"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "app.context.menu.joinLibrary",
|
"id": "app.context.menu.joinLibrary",
|
||||||
"type": "custom",
|
"type": "custom",
|
||||||
|
@@ -808,20 +808,20 @@ export const folder2InTrash = {
|
|||||||
|
|
||||||
// ---- folders ---
|
// ---- folders ---
|
||||||
|
|
||||||
const folderContextMenu = ['Download', 'Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions'];
|
const folderContextMenu = ['Download', 'Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions', 'Manage rules'];
|
||||||
const folderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions'];
|
const folderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions', 'Manage rules'];
|
||||||
const folderToolbarPrimary = ['Download', 'View Details', 'More Actions'];
|
const folderToolbarPrimary = ['Download', 'View Details', 'More Actions'];
|
||||||
const folderToolbarMore = ['Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions'];
|
const folderToolbarMore = ['Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions', 'Manage rules'];
|
||||||
const folderFavToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions'];
|
const folderFavToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions', 'Manage rules'];
|
||||||
|
|
||||||
const favoritesFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
|
const favoritesFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
|
||||||
const favoritesFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
|
const favoritesFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
|
||||||
|
|
||||||
const searchFolderContextMenu = ['Download', 'Edit', 'Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
|
const searchFolderContextMenu = ['Download', 'Edit', 'Favorite', 'Copy', 'Edit Aspects', 'Permissions', 'Manage rules'];
|
||||||
const searchFolderToolbarPrimary = ['Download', 'View Details', 'More Actions'];
|
const searchFolderToolbarPrimary = ['Download', 'View Details', 'More Actions'];
|
||||||
const searchFolderToolbarMore = ['Edit', 'Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
|
const searchFolderToolbarMore = ['Edit', 'Favorite', 'Copy', 'Edit Aspects', 'Permissions', 'Manage rules'];
|
||||||
const searchFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
|
const searchFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Copy', 'Edit Aspects', 'Permissions', 'Manage rules'];
|
||||||
const searchFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
|
const searchFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Copy', 'Edit Aspects', 'Permissions', 'Manage rules'];
|
||||||
|
|
||||||
export const folder = {
|
export const folder = {
|
||||||
name: `folderActions-${random}`,
|
name: `folderActions-${random}`,
|
||||||
|
@@ -1,10 +1,7 @@
|
|||||||
{
|
{
|
||||||
"ACA_FOLDER_RULES": {
|
"ACA_FOLDER_RULES": {
|
||||||
"MENU": {
|
"ACTIONS": {
|
||||||
"CREATE_RULES": "Create rules",
|
"MANAGE_RULES": "Manage rules"
|
||||||
"CREATE_RULES_DESC": "[tbd] Creates new rules",
|
|
||||||
"LINK_RULES": "Link to rules set",
|
|
||||||
"LINK_RULES_DESC": "[tbd] Link to existing rules"
|
|
||||||
},
|
},
|
||||||
"EDIT_RULE_DIALOG": {
|
"EDIT_RULE_DIALOG": {
|
||||||
"CANCEL": "Cancel",
|
"CANCEL": "Cancel",
|
||||||
|
@@ -28,22 +28,30 @@ import { ExtensionService, provideExtensionConfig } from '@alfresco/adf-extensio
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import * as rules from './folder-rules.rules';
|
import * as rules from './folder-rules.rules';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { RouterModule, Routes } from '@angular/router';
|
||||||
|
|
||||||
import { EditRuleDialogSmartComponent } from './rule-details/edit-rule-dialog.smart-component';
|
import { EditRuleDialogSmartComponent } from './rule-details/edit-rule-dialog.smart-component';
|
||||||
|
import { ManageRulesSmartComponent } from './manage-rules/manage-rules.smart-component';
|
||||||
import { RuleDetailsUiComponent } from './rule-details/rule-details.ui-component';
|
import { RuleDetailsUiComponent } from './rule-details/rule-details.ui-component';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: 'rules',
|
||||||
|
component: ManageRulesSmartComponent
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
providers: [provideExtensionConfig(['folder-rules.plugin.json'])],
|
providers: [provideExtensionConfig(['folder-rules.plugin.json'])],
|
||||||
imports: [CommonModule, CoreModule.forChild()],
|
imports: [CommonModule, RouterModule.forChild(routes), CoreModule.forChild()],
|
||||||
declarations: [EditRuleDialogSmartComponent, RuleDetailsUiComponent]
|
declarations: [EditRuleDialogSmartComponent, ManageRulesSmartComponent, RuleDetailsUiComponent]
|
||||||
})
|
})
|
||||||
export class AcaFolderRulesModule {
|
export class AcaFolderRulesModule {
|
||||||
constructor(translation: TranslationService, extensions: ExtensionService) {
|
constructor(translation: TranslationService, extensions: ExtensionService) {
|
||||||
translation.addTranslationFolder('aca-folder-rules', 'assets/aca-folder-rules');
|
translation.addTranslationFolder('aca-folder-rules', 'assets/aca-folder-rules');
|
||||||
|
|
||||||
extensions.setEvaluators({
|
extensions.setEvaluators({
|
||||||
'rules.canCreateFolderRule': rules.canCreateFolderRule,
|
'rules.canManageFolderRules': rules.canManageFolderRules
|
||||||
'rules.canLinkFolderRule': rules.canLinkFolderRule
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,11 +23,10 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { AcaRuleContext, hasFolderSelected, canEditFolder } from '@alfresco/aca-shared/rules';
|
import { AcaRuleContext, hasFolderSelected, canEditFolder, isNotFavorites } from '@alfresco/aca-shared/rules';
|
||||||
|
|
||||||
export const isFolderRulesEnabled = (context: AcaRuleContext) => context.appConfig.get<boolean>('plugins.folderRules', false);
|
export const isFolderRulesEnabled = (context: AcaRuleContext) => context.appConfig.get<boolean>('plugins.folderRules', false);
|
||||||
export const isFolderRulesAllowed = (context: AcaRuleContext) =>
|
export const isFolderRulesAllowed = (context: AcaRuleContext) =>
|
||||||
isFolderRulesEnabled(context) && canEditFolder(context) && hasFolderSelected(context);
|
isFolderRulesEnabled(context) && canEditFolder(context) && hasFolderSelected(context) && isNotFavorites(context);
|
||||||
|
|
||||||
export const canCreateFolderRule = (context: AcaRuleContext): boolean => isFolderRulesAllowed(context);
|
export const canManageFolderRules = (context: AcaRuleContext): boolean => isFolderRulesAllowed(context);
|
||||||
export const canLinkFolderRule = (context: AcaRuleContext): boolean => isFolderRulesAllowed(context);
|
|
||||||
|
@@ -0,0 +1,32 @@
|
|||||||
|
/*!
|
||||||
|
* @license
|
||||||
|
* Alfresco Example Content Application
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005 - 2020 Alfresco Software Limited
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'aca-manage-rules',
|
||||||
|
template: `<div>This is the Manage Rules component</div>`
|
||||||
|
})
|
||||||
|
export class ManageRulesSmartComponent {}
|
@@ -24,4 +24,4 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export * from './lib/folder-rules.module';
|
export * from './lib/folder-rules.module';
|
||||||
export { EditRuleDialogSmartComponent } from './lib/rule-details/edit-rule-dialog.smart-component';
|
export { ManageRulesSmartComponent } from './lib/manage-rules/manage-rules.smart-component';
|
||||||
|
Reference in New Issue
Block a user