mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-19 17:14:45 +00:00
[ACA-4238] - added aspect list dialog on context menu action (#2008)
* [ACA-4238] - added aspect list dialog on context menu action * [ACA-4238] - lint fix * [ACA-4238] - fix e2e * [ACA-4238] - fix e2e #2 * [ACA-4238] - fix e2e #3 * [ACA-4238] - fix lint * [ACA-4238] - fix lint * [ACA-4238] - fix lint * [ACA-4238] - fix e2e * [ACA-4238] - fix e2e #2 * Fix E2E #1 * Fix E2E #2 * Improved condition for edit aspect option * [ADF-4238] - fix e2e #2 * [ADF-4238] - fix lint * [ADF-4238] - fix e2e #3 * [ADF-4238] - fix e2e #4 * [ADF-4238] - fix e2e #5 * [ADF-4238] - fix e2e #6 * [ADF-4238] - fix e2e - final * [ADF-4238] - removed console log * [ADF-4238] - fixed linting * [ADF-4238] - fixed last e2e failing
This commit is contained in:
parent
8ffdcc3594
commit
fc01c5c9a9
@ -42,6 +42,7 @@ const fileContextMenu = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileSharedFavLockedContextMenu = [
|
||||
@ -58,7 +59,17 @@ const fileSharedFavLockedContextMenu = [
|
||||
'Permissions'
|
||||
];
|
||||
const fileToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions'];
|
||||
const fileToolbarMore = ['Edit Offline', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
|
||||
const fileToolbarMore = [
|
||||
'Edit Offline',
|
||||
'Upload New Version',
|
||||
'Favorite',
|
||||
'Move',
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileDocxToolbarMore = [
|
||||
'Edit in Microsoft Office™',
|
||||
'Edit Offline',
|
||||
@ -68,6 +79,7 @@ const fileDocxToolbarMore = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileDocxContextMenu = [
|
||||
@ -82,6 +94,7 @@ const fileDocxContextMenu = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileSharedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
|
||||
@ -107,6 +120,7 @@ const fileDocxFavContextMenu = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileDocxFavToolbarMore = [
|
||||
@ -118,6 +132,7 @@ const fileDocxFavToolbarMore = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileDocxSharedFavContextMenu = [
|
||||
@ -132,6 +147,7 @@ const fileDocxSharedFavContextMenu = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileDocxSharedContextMenu = [
|
||||
@ -146,6 +162,7 @@ const fileDocxSharedContextMenu = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileFavContextMenu = [
|
||||
@ -159,9 +176,20 @@ const fileFavContextMenu = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileFavToolbarMore = [
|
||||
'Edit Offline',
|
||||
'Upload New Version',
|
||||
'Remove Favorite',
|
||||
'Move',
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileFavToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
|
||||
const fileSharedFavContextMenu = [
|
||||
'Shared Link Settings',
|
||||
'Download',
|
||||
@ -173,6 +201,7 @@ const fileSharedFavContextMenu = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileSharedContextMenu = [
|
||||
@ -186,6 +215,7 @@ const fileSharedContextMenu = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const fileFavLockedContextMenu = [
|
||||
@ -233,8 +263,28 @@ const fileSharedLockedContextMenu = [
|
||||
|
||||
const viewerSharedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions'];
|
||||
const viewerToolbarPrimary = ['Activate full-screen mode', 'Share', 'Download', 'Print', 'View Details', 'More Actions'];
|
||||
const viewerToolbarMore = ['Edit Offline', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
|
||||
const viewerFavToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
|
||||
const viewerToolbarMore = [
|
||||
'Edit Offline',
|
||||
'Upload New Version',
|
||||
'Favorite',
|
||||
'Move',
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const viewerFavToolbarMore = [
|
||||
'Edit Offline',
|
||||
'Upload New Version',
|
||||
'Remove Favorite',
|
||||
'Move',
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const viewerDocxToolbarMore = [
|
||||
'Edit in Microsoft Office™',
|
||||
'Edit Offline',
|
||||
@ -244,6 +294,7 @@ const viewerDocxToolbarMore = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const viewerFavLockedToolbarMore = [
|
||||
@ -265,10 +316,10 @@ const viewerDocxFavToolbarMore = [
|
||||
'Copy',
|
||||
'Delete',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const viewerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
|
||||
|
||||
// ---- FAVORITES workarounds ----
|
||||
|
||||
// TODO: investigate why 'Edit Offline', 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue
|
||||
@ -328,6 +379,7 @@ const searchDocxContextMenu = [
|
||||
'Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchToolbarPrimary = ['Toggle search filter', 'Share', 'Download', 'View', 'View Details', 'More Actions'];
|
||||
@ -351,6 +403,7 @@ const searchDocxToolbarMore = [
|
||||
'Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchFavContextMenu = [
|
||||
@ -362,6 +415,7 @@ const searchFavContextMenu = [
|
||||
'Remove Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchSharedLockedContextMenu = [
|
||||
@ -385,6 +439,7 @@ const searchDocxFavContextMenu = [
|
||||
'Remove Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchDocxFavToolbarMore = [
|
||||
@ -394,6 +449,7 @@ const searchDocxFavToolbarMore = [
|
||||
'Remove Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchSharedContextMenu = [
|
||||
@ -405,9 +461,10 @@ const searchSharedContextMenu = [
|
||||
'Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchToolbarMore = ['Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
|
||||
const searchToolbarMore = ['Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Edit Aspects', 'Permissions'];
|
||||
const searchDocxSharedFavContextMenu = [
|
||||
'Shared Link Settings',
|
||||
'Download',
|
||||
@ -418,6 +475,7 @@ const searchDocxSharedFavContextMenu = [
|
||||
'Remove Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchDocxSharedContextMenu = [
|
||||
@ -430,10 +488,22 @@ const searchDocxSharedContextMenu = [
|
||||
'Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchFavToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Edit Aspects', 'Permissions'];
|
||||
const searchContextMenu = [
|
||||
'Share',
|
||||
'Download',
|
||||
'View',
|
||||
'Edit Offline',
|
||||
'Upload New Version',
|
||||
'Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchFavToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
|
||||
const searchContextMenu = ['Share', 'Download', 'View', 'Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
|
||||
const searchFavLockedContextMenu = [
|
||||
'Share',
|
||||
'Download',
|
||||
@ -466,11 +536,20 @@ const searchSharedFavContextMenu = [
|
||||
'Remove Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
|
||||
const searchViewerToolbarMore = ['Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
|
||||
const searchViewerFavToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
|
||||
const searchViewerToolbarMore = ['Edit Offline', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Edit Aspects', 'Permissions'];
|
||||
const searchViewerFavToolbarMore = [
|
||||
'Edit Offline',
|
||||
'Upload New Version',
|
||||
'Remove Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchViewerDocxToolbarMore = [
|
||||
'Edit in Microsoft Office™',
|
||||
'Edit Offline',
|
||||
@ -478,6 +557,7 @@ const searchViewerDocxToolbarMore = [
|
||||
'Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchViewerFavLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
|
||||
@ -488,6 +568,7 @@ const searchViewerDocxFavToolbarMore = [
|
||||
'Remove Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
const searchViewerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
|
||||
@ -727,20 +808,20 @@ export const folder2InTrash = {
|
||||
|
||||
// ---- folders ---
|
||||
|
||||
const folderContextMenu = ['Download', 'Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
|
||||
const folderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
|
||||
const folderContextMenu = ['Download', 'Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions'];
|
||||
const folderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions'];
|
||||
const folderToolbarPrimary = ['Download', 'View Details', 'More Actions'];
|
||||
const folderToolbarMore = ['Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
|
||||
const folderFavToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Permissions'];
|
||||
const folderToolbarMore = ['Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions'];
|
||||
const folderFavToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions'];
|
||||
|
||||
const favoritesFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
|
||||
const favoritesFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete'];
|
||||
|
||||
const searchFolderContextMenu = ['Download', 'Edit', 'Favorite', 'Copy', 'Permissions'];
|
||||
const searchFolderContextMenu = ['Download', 'Edit', 'Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
|
||||
const searchFolderToolbarPrimary = ['Toggle search filter', 'Download', 'View Details', 'More Actions'];
|
||||
const searchFolderToolbarMore = ['Edit', 'Favorite', 'Copy', 'Permissions'];
|
||||
const searchFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Copy', 'Permissions'];
|
||||
const searchFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Copy', 'Permissions'];
|
||||
const searchFolderToolbarMore = ['Edit', 'Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
|
||||
const searchFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
|
||||
const searchFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
|
||||
|
||||
export const folder = {
|
||||
name: `folderActions-${random}`,
|
||||
|
@ -48,7 +48,7 @@ export function collaboratorTests(siteName?: string) {
|
||||
await dataTable.waitForHeader();
|
||||
|
||||
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
|
||||
const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
|
||||
const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Edit Aspects', 'Permissions'];
|
||||
|
||||
await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
|
||||
});
|
||||
@ -57,7 +57,7 @@ export function collaboratorTests(siteName?: string) {
|
||||
await page.clickSharedFilesAndWait();
|
||||
|
||||
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
|
||||
const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
|
||||
const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Edit Aspects', 'Permissions'];
|
||||
|
||||
await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
|
||||
});
|
||||
@ -78,7 +78,7 @@ export function collaboratorTests(siteName?: string) {
|
||||
await searchInput.searchFor(testData.fileSharedFav.name);
|
||||
|
||||
const expectedToolbarPrimary = ['Toggle search filter', 'Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
|
||||
const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
|
||||
const expectedToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Edit Aspects', 'Permissions'];
|
||||
|
||||
await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
|
||||
});
|
||||
@ -97,6 +97,7 @@ export function collaboratorTests(siteName?: string) {
|
||||
'Remove Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
|
||||
@ -114,6 +115,7 @@ export function collaboratorTests(siteName?: string) {
|
||||
'Remove Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
|
||||
@ -131,6 +133,7 @@ export function collaboratorTests(siteName?: string) {
|
||||
'Remove Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
|
||||
@ -150,6 +153,7 @@ export function collaboratorTests(siteName?: string) {
|
||||
'Remove Favorite',
|
||||
'Copy',
|
||||
'Manage Versions',
|
||||
'Edit Aspects',
|
||||
'Permissions'
|
||||
];
|
||||
|
||||
|
@ -274,6 +274,14 @@ export function canUpdateSelectedNode(context: RuleContext): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isMultiselection(context: RuleContext): boolean {
|
||||
let isMultiNodeSelected = false;
|
||||
if (context.selection && !context.selection.isEmpty) {
|
||||
isMultiNodeSelected = context.selection.count > 1;
|
||||
}
|
||||
return isMultiNodeSelected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can update the first selected folder.
|
||||
* JSON ref: `app.selection.folder.canUpdate`
|
||||
@ -423,6 +431,15 @@ export function canManageFileVersions(context: RuleContext): boolean {
|
||||
return [hasFileSelected(context), navigation.isNotTrashcan(context), !hasLockedFiles(context)].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can edit aspects for the selected node.
|
||||
* JSON ref: `canEditAspects`
|
||||
* @param context Rule execution context
|
||||
*/
|
||||
export function canEditAspects(context: RuleContext): boolean {
|
||||
return [!isMultiselection(context), canUpdateSelectedNode(context), !isWriteLocked(context), navigation.isNotTrashcan(context)].every(Boolean);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if user can manage permissions for the selected node.
|
||||
* JSON ref: `canManagePermissions`
|
||||
|
@ -45,7 +45,8 @@ export enum NodeActionTypes {
|
||||
EditOffline = 'EDIT_OFFLINE',
|
||||
UnlockForWriting = 'UNLOCK_WRITE_LOCK',
|
||||
AddFavorite = 'ADD_FAVORITE',
|
||||
RemoveFavorite = 'REMOVE_FAVORITE'
|
||||
RemoveFavorite = 'REMOVE_FAVORITE',
|
||||
ChangeAspects = 'ASPECT_LIST'
|
||||
}
|
||||
|
||||
export class SetSelectedNodesAction implements Action {
|
||||
@ -161,3 +162,8 @@ export class RemoveFavoriteAction implements Action {
|
||||
|
||||
constructor(public payload: Array<MinimalNodeEntity>) {}
|
||||
}
|
||||
export class ManageAspectsAction implements Action {
|
||||
readonly type = NodeActionTypes.ChangeAspects;
|
||||
|
||||
constructor(public payload: MinimalNodeEntity) {}
|
||||
}
|
||||
|
@ -541,5 +541,13 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"aspect-visible": {
|
||||
"default" : ["cm:generalclassifiable", "cm:complianceable",
|
||||
"cm:dublincore", "cm:effectivity", "cm:summarizable",
|
||||
"cm:versionable", "cm:templatable","cm:emailed", "emailserver:aliasable",
|
||||
"cm:taggable", "app:inlineeditable", "cm:geographic", "exif:exif",
|
||||
"audio:audio", "cm:indexControl", "dp:restrictable", "smf:customConfigSmartFolder", "smf:systemConfigSmartFolder"],
|
||||
"ai": ["ai:products", "ai:dates", "ai:places", "ai:events", "ai:organizations", "ai:people", "ai:things", "ai:quantities", "ai:creativeWorks", "ai:labels", "ai:textLines"]
|
||||
}
|
||||
}
|
||||
|
@ -131,6 +131,7 @@ export class CoreExtensionsModule {
|
||||
canToggleEditOffline: rules.canToggleEditOffline,
|
||||
canToggleFavorite: rules.canToggleFavorite,
|
||||
isLibraryManager: rules.isLibraryManager,
|
||||
canEditAspects: rules.canEditAspects,
|
||||
|
||||
'app.selection.canDelete': rules.canDeleteSelection,
|
||||
'app.selection.file.canUnlock': rules.canUnlockFile,
|
||||
|
@ -54,6 +54,7 @@ import { TranslationService, AlfrescoApiService, FileModel } from '@alfresco/adf
|
||||
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
||||
import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
|
||||
import { NodeEntry, Node } from '@alfresco/js-api';
|
||||
import { NodeAspectService } from '@alfresco/adf-content-services';
|
||||
|
||||
describe('ContentManagementService', () => {
|
||||
let dialog: MatDialog;
|
||||
@ -65,6 +66,7 @@ describe('ContentManagementService', () => {
|
||||
let nodeActions: NodeActionsService;
|
||||
let translationService: TranslationService;
|
||||
let alfrescoApiService: AlfrescoApiService;
|
||||
let nodeAspectService: NodeAspectService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
@ -79,6 +81,7 @@ describe('ContentManagementService', () => {
|
||||
nodeActions = TestBed.inject(NodeActionsService);
|
||||
translationService = TestBed.inject(TranslationService);
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
nodeAspectService = TestBed.inject(NodeAspectService);
|
||||
|
||||
dialog = TestBed.inject(MatDialog);
|
||||
});
|
||||
@ -1534,4 +1537,38 @@ describe('ContentManagementService', () => {
|
||||
expect(alfrescoApiService.nodeUpdated.next).toHaveBeenCalledWith(newNode);
|
||||
}));
|
||||
});
|
||||
|
||||
describe('aspect list dialog', () => {
|
||||
it('should open dialog for managing the aspects for share or favorites nodes', () => {
|
||||
spyOn(nodeAspectService, 'updateNodeAspects').and.stub();
|
||||
|
||||
const fakeNode = { entry: { nodeId: 'fake-node-id' } };
|
||||
const responseNode: Node = {
|
||||
id: 'real-node-ghostbuster',
|
||||
name: 'name',
|
||||
nodeType: null,
|
||||
isFolder: false,
|
||||
isFile: true,
|
||||
modifiedAt: null,
|
||||
modifiedByUser: null,
|
||||
createdAt: null,
|
||||
createdByUser: null
|
||||
};
|
||||
|
||||
spyOn(contentApi, 'getNodeInfo').and.returnValue(of(responseNode));
|
||||
|
||||
contentManagementService.manageAspects(fakeNode);
|
||||
|
||||
expect(nodeAspectService.updateNodeAspects).toHaveBeenCalledWith('real-node-ghostbuster');
|
||||
});
|
||||
|
||||
it('should open dialog for managing the aspects', () => {
|
||||
spyOn(nodeAspectService, 'updateNodeAspects').and.stub();
|
||||
const fakeNode = { entry: { id: 'fake-node-id' } };
|
||||
|
||||
contentManagementService.manageAspects(fakeNode);
|
||||
|
||||
expect(nodeAspectService.updateNodeAspects).toHaveBeenCalledWith('fake-node-id');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -42,7 +42,13 @@ import {
|
||||
SnackbarWarningAction,
|
||||
UndoDeleteNodesAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { ConfirmDialogComponent, FolderDialogComponent, LibraryDialogComponent, ShareDialogComponent } from '@alfresco/adf-content-services';
|
||||
import {
|
||||
ConfirmDialogComponent,
|
||||
FolderDialogComponent,
|
||||
LibraryDialogComponent,
|
||||
ShareDialogComponent,
|
||||
NodeAspectService
|
||||
} from '@alfresco/adf-content-services';
|
||||
import { TranslationService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import {
|
||||
DeletedNodesPaging,
|
||||
@ -95,7 +101,8 @@ export class ContentManagementService {
|
||||
private dialogRef: MatDialog,
|
||||
private nodeActionsService: NodeActionsService,
|
||||
private translation: TranslationService,
|
||||
private snackBar: MatSnackBar
|
||||
private snackBar: MatSnackBar,
|
||||
private nodeAspectService: NodeAspectService
|
||||
) {}
|
||||
|
||||
addFavorite(nodes: Array<MinimalNodeEntity>) {
|
||||
@ -175,6 +182,30 @@ export class ContentManagementService {
|
||||
}
|
||||
}
|
||||
|
||||
manageAspects(node: any) {
|
||||
if (node && node.entry) {
|
||||
// shared and favorite
|
||||
const id = node.entry.nodeId || (node as any).entry.guid;
|
||||
|
||||
if (id) {
|
||||
this.contentApi.getNodeInfo(id).subscribe((entry) => {
|
||||
this.openAspectListDialog(entry);
|
||||
});
|
||||
} else {
|
||||
this.openAspectListDialog(node.entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private openAspectListDialog(node: any) {
|
||||
// workaround Shared
|
||||
if (node.isFile || node.id) {
|
||||
this.nodeAspectService.updateNodeAspects(node.id);
|
||||
} else {
|
||||
this.store.dispatch(new SnackbarErrorAction('APP.MESSAGES.ERRORS.PERMISSION'));
|
||||
}
|
||||
}
|
||||
|
||||
versionUpdateDialog(node, file) {
|
||||
return this.dialogRef.open(NodeVersionsDialogComponent, {
|
||||
data: { node, file, isTypeList: false },
|
||||
|
@ -46,7 +46,8 @@ import {
|
||||
UnlockWriteAction,
|
||||
FullscreenViewerAction,
|
||||
PrintFileAction,
|
||||
SetCurrentFolderAction
|
||||
SetCurrentFolderAction,
|
||||
ManageAspectsAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { ViewUtilService } from '@alfresco/adf-core';
|
||||
import { ViewerEffects } from './viewer.effects';
|
||||
@ -460,4 +461,28 @@ describe('NodeEffects', () => {
|
||||
expect(contentService.unlockNode).toHaveBeenCalledWith(node);
|
||||
}));
|
||||
});
|
||||
|
||||
describe('aspectList$', () => {
|
||||
it('should call aspect dialog', () => {
|
||||
const node: any = { entry: { isFile: true } };
|
||||
spyOn(contentService, 'manageAspects').and.stub();
|
||||
|
||||
store.dispatch(new ManageAspectsAction(node));
|
||||
|
||||
expect(contentService.manageAspects).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call aspect dialog from the active selection', fakeAsync(() => {
|
||||
spyOn(contentService, 'manageAspects').and.stub();
|
||||
|
||||
const node: any = { entry: { isFile: true } };
|
||||
store.dispatch(new SetSelectedNodesAction([node]));
|
||||
|
||||
tick(100);
|
||||
|
||||
store.dispatch(new ManageAspectsAction(null));
|
||||
|
||||
expect(contentService.manageAspects).toHaveBeenCalled();
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
@ -45,7 +45,8 @@ import {
|
||||
ManagePermissionsAction,
|
||||
PrintFileAction,
|
||||
getCurrentFolder,
|
||||
getAppSelection
|
||||
getAppSelection,
|
||||
ManageAspectsAction
|
||||
} from '@alfresco/aca-shared/store';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { ViewUtilService } from '@alfresco/adf-core';
|
||||
@ -316,6 +317,25 @@ export class NodeEffects {
|
||||
})
|
||||
);
|
||||
|
||||
@Effect({ dispatch: false })
|
||||
aspectList$ = this.actions$.pipe(
|
||||
ofType<ManageAspectsAction>(NodeActionTypes.ChangeAspects),
|
||||
map((action) => {
|
||||
if (action && action.payload) {
|
||||
this.contentService.manageAspects(action.payload);
|
||||
} else {
|
||||
this.store
|
||||
.select(getAppSelection)
|
||||
.pipe(take(1))
|
||||
.subscribe((selection) => {
|
||||
if (selection && selection.file) {
|
||||
this.contentService.manageAspects(selection.file);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
printFile(node: any) {
|
||||
if (node && node.entry) {
|
||||
// shared and favorite
|
||||
|
@ -527,6 +527,18 @@
|
||||
"visible": "canManageFileVersions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.aspects",
|
||||
"order": 1110,
|
||||
"title": "APP.ACTIONS.CHANGE_ASPECT",
|
||||
"icon": "toc",
|
||||
"actions": {
|
||||
"click": "ASPECT_LIST"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "canEditAspects"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.toolbar.permissions",
|
||||
"order": 1200,
|
||||
@ -732,6 +744,18 @@
|
||||
"visible": "canManageFileVersions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.aspects",
|
||||
"order": 1410,
|
||||
"title": "APP.ACTIONS.CHANGE_ASPECT",
|
||||
"icon": "toc",
|
||||
"actions": {
|
||||
"click": "ASPECT_LIST"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "canEditAspects"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.context.menu.permissions",
|
||||
"title": "APP.ACTIONS.PERMISSIONS",
|
||||
@ -992,6 +1016,18 @@
|
||||
"visible": "canManageFileVersions"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.aspects",
|
||||
"order": 910,
|
||||
"title": "APP.ACTIONS.CHANGE_ASPECT",
|
||||
"icon": "toc",
|
||||
"actions": {
|
||||
"click": "ASPECT_LIST"
|
||||
},
|
||||
"rules": {
|
||||
"visible": "canEditAspects"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "app.viewer.permissions",
|
||||
"order": 1000,
|
||||
|
@ -218,7 +218,8 @@
|
||||
"EDIT_OFFLINE": "Edit Offline",
|
||||
"EDIT_OFFLINE_CANCEL": "Cancel Editing",
|
||||
"LIST_MODE": "View list",
|
||||
"GALLERY_MODE": "View gallery"
|
||||
"GALLERY_MODE": "View gallery",
|
||||
"CHANGE_ASPECT": "Edit Aspects"
|
||||
},
|
||||
"DIALOGS": {
|
||||
"CONFIRM_PURGE": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user