mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
[ACA-3427] Remove About tab when it's not useful (#1491)
* [ACA-3427] Remove About tab when it's not useful * Add unit tests for isLibraryManager rule * Fix e2e tests * Fix e2e tests and add rule to docs * Fix e2e tests
This commit is contained in:
parent
e2b6ebab9b
commit
85f71f5ae1
@ -168,6 +168,7 @@ The button will be visible only when the linked rule evaluates to `true`.
|
|||||||
| 1.8.0 | user.isAdmin | Checks if user is admin. |
|
| 1.8.0 | user.isAdmin | Checks if user is admin. |
|
||||||
| 1.9.0 | app.canShowLanguagePicker | Whether language picker menu should be present or not. |
|
| 1.9.0 | app.canShowLanguagePicker | Whether language picker menu should be present or not. |
|
||||||
| 1.9.0 | app.canShowLogout | Whether logout action should be present or not. |
|
| 1.9.0 | app.canShowLogout | Whether logout action should be present or not. |
|
||||||
|
| 1.12.0 | app.isLibraryManager | Checks if user is library manager. |
|
||||||
|
|
||||||
## Navigation Evaluators
|
## Navigation Evaluators
|
||||||
|
|
||||||
|
@ -38,12 +38,12 @@ const memberToolbarPrimary = ['Leave Library', 'View Details', 'More Actions'];
|
|||||||
const favToolbarMore = ['Delete', 'Remove Favorite'];
|
const favToolbarMore = ['Delete', 'Remove Favorite'];
|
||||||
const notFavToolbarMore = ['Delete', 'Favorite'];
|
const notFavToolbarMore = ['Delete', 'Favorite'];
|
||||||
const searchMemberToolbarPrimary = ['Toggle search filter', 'Leave Library', 'View Details', 'More Actions'];
|
const searchMemberToolbarPrimary = ['Toggle search filter', 'Leave Library', 'View Details', 'More Actions'];
|
||||||
const searchReqJoinToolbarPrimary = ['Toggle search filter', 'Cancel Join Request', 'View Details', 'More Actions'];
|
const searchReqJoinToolbarPrimary = ['Toggle search filter', 'Cancel Join Request', 'More Actions'];
|
||||||
const searchNotMemberToolbarPrimary = ['Toggle search filter', 'Join', 'View Details', 'More Actions'];
|
const searchNotMemberToolbarPrimary = ['Toggle search filter', 'Join', 'More Actions'];
|
||||||
const reqJoinToolbarMore = ['Cancel Join Request', 'View Details', 'More Actions'];
|
const reqJoinToolbarMore = ['Cancel Join Request', 'More Actions'];
|
||||||
const notMemberFavContextMenu = ['Join', 'Delete', 'Remove Favorite'];
|
const notMemberFavContextMenu = ['Join', 'Delete', 'Remove Favorite'];
|
||||||
const notMemberNotFavContextMenu = ['Join', 'Delete', 'Favorite'];
|
const notMemberNotFavContextMenu = ['Join', 'Delete', 'Favorite'];
|
||||||
const notMemberToolbarPrimary = ['Join', 'View Details', 'More Actions'];
|
const notMemberToolbarPrimary = ['Join', 'More Actions'];
|
||||||
const reqJoinNotFavContextMenu = ['Cancel Join Request', 'Delete', 'Favorite'];
|
const reqJoinNotFavContextMenu = ['Cancel Join Request', 'Delete', 'Favorite'];
|
||||||
const reqJoinFavContextMenu = ['Cancel Join Request', 'Delete', 'Remove Favorite'];
|
const reqJoinFavContextMenu = ['Cancel Join Request', 'Delete', 'Remove Favorite'];
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ describe('Library properties', () => {
|
|||||||
await infoDrawer.waitForInfoDrawerToOpen();
|
await infoDrawer.waitForInfoDrawerToOpen();
|
||||||
|
|
||||||
expect(await infoDrawer.getHeaderTitle()).toEqual('Details');
|
expect(await infoDrawer.getHeaderTitle()).toEqual('Details');
|
||||||
expect(await infoDrawer.isAboutTabDisplayed()).toBe(true, 'About tab is not displayed');
|
expect(await infoDrawer.isPropertiesTabDisplayed()).toBe(true, 'Properties tab is not displayed');
|
||||||
expect(await aboutTab.isNameDisplayed()).toBe(true, 'Name field not displayed');
|
expect(await aboutTab.isNameDisplayed()).toBe(true, 'Name field not displayed');
|
||||||
expect(await aboutTab.isLibraryIdDisplayed()).toBe(true, 'Library ID field not displayed');
|
expect(await aboutTab.isLibraryIdDisplayed()).toBe(true, 'Library ID field not displayed');
|
||||||
expect(await aboutTab.isVisibilityDisplayed()).toBe(true, 'Visibility field not displayed');
|
expect(await aboutTab.isVisibilityDisplayed()).toBe(true, 'Visibility field not displayed');
|
||||||
@ -236,14 +236,11 @@ describe('Library properties', () => {
|
|||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C289337] Edit button is not displayed when user is not the library manager', async () => {
|
it('[C289337] Info drawer button is not displayed when user is not the library manager', async () => {
|
||||||
await loginPage.loginWith(user2);
|
await loginPage.loginWith(user2);
|
||||||
|
|
||||||
await page.clickFileLibrariesAndWait();
|
await page.clickFileLibrariesAndWait();
|
||||||
await dataTable.selectItem(site.name);
|
await dataTable.selectItem(site.name);
|
||||||
await page.toolbar.viewDetailsButton.click();
|
expect(await page.toolbar.isButtonPresent('View Details')).toBe(false, 'View Details is present');
|
||||||
await infoDrawer.waitForInfoDrawerToOpen();
|
|
||||||
expect(await aboutTab.isEditLibraryPropertiesDisplayed()).toBe(false, 'Edit action is displayed');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('[C289344] Error notification', async () => {
|
it('[C289344] Error notification', async () => {
|
||||||
|
@ -475,4 +475,34 @@ describe('app.evaluators', () => {
|
|||||||
expect(app.canShowLogout(context)).toBe(true);
|
expect(app.canShowLogout(context)).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('isLibraryManager', () => {
|
||||||
|
it('should return true when role is SiteManager', () => {
|
||||||
|
const context: any = {
|
||||||
|
selection: {
|
||||||
|
library: {
|
||||||
|
entry: {
|
||||||
|
role: 'SiteManager'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(app.isLibraryManager(context)).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false when role is different than SiteManager', () => {
|
||||||
|
const context: any = {
|
||||||
|
selection: {
|
||||||
|
library: {
|
||||||
|
entry: {
|
||||||
|
role: 'SiteCollaborator'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(app.isLibraryManager(context)).toBe(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -546,3 +546,16 @@ export function canShowLanguagePicker(context: AcaRuleContext): boolean {
|
|||||||
export function canShowLogout(context: AcaRuleContext): boolean {
|
export function canShowLogout(context: AcaRuleContext): boolean {
|
||||||
return !context.withCredentials;
|
return !context.withCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if user is library manager
|
||||||
|
* JSON ref: `isLibraryManager`
|
||||||
|
* @param context Rule execution context
|
||||||
|
*/
|
||||||
|
export function isLibraryManager(context: RuleContext): boolean {
|
||||||
|
return (
|
||||||
|
hasLibrarySelected(context) &&
|
||||||
|
context.selection.library.entry &&
|
||||||
|
context.selection.library.entry.role === 'SiteManager'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@ -131,6 +131,7 @@ export class CoreExtensionsModule {
|
|||||||
canManagePermissions: rules.canManagePermissions,
|
canManagePermissions: rules.canManagePermissions,
|
||||||
canToggleEditOffline: rules.canToggleEditOffline,
|
canToggleEditOffline: rules.canToggleEditOffline,
|
||||||
canToggleFavorite: rules.canToggleFavorite,
|
canToggleFavorite: rules.canToggleFavorite,
|
||||||
|
isLibraryManager: rules.isLibraryManager,
|
||||||
|
|
||||||
'app.selection.canDelete': rules.canDeleteSelection,
|
'app.selection.canDelete': rules.canDeleteSelection,
|
||||||
'app.selection.file.canUnlock': rules.canUnlockFile,
|
'app.selection.file.canUnlock': rules.canUnlockFile,
|
||||||
|
@ -46,6 +46,14 @@
|
|||||||
{ "type": "rule", "value": "app.navigation.isNotSearchResults" },
|
{ "type": "rule", "value": "app.navigation.isNotSearchResults" },
|
||||||
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
|
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "app.toolbar.favorite.canEditMetadata",
|
||||||
|
"type": "core.every",
|
||||||
|
"parameters": [
|
||||||
|
{ "type": "rule", "value": "app.selection.library" },
|
||||||
|
{ "type": "rule", "value": "isLibraryManager" }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -345,7 +353,7 @@
|
|||||||
"order": 800,
|
"order": 800,
|
||||||
"component": "app.toolbar.toggleInfoDrawer",
|
"component": "app.toolbar.toggleInfoDrawer",
|
||||||
"rules": {
|
"rules": {
|
||||||
"visible": "app.selection.library"
|
"visible": "app.toolbar.favorite.canEditMetadata"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1040,10 +1048,10 @@
|
|||||||
{
|
{
|
||||||
"id": "app.sidebar.library.properties",
|
"id": "app.sidebar.library.properties",
|
||||||
"order": 500,
|
"order": 500,
|
||||||
"title": "APP.INFO_DRAWER.TABS.LIBRARY_PROPERTIES",
|
"title": "APP.INFO_DRAWER.TABS.PROPERTIES",
|
||||||
"component": "app.components.tabs.library.metadata",
|
"component": "app.components.tabs.library.metadata",
|
||||||
"rules": {
|
"rules": {
|
||||||
"visible": "app.selection.library"
|
"visible": "app.toolbar.favorite.canEditMetadata"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user