[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:
Vito 2021-02-26 13:48:04 +00:00 committed by GitHub
parent 8ffdcc3594
commit fc01c5c9a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 294 additions and 27 deletions

View File

@ -42,6 +42,7 @@ const fileContextMenu = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const fileSharedFavLockedContextMenu = [ const fileSharedFavLockedContextMenu = [
@ -58,7 +59,17 @@ const fileSharedFavLockedContextMenu = [
'Permissions' 'Permissions'
]; ];
const fileToolbarPrimary = ['Share', 'Download', 'View', 'View Details', 'More Actions']; 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 = [ const fileDocxToolbarMore = [
'Edit in Microsoft Office™', 'Edit in Microsoft Office™',
'Edit Offline', 'Edit Offline',
@ -68,6 +79,7 @@ const fileDocxToolbarMore = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const fileDocxContextMenu = [ const fileDocxContextMenu = [
@ -82,6 +94,7 @@ const fileDocxContextMenu = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const fileSharedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; const fileSharedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions'];
@ -107,6 +120,7 @@ const fileDocxFavContextMenu = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const fileDocxFavToolbarMore = [ const fileDocxFavToolbarMore = [
@ -118,6 +132,7 @@ const fileDocxFavToolbarMore = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const fileDocxSharedFavContextMenu = [ const fileDocxSharedFavContextMenu = [
@ -132,6 +147,7 @@ const fileDocxSharedFavContextMenu = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const fileDocxSharedContextMenu = [ const fileDocxSharedContextMenu = [
@ -146,6 +162,7 @@ const fileDocxSharedContextMenu = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const fileFavContextMenu = [ const fileFavContextMenu = [
@ -159,9 +176,20 @@ const fileFavContextMenu = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions'
];
const fileFavToolbarMore = [
'Edit Offline',
'Upload New Version',
'Remove Favorite',
'Move',
'Copy',
'Delete',
'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const fileFavToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
const fileSharedFavContextMenu = [ const fileSharedFavContextMenu = [
'Shared Link Settings', 'Shared Link Settings',
'Download', 'Download',
@ -173,6 +201,7 @@ const fileSharedFavContextMenu = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const fileSharedContextMenu = [ const fileSharedContextMenu = [
@ -186,6 +215,7 @@ const fileSharedContextMenu = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const fileFavLockedContextMenu = [ const fileFavLockedContextMenu = [
@ -233,8 +263,28 @@ const fileSharedLockedContextMenu = [
const viewerSharedToolbarPrimary = ['Activate full-screen mode', 'Shared Link Settings', 'Download', 'Print', 'View Details', 'More Actions']; 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 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 viewerToolbarMore = [
const viewerFavToolbarMore = ['Edit Offline', 'Upload New Version', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; '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 = [ const viewerDocxToolbarMore = [
'Edit in Microsoft Office™', 'Edit in Microsoft Office™',
'Edit Offline', 'Edit Offline',
@ -244,6 +294,7 @@ const viewerDocxToolbarMore = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const viewerFavLockedToolbarMore = [ const viewerFavLockedToolbarMore = [
@ -265,10 +316,10 @@ const viewerDocxFavToolbarMore = [
'Copy', 'Copy',
'Delete', 'Delete',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const viewerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions']; const viewerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Move', 'Copy', 'Delete', 'Manage Versions', 'Permissions'];
// ---- FAVORITES workarounds ---- // ---- FAVORITES workarounds ----
// TODO: investigate why 'Edit Offline', 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue // TODO: investigate why 'Edit Offline', 'Edit in Microsoft Office™' and 'Permissions' are not displayed and raise issue
@ -328,6 +379,7 @@ const searchDocxContextMenu = [
'Favorite', 'Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const searchToolbarPrimary = ['Toggle search filter', 'Share', 'Download', 'View', 'View Details', 'More Actions']; const searchToolbarPrimary = ['Toggle search filter', 'Share', 'Download', 'View', 'View Details', 'More Actions'];
@ -351,6 +403,7 @@ const searchDocxToolbarMore = [
'Favorite', 'Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const searchFavContextMenu = [ const searchFavContextMenu = [
@ -362,6 +415,7 @@ const searchFavContextMenu = [
'Remove Favorite', 'Remove Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const searchSharedLockedContextMenu = [ const searchSharedLockedContextMenu = [
@ -385,6 +439,7 @@ const searchDocxFavContextMenu = [
'Remove Favorite', 'Remove Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const searchDocxFavToolbarMore = [ const searchDocxFavToolbarMore = [
@ -394,6 +449,7 @@ const searchDocxFavToolbarMore = [
'Remove Favorite', 'Remove Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const searchSharedContextMenu = [ const searchSharedContextMenu = [
@ -405,9 +461,10 @@ const searchSharedContextMenu = [
'Favorite', 'Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' '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 = [ const searchDocxSharedFavContextMenu = [
'Shared Link Settings', 'Shared Link Settings',
'Download', 'Download',
@ -418,6 +475,7 @@ const searchDocxSharedFavContextMenu = [
'Remove Favorite', 'Remove Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const searchDocxSharedContextMenu = [ const searchDocxSharedContextMenu = [
@ -430,10 +488,22 @@ const searchDocxSharedContextMenu = [
'Favorite', 'Favorite',
'Copy', 'Copy',
'Manage Versions', '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' '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 = [ const searchFavLockedContextMenu = [
'Share', 'Share',
'Download', 'Download',
@ -466,11 +536,20 @@ const searchSharedFavContextMenu = [
'Remove Favorite', 'Remove Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const searchViewerToolbarMore = ['Edit Offline', 'Upload New Version', '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', 'Permissions']; const searchViewerFavToolbarMore = [
'Edit Offline',
'Upload New Version',
'Remove Favorite',
'Copy',
'Manage Versions',
'Edit Aspects',
'Permissions'
];
const searchViewerDocxToolbarMore = [ const searchViewerDocxToolbarMore = [
'Edit in Microsoft Office™', 'Edit in Microsoft Office™',
'Edit Offline', 'Edit Offline',
@ -478,6 +557,7 @@ const searchViewerDocxToolbarMore = [
'Favorite', 'Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const searchViewerFavLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions']; const searchViewerFavLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Remove Favorite', 'Copy', 'Manage Versions', 'Permissions'];
@ -488,6 +568,7 @@ const searchViewerDocxFavToolbarMore = [
'Remove Favorite', 'Remove Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
const searchViewerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions']; const searchViewerLockedToolbarMore = ['Cancel Editing', 'Upload New Version', 'Favorite', 'Copy', 'Manage Versions', 'Permissions'];
@ -727,20 +808,20 @@ export const folder2InTrash = {
// ---- folders --- // ---- folders ---
const folderContextMenu = ['Download', 'Edit', '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', 'Permissions']; const folderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions'];
const folderToolbarPrimary = ['Download', 'View Details', 'More Actions']; const folderToolbarPrimary = ['Download', 'View Details', 'More Actions'];
const folderToolbarMore = ['Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Permissions']; const folderToolbarMore = ['Edit', 'Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions'];
const folderFavToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Permissions']; const folderFavToolbarMore = ['Edit', 'Remove Favorite', 'Move', 'Copy', 'Delete', 'Edit Aspects', 'Permissions'];
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', 'Permissions']; const searchFolderContextMenu = ['Download', 'Edit', 'Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
const searchFolderToolbarPrimary = ['Toggle search filter', 'Download', 'View Details', 'More Actions']; const searchFolderToolbarPrimary = ['Toggle search filter', 'Download', 'View Details', 'More Actions'];
const searchFolderToolbarMore = ['Edit', 'Favorite', 'Copy', 'Permissions']; const searchFolderToolbarMore = ['Edit', 'Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
const searchFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Copy', 'Permissions']; const searchFolderFavContextMenu = ['Download', 'Edit', 'Remove Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
const searchFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Copy', 'Permissions']; const searchFolderFavToolbarMore = ['Edit', 'Remove Favorite', 'Copy', 'Edit Aspects', 'Permissions'];
export const folder = { export const folder = {
name: `folderActions-${random}`, name: `folderActions-${random}`,

View File

@ -48,7 +48,7 @@ export function collaboratorTests(siteName?: string) {
await dataTable.waitForHeader(); await dataTable.waitForHeader();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; 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); await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
}); });
@ -57,7 +57,7 @@ export function collaboratorTests(siteName?: string) {
await page.clickSharedFilesAndWait(); await page.clickSharedFilesAndWait();
const expectedToolbarPrimary = ['Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; 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); await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
}); });
@ -78,7 +78,7 @@ export function collaboratorTests(siteName?: string) {
await searchInput.searchFor(testData.fileSharedFav.name); await searchInput.searchFor(testData.fileSharedFav.name);
const expectedToolbarPrimary = ['Toggle search filter', 'Shared Link Settings', 'Download', 'View', 'View Details', 'More Actions']; 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); await testUtil.checkToolbarActions(testData.fileSharedFav.name, expectedToolbarPrimary, expectedToolbarMore);
}); });
@ -97,6 +97,7 @@ export function collaboratorTests(siteName?: string) {
'Remove Favorite', 'Remove Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
@ -114,6 +115,7 @@ export function collaboratorTests(siteName?: string) {
'Remove Favorite', 'Remove Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
@ -131,6 +133,7 @@ export function collaboratorTests(siteName?: string) {
'Remove Favorite', 'Remove Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];
@ -150,6 +153,7 @@ export function collaboratorTests(siteName?: string) {
'Remove Favorite', 'Remove Favorite',
'Copy', 'Copy',
'Manage Versions', 'Manage Versions',
'Edit Aspects',
'Permissions' 'Permissions'
]; ];

View File

@ -274,6 +274,14 @@ export function canUpdateSelectedNode(context: RuleContext): boolean {
return false; 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. * Checks if user can update the first selected folder.
* JSON ref: `app.selection.folder.canUpdate` * 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); 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. * Checks if user can manage permissions for the selected node.
* JSON ref: `canManagePermissions` * JSON ref: `canManagePermissions`

View File

@ -45,7 +45,8 @@ export enum NodeActionTypes {
EditOffline = 'EDIT_OFFLINE', EditOffline = 'EDIT_OFFLINE',
UnlockForWriting = 'UNLOCK_WRITE_LOCK', UnlockForWriting = 'UNLOCK_WRITE_LOCK',
AddFavorite = 'ADD_FAVORITE', AddFavorite = 'ADD_FAVORITE',
RemoveFavorite = 'REMOVE_FAVORITE' RemoveFavorite = 'REMOVE_FAVORITE',
ChangeAspects = 'ASPECT_LIST'
} }
export class SetSelectedNodesAction implements Action { export class SetSelectedNodesAction implements Action {
@ -161,3 +162,8 @@ export class RemoveFavoriteAction implements Action {
constructor(public payload: Array<MinimalNodeEntity>) {} constructor(public payload: Array<MinimalNodeEntity>) {}
} }
export class ManageAspectsAction implements Action {
readonly type = NodeActionTypes.ChangeAspects;
constructor(public payload: MinimalNodeEntity) {}
}

View File

@ -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"]
} }
} }

View File

@ -131,6 +131,7 @@ export class CoreExtensionsModule {
canToggleEditOffline: rules.canToggleEditOffline, canToggleEditOffline: rules.canToggleEditOffline,
canToggleFavorite: rules.canToggleFavorite, canToggleFavorite: rules.canToggleFavorite,
isLibraryManager: rules.isLibraryManager, isLibraryManager: rules.isLibraryManager,
canEditAspects: rules.canEditAspects,
'app.selection.canDelete': rules.canDeleteSelection, 'app.selection.canDelete': rules.canDeleteSelection,
'app.selection.file.canUnlock': rules.canUnlockFile, 'app.selection.file.canUnlock': rules.canUnlockFile,

View File

@ -54,6 +54,7 @@ import { TranslationService, AlfrescoApiService, FileModel } from '@alfresco/adf
import { MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar, MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
import { NodeEntry, Node } from '@alfresco/js-api'; import { NodeEntry, Node } from '@alfresco/js-api';
import { NodeAspectService } from '@alfresco/adf-content-services';
describe('ContentManagementService', () => { describe('ContentManagementService', () => {
let dialog: MatDialog; let dialog: MatDialog;
@ -65,6 +66,7 @@ describe('ContentManagementService', () => {
let nodeActions: NodeActionsService; let nodeActions: NodeActionsService;
let translationService: TranslationService; let translationService: TranslationService;
let alfrescoApiService: AlfrescoApiService; let alfrescoApiService: AlfrescoApiService;
let nodeAspectService: NodeAspectService;
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
@ -79,6 +81,7 @@ describe('ContentManagementService', () => {
nodeActions = TestBed.inject(NodeActionsService); nodeActions = TestBed.inject(NodeActionsService);
translationService = TestBed.inject(TranslationService); translationService = TestBed.inject(TranslationService);
alfrescoApiService = TestBed.inject(AlfrescoApiService); alfrescoApiService = TestBed.inject(AlfrescoApiService);
nodeAspectService = TestBed.inject(NodeAspectService);
dialog = TestBed.inject(MatDialog); dialog = TestBed.inject(MatDialog);
}); });
@ -1534,4 +1537,38 @@ describe('ContentManagementService', () => {
expect(alfrescoApiService.nodeUpdated.next).toHaveBeenCalledWith(newNode); 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');
});
});
}); });

View File

@ -42,7 +42,13 @@ import {
SnackbarWarningAction, SnackbarWarningAction,
UndoDeleteNodesAction UndoDeleteNodesAction
} from '@alfresco/aca-shared/store'; } 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 { TranslationService, AlfrescoApiService } from '@alfresco/adf-core';
import { import {
DeletedNodesPaging, DeletedNodesPaging,
@ -95,7 +101,8 @@ export class ContentManagementService {
private dialogRef: MatDialog, private dialogRef: MatDialog,
private nodeActionsService: NodeActionsService, private nodeActionsService: NodeActionsService,
private translation: TranslationService, private translation: TranslationService,
private snackBar: MatSnackBar private snackBar: MatSnackBar,
private nodeAspectService: NodeAspectService
) {} ) {}
addFavorite(nodes: Array<MinimalNodeEntity>) { 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) { versionUpdateDialog(node, file) {
return this.dialogRef.open(NodeVersionsDialogComponent, { return this.dialogRef.open(NodeVersionsDialogComponent, {
data: { node, file, isTypeList: false }, data: { node, file, isTypeList: false },

View File

@ -46,7 +46,8 @@ import {
UnlockWriteAction, UnlockWriteAction,
FullscreenViewerAction, FullscreenViewerAction,
PrintFileAction, PrintFileAction,
SetCurrentFolderAction SetCurrentFolderAction,
ManageAspectsAction
} from '@alfresco/aca-shared/store'; } from '@alfresco/aca-shared/store';
import { ViewUtilService } from '@alfresco/adf-core'; import { ViewUtilService } from '@alfresco/adf-core';
import { ViewerEffects } from './viewer.effects'; import { ViewerEffects } from './viewer.effects';
@ -460,4 +461,28 @@ describe('NodeEffects', () => {
expect(contentService.unlockNode).toHaveBeenCalledWith(node); 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();
}));
});
}); });

View File

@ -45,7 +45,8 @@ import {
ManagePermissionsAction, ManagePermissionsAction,
PrintFileAction, PrintFileAction,
getCurrentFolder, getCurrentFolder,
getAppSelection getAppSelection,
ManageAspectsAction
} from '@alfresco/aca-shared/store'; } from '@alfresco/aca-shared/store';
import { ContentManagementService } from '../../services/content-management.service'; import { ContentManagementService } from '../../services/content-management.service';
import { ViewUtilService } from '@alfresco/adf-core'; 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) { printFile(node: any) {
if (node && node.entry) { if (node && node.entry) {
// shared and favorite // shared and favorite

View File

@ -527,6 +527,18 @@
"visible": "canManageFileVersions" "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", "id": "app.toolbar.permissions",
"order": 1200, "order": 1200,
@ -732,6 +744,18 @@
"visible": "canManageFileVersions" "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", "id": "app.context.menu.permissions",
"title": "APP.ACTIONS.PERMISSIONS", "title": "APP.ACTIONS.PERMISSIONS",
@ -992,6 +1016,18 @@
"visible": "canManageFileVersions" "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", "id": "app.viewer.permissions",
"order": 1000, "order": 1000,

View File

@ -218,7 +218,8 @@
"EDIT_OFFLINE": "Edit Offline", "EDIT_OFFLINE": "Edit Offline",
"EDIT_OFFLINE_CANCEL": "Cancel Editing", "EDIT_OFFLINE_CANCEL": "Cancel Editing",
"LIST_MODE": "View list", "LIST_MODE": "View list",
"GALLERY_MODE": "View gallery" "GALLERY_MODE": "View gallery",
"CHANGE_ASPECT": "Edit Aspects"
}, },
"DIALOGS": { "DIALOGS": {
"CONFIRM_PURGE": { "CONFIRM_PURGE": {