[ACA-2327] rule and evaluator optimisations (#1065)

* reduce imports

* canCopyNode rule

* simplify naming

* improve canShareFile rule

* canToggleJoinLibrary rule

* canEditFolder rule

* improve canUploadVersion rule

* isTrashcanItemSelected rule

* improve canDelete usage

* simplify canDownload usage

* canViewFile rule

* canLeaveLibrary rule

* rule usage improvements

* canToggleSharedLink rule

* canShowInfoDrawer rule

* canManageFileVersions rule

* canManagePermissions rule

* canToggleEditOffline rule

* canToggleFavorite rule

* minor polishing

* fix test

* fix evaluator

* code and test fixes

* fix evaluator
This commit is contained in:
Denys Vuika
2019-04-12 15:26:32 +01:00
committed by GitHub
parent c83f78f801
commit 2001bcd447
6 changed files with 327 additions and 374 deletions
@@ -109,6 +109,19 @@ export class CoreExtensionsModule {
});
extensions.setEvaluators({
canCopyNode: app.canCopyNode,
canToggleJoinLibrary: app.canToggleJoinLibrary,
canEditFolder: app.canEditFolder,
isTrashcanItemSelected: app.isTrashcanItemSelected,
canViewFile: app.canViewFile,
canLeaveLibrary: app.canLeaveLibrary,
canToggleSharedLink: app.canToggleSharedLink,
canShowInfoDrawer: app.canShowInfoDrawer,
canManageFileVersions: app.canManageFileVersions,
canManagePermissions: app.canManagePermissions,
canToggleEditOffline: app.canToggleEditOffline,
canToggleFavorite: app.canToggleFavorite,
'app.selection.canDelete': app.canDeleteSelection,
'app.selection.file.canUnlock': app.canUnlockFile,
'app.selection.file.canLock': app.canLockFile,
@@ -302,6 +302,7 @@ describe('app.evaluators', () => {
check: () => (checked = true)
},
selection: {
file: {},
isEmpty: false,
nodes: [
{
@@ -324,6 +325,9 @@ describe('app.evaluators', () => {
it('should return [true] if route is `/favorites`', () => {
const context: any = {
selection: {
file: {}
},
navigation: {
url: '/favorites'
}
@@ -334,6 +338,9 @@ describe('app.evaluators', () => {
it('should return [true] if route is `/favorites`', () => {
const context: any = {
selection: {
file: {}
},
navigation: {
url: '/favorites'
}
@@ -344,6 +351,9 @@ describe('app.evaluators', () => {
it('should return [true] if route is `/shared`', () => {
const context: any = {
selection: {
file: {}
},
navigation: {
url: '/shared'
}
+187 -34
View File
@@ -24,16 +24,21 @@
*/
import { RuleContext } from '@alfresco/adf-extensions';
import {
isNotTrashcan,
isNotLibraries,
isFavorites,
isLibraries,
isTrashcan,
isSharedFiles,
isNotSearchResults,
isPreview
} from './navigation.evaluators';
import * as navigation from './navigation.evaluators';
import * as repository from './repository.evaluators';
/**
* Checks if user can copy selected node.
* JSON ref: `app.canCopyNode`
* @param context Rule execution context
*/
export function canCopyNode(context: RuleContext): boolean {
return [
hasSelection(context),
navigation.isNotTrashcan(context),
navigation.isNotLibraries(context)
].every(Boolean);
}
/**
* Checks if user can mark selected nodes as **Favorite**.
@@ -41,7 +46,11 @@ import {
*/
export function canAddFavorite(context: RuleContext): boolean {
if (!context.selection.isEmpty) {
if (isFavorites(context) || isLibraries(context) || isTrashcan(context)) {
if (
navigation.isFavorites(context) ||
navigation.isLibraries(context) ||
navigation.isTrashcan(context)
) {
return false;
}
return context.selection.nodes.some(node => !node.entry.isFavorite);
@@ -54,8 +63,8 @@ export function canAddFavorite(context: RuleContext): boolean {
* JSON ref: `app.selection.canRemoveFavorite`
*/
export function canRemoveFavorite(context: RuleContext): boolean {
if (!context.selection.isEmpty && !isTrashcan(context)) {
if (isFavorites(context)) {
if (!context.selection.isEmpty && !navigation.isTrashcan(context)) {
if (navigation.isFavorites(context)) {
return true;
}
return context.selection.nodes.every(node => node.entry.isFavorite);
@@ -68,10 +77,36 @@ export function canRemoveFavorite(context: RuleContext): boolean {
* JSON ref: `app.selection.file.canShare`
*/
export function canShareFile(context: RuleContext): boolean {
if (isNotTrashcan(context) && context.selection.file) {
return true;
}
return false;
return [
context.selection.file,
navigation.isNotTrashcan(context),
repository.hasQuickShareEnabled(context),
!isShared(context)
].every(Boolean);
}
/**
* Checks if user can perform "Join" or "Cancel Join Request" on a library.
* JSON ref: `canToggleJoinLibrary`
*/
export function canToggleJoinLibrary(context: RuleContext): boolean {
return [
hasLibrarySelected(context),
!isPrivateLibrary(context),
hasNoLibraryRole(context)
].every(Boolean);
}
/**
* Checks if user can edit the selected folder.
* JSON ref: `canEditFolder`
* @param context Rule execution context
*/
export function canEditFolder(context: RuleContext): boolean {
return [
canUpdateSelectedFolder(context),
navigation.isNotTrashcan(context)
].every(Boolean);
}
/**
@@ -79,12 +114,12 @@ export function canShareFile(context: RuleContext): boolean {
* JSON ref: `app.selection.file.isShared`
*/
export function isShared(context: RuleContext): boolean {
if (isSharedFiles(context) && !context.selection.isEmpty) {
if (navigation.isSharedFiles(context) && !context.selection.isEmpty) {
return true;
}
if (
(isNotTrashcan(context),
(navigation.isNotTrashcan(context),
!context.selection.isEmpty && context.selection.file)
) {
return !!(
@@ -103,9 +138,9 @@ export function isShared(context: RuleContext): boolean {
*/
export function canDeleteSelection(context: RuleContext): boolean {
if (
isNotTrashcan(context) &&
isNotLibraries(context) &&
isNotSearchResults(context) &&
navigation.isNotTrashcan(context) &&
navigation.isNotLibraries(context) &&
navigation.isNotSearchResults(context) &&
!context.selection.isEmpty
) {
if (hasLockedFiles(context)) {
@@ -113,16 +148,16 @@ export function canDeleteSelection(context: RuleContext): boolean {
}
// temp workaround for Search api
if (isFavorites(context)) {
if (navigation.isFavorites(context)) {
return true;
}
if (isPreview(context)) {
if (navigation.isPreview(context)) {
return context.permissions.check(context.selection.nodes, ['delete']);
}
// workaround for Shared Files
if (isSharedFiles(context)) {
if (navigation.isSharedFiles(context)) {
return context.permissions.check(context.selection.nodes, ['delete'], {
target: 'allowableOperationsOnTarget'
});
@@ -183,7 +218,7 @@ export function canUpload(context: RuleContext): boolean {
* JSON ref: `app.selection.canDownload`
*/
export function canDownloadSelection(context: RuleContext): boolean {
if (!context.selection.isEmpty) {
if (!context.selection.isEmpty && navigation.isNotTrashcan(context)) {
return context.selection.nodes.every((node: any) => {
return (
node.entry &&
@@ -249,8 +284,10 @@ export function hasNoLibraryRole(context: RuleContext): boolean {
* JSON ref: `app.selection.file`
*/
export function hasFileSelected(context: RuleContext): boolean {
const file = context.selection.file;
return file ? true : false;
if (context && context.selection && context.selection.file) {
return true;
}
return false;
}
/**
@@ -279,7 +316,7 @@ export function canUpdateSelectedFolder(context: RuleContext): boolean {
if (folder) {
return (
// workaround for Favorites Api
isFavorites(context) ||
navigation.isFavorites(context) ||
context.permissions.check(folder.entry, ['update'])
);
}
@@ -365,11 +402,127 @@ export function canUnlockFile(context: RuleContext): boolean {
* JSON ref: `app.selection.file.canUploadVersion`
*/
export function canUploadVersion(context: RuleContext): boolean {
if (isFavorites(context) || isSharedFiles(context)) {
return true;
if (navigation.isFavorites(context) || navigation.isSharedFiles(context)) {
return hasFileSelected(context);
}
return isWriteLocked(context)
? isUserWriteLockOwner(context)
: canUpdateSelectedNode(context);
return [
hasFileSelected(context),
navigation.isNotTrashcan(context),
isWriteLocked(context)
? isUserWriteLockOwner(context)
: canUpdateSelectedNode(context)
].every(Boolean);
}
/**
* Checks if user has trashcan item selected.
* JSON ref: `isTrashcanItemSelected`
* @param context Rule execution context
*/
export function isTrashcanItemSelected(context: RuleContext): boolean {
return [navigation.isTrashcan(context), hasSelection(context)].every(Boolean);
}
/**
* Checks if user can view the file.
* JSON ref: `canViewFile`
* @param context Rule execution context
*/
export function canViewFile(context: RuleContext): boolean {
return [hasFileSelected(context), navigation.isNotTrashcan(context)].every(
Boolean
);
}
/**
* Checks if user can **Leave** selected library.
* JSON ref: `canLeaveLibrary`
* @param context Rule execution context
*/
export function canLeaveLibrary(context: RuleContext): boolean {
return [hasLibrarySelected(context), hasLibraryRole(context)].every(Boolean);
}
/**
* Checks if user can toggle shared link mode.
* JSON ref: `canToggleSharedLink`
* @param context Rule execution context
*/
export function canToggleSharedLink(context: RuleContext): boolean {
return [
hasFileSelected(context),
[canShareFile(context), isShared(context)].some(Boolean)
].every(Boolean);
}
/**
* Checks if user can show **Info Drawer** for the selected node.
* JSON ref: `canShowInfoDrawer`
* @param context Rule execution context
*/
export function canShowInfoDrawer(context: RuleContext): boolean {
return [
hasSelection(context),
navigation.isNotLibraries(context),
navigation.isNotTrashcan(context)
].every(Boolean);
}
/**
* Checks if user can manage file versions for the selected node.
* JSON ref: `canManageFileVersions`
* @param context Rule execution context
*/
export function canManageFileVersions(context: RuleContext): boolean {
return [
hasFileSelected(context),
navigation.isNotTrashcan(context),
!hasLockedFiles(context)
].every(Boolean);
}
/**
* Checks if user can manage permissions for the selected node.
* JSON ref: `canManagePermissions`
* @param context Rule execution context
*/
export function canManagePermissions(context: RuleContext): boolean {
return [
canUpdateSelectedNode(context),
navigation.isNotTrashcan(context)
].every(Boolean);
}
/**
* Checks if user can toggle **Edit Offline** mode for selected node.
* JSON ref: `canToggleEditOffline`
* @param context Rule execution context
*/
export function canToggleEditOffline(context: RuleContext): boolean {
return [
hasFileSelected(context),
navigation.isNotTrashcan(context),
navigation.isNotFavorites(context) ||
navigation.isFavoritesPreview(context),
navigation.isNotSharedFiles(context) || navigation.isSharedPreview(context),
canLockFile(context) || canUnlockFile(context)
].every(Boolean);
}
/**
* @deprecated Uses workarounds for for recent files and search api issues.
* Checks if user can toggle **Favorite** state for a node.
* @param context Rule execution context
*/
export function canToggleFavorite(context: RuleContext): boolean {
return [
[canAddFavorite(context), canRemoveFavorite(context)].some(Boolean),
[
navigation.isRecentFiles(context),
navigation.isSharedFiles(context),
navigation.isSearchResults(context),
navigation.isFavorites(context)
].some(Boolean)
].every(Boolean);
}
+53 -287
View File
@@ -10,72 +10,6 @@
"$references": ["aos.plugin.json"],
"rules": [
{
"id": "app.toolbar.favorite.canToggle",
"comment": "workaround for recent files and search api issue",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "core.some",
"parameters": [
{
"type": "rule",
"value": "app.selection.canAddFavorite"
},
{
"type": "rule",
"value": "app.selection.canRemoveFavorite"
}
]
},
{
"type": "rule",
"value": "core.some",
"parameters": [
{
"type": "rule",
"value": "app.navigation.isRecentFiles"
},
{
"type": "rule",
"value": "app.navigation.isSharedFiles"
},
{
"type": "rule",
"value": "app.navigation.isSearchResults"
},
{
"type": "rule",
"value": "app.navigation.isFavorites"
}
]
}
]
},
{
"id": "app.context.canShare",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file.canShare" },
{ "type": "rule", "value": "repository.isQuickShareEnabled" }
]
},
{
"id": "app.toolbar.canShare",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file.canShare" },
{ "type": "rule", "value": "repository.isQuickShareEnabled" },
{
"type": "rule",
"value": "core.not",
"parameters": [
{ "type": "rule", "value": "app.selection.file.isShared" }
]
}
]
},
{
"id": "app.toolbar.favorite.canAdd",
"type": "core.every",
@@ -83,10 +17,7 @@
{ "type": "rule", "value": "app.selection.canAddFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{
"type": "rule",
"value": "app.navigation.isNotSearchResults"
},
{ "type": "rule", "value": "app.navigation.isNotSearchResults" },
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
]
},
@@ -97,174 +28,9 @@
{ "type": "rule", "value": "app.selection.canRemoveFavorite" },
{ "type": "rule", "value": "app.navigation.isNotRecentFiles" },
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{
"type": "rule",
"value": "app.navigation.isNotSearchResults"
},
{ "type": "rule", "value": "app.navigation.isNotSearchResults" },
{ "type": "rule", "value": "app.navigation.isNotFavorites" }
]
},
{
"id": "app.toolbar.info",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.libraries.toolbar",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.selection.library" }
]
},
{
"id": "app.libraries.toolbar.canToggleJoin",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.library" },
{ "type": "rule",
"value": "core.not",
"parameters": [
{ "type": "rule", "value": "app.selection.isPrivateLibrary" }
]
},
{ "type": "rule", "value": "app.selection.hasNoLibraryRole" }
]
},
{
"id": "app.libraries.toolbar.canLeaveLibrary",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.library" },
{ "type": "rule", "value": "app.selection.hasLibraryRole" }
]
},
{
"id": "app.toolbar.canCopyNode",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" },
{ "type": "rule", "value": "app.navigation.isNotLibraries" }
]
},
{
"id": "app.toolbar.permissions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.first.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.versions",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" },
{
"type": "rule",
"value": "core.not",
"parameters": [
{ "type": "rule", "value": "app.selection.file.isLocked" }
]
}
]
},
{
"id": "app.trashcan.hasSelection",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.notEmpty" },
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
},
{
"id": "app.toolbar.canEditFolder",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.folder" },
{ "type": "rule", "value": "app.selection.folder.canUpdate" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canViewFile",
"type": "core.every",
"parameters": [
{
"type": "rule",
"value": "app.selection.file"
},
{
"type": "rule",
"value": "core.not",
"parameters": [
{ "type": "rule", "value": "app.navigation.isTrashcan" }
]
}
]
},
{
"id": "app.toolbar.canDownload",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canDownload" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canDelete",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.canDelete" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" }
]
},
{
"id": "app.toolbar.canToggleLock",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" },
{
"type": "rule",
"value": "core.some",
"parameters": [
{ "type": "rule", "value": "app.navigation.isNotFavorites" },
{ "type": "rule", "value": "app.navigation.isFavoritesPreview" }
]
},
{
"type": "rule",
"value": "core.some",
"parameters": [
{ "type": "rule", "value": "app.navigation.isNotSharedFiles" },
{ "type": "rule", "value": "app.navigation.isSharedPreview" }
]
},
{
"type": "rule",
"value": "core.some",
"parameters": [
{ "type": "rule", "value": "app.selection.file.canUnlock" },
{ "type": "rule", "value": "app.selection.file.canLock" }
]
}
]
},
{
"id": "app.toolbar.canUploadNewVersion",
"type": "core.every",
"parameters": [
{ "type": "rule", "value": "app.selection.file" },
{ "type": "rule", "value": "app.navigation.isNotTrashcan" },
{ "type": "rule", "value": "app.selection.file.canUploadVersion" }
]
}
],
@@ -438,7 +204,7 @@
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.toolbar.canShare"
"visible": "app.selection.file.canShare"
}
},
{
@@ -462,7 +228,7 @@
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
"visible": "canViewFile"
}
},
{
@@ -474,7 +240,7 @@
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
"visible": "app.selection.canDownload"
}
},
{
@@ -486,7 +252,7 @@
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
"visible": "isTrashcanItemSelected"
}
},
{
@@ -498,7 +264,7 @@
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
"visible": "isTrashcanItemSelected"
}
},
{
@@ -507,7 +273,7 @@
"order": 600,
"component": "app.toolbar.toggleJoinLibrary",
"rules": {
"visible": "app.libraries.toolbar.canToggleJoin"
"visible": "canToggleJoinLibrary"
}
},
{
@@ -519,7 +285,7 @@
"click": "LEAVE_LIBRARY"
},
"rules": {
"visible": "app.libraries.toolbar.canLeaveLibrary"
"visible": "canLeaveLibrary"
}
},
{
@@ -533,7 +299,7 @@
"order": 700,
"component": "app.toolbar.toggleInfoDrawer",
"rules": {
"visible": "app.toolbar.info"
"visible": "canShowInfoDrawer"
}
},
{
@@ -542,7 +308,7 @@
"order": 800,
"component": "app.toolbar.toggleInfoDrawer",
"rules": {
"visible": "app.libraries.toolbar"
"visible": "app.selection.library"
}
},
{
@@ -558,7 +324,7 @@
"type": "custom",
"component": "app.toolbar.toggleEditOffline",
"rules": {
"visible": "app.toolbar.canToggleLock"
"visible": "canToggleEditOffline"
}
},
{
@@ -570,7 +336,7 @@
"click": "UPLOAD_FILE_VERSION"
},
"rules": {
"visible": "app.toolbar.canUploadNewVersion"
"visible": "app.selection.file.canUploadVersion"
}
},
{
@@ -585,7 +351,7 @@
"order": 400,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
"visible": "canToggleFavorite"
}
},
{
@@ -594,7 +360,7 @@
"order": 401,
"component": "app.toolbar.toggleFavoriteLibrary",
"rules": {
"visible": "app.libraries.toolbar"
"visible": "app.selection.library"
}
},
{
@@ -630,7 +396,7 @@
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
"visible": "canEditFolder"
}
},
{
@@ -647,7 +413,7 @@
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
"visible": "canCopyNode"
}
},
{
@@ -659,7 +425,7 @@
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.toolbar.canDelete"
"visible": "app.selection.canDelete"
}
},
{
@@ -671,7 +437,7 @@
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.toolbar.canDelete"
"visible": "app.selection.canDelete"
}
},
{
@@ -688,7 +454,7 @@
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
"visible": "canManageFileVersions"
}
},
{
@@ -700,7 +466,7 @@
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
"visible": "canManagePermissions"
}
},
{
@@ -725,7 +491,7 @@
"type": "custom",
"component": "app.toolbar.toggleEditOffline",
"rules": {
"visible": "app.toolbar.canToggleLock"
"visible": "canToggleEditOffline"
}
},
{
@@ -737,7 +503,7 @@
"click": "UPLOAD_FILE_VERSION"
},
"rules": {
"visible": "app.toolbar.canUploadNewVersion"
"visible": "app.selection.file.canUploadVersion"
}
},
{
@@ -751,7 +517,7 @@
"order": 400,
"component": "app.shared-link.toggleSharedLink",
"rules": {
"visible": "app.context.canShare"
"visible": "canToggleSharedLink"
}
},
{
@@ -763,7 +529,7 @@
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
"visible": "app.selection.canDownload"
}
},
{
@@ -775,7 +541,7 @@
"click": "VIEW_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
"visible": "canViewFile"
}
},
{
@@ -809,7 +575,7 @@
"order": 702,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
"visible": "canToggleFavorite"
}
},
{
@@ -818,7 +584,7 @@
"order": 703,
"component": "app.toolbar.toggleFavoriteLibrary",
"rules": {
"visible": "app.libraries.toolbar"
"visible": "app.selection.library"
}
},
{
@@ -830,7 +596,7 @@
"click": "EDIT_FOLDER"
},
"rules": {
"visible": "app.toolbar.canEditFolder"
"visible": "canEditFolder"
}
},
{
@@ -847,7 +613,7 @@
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
"visible": "canCopyNode"
}
},
{
@@ -859,7 +625,7 @@
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.toolbar.canDelete"
"visible": "app.selection.canDelete"
}
},
{
@@ -871,7 +637,7 @@
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.toolbar.canDelete"
"visible": "app.selection.canDelete"
}
},
{
@@ -888,7 +654,7 @@
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
"visible": "canManageFileVersions"
}
},
{
@@ -900,7 +666,7 @@
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
"visible": "canManagePermissions"
}
},
{
@@ -909,7 +675,7 @@
"order": 100,
"component": "app.menu.toggleJoinLibrary",
"rules": {
"visible": "app.libraries.toolbar.canToggleJoin"
"visible": "canToggleJoinLibrary"
}
},
{
@@ -921,7 +687,7 @@
"click": "LEAVE_LIBRARY"
},
"rules": {
"visible": "app.libraries.toolbar.canLeaveLibrary"
"visible": "canLeaveLibrary"
}
},
{
@@ -933,7 +699,7 @@
"click": "DELETE_LIBRARY"
},
"rules": {
"visible": "app.libraries.toolbar"
"visible": "app.selection.library"
}
},
{
@@ -945,7 +711,7 @@
"click": "PURGE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
"visible": "isTrashcanItemSelected"
}
},
{
@@ -957,7 +723,7 @@
"click": "RESTORE_DELETED_NODES"
},
"rules": {
"visible": "app.trashcan.hasSelection"
"visible": "isTrashcanItemSelected"
}
}
],
@@ -972,7 +738,7 @@
"click": "FULLSCREEN_VIEWER"
},
"rules": {
"visible": "app.toolbar.canViewFile"
"visible": "canViewFile"
}
},
{
@@ -989,7 +755,7 @@
"click": "SHARE_NODE"
},
"rules": {
"visible": "app.toolbar.canShare"
"visible": "app.selection.file.canShare"
}
},
{
@@ -1013,7 +779,7 @@
"click": "DOWNLOAD_NODES"
},
"rules": {
"visible": "app.toolbar.canDownload"
"visible": "app.selection.canDownload"
}
},
{
@@ -1025,7 +791,7 @@
"click": "PRINT_FILE"
},
"rules": {
"visible": "app.toolbar.canViewFile"
"visible": "canViewFile"
}
},
{
@@ -1039,7 +805,7 @@
"order": 500,
"component": "app.toolbar.toggleInfoDrawer",
"rules": {
"visible": "app.toolbar.info"
"visible": "canShowInfoDrawer"
}
},
{
@@ -1055,7 +821,7 @@
"type": "custom",
"component": "app.toolbar.toggleEditOffline",
"rules": {
"visible": "app.toolbar.canToggleLock"
"visible": "canToggleEditOffline"
}
},
{
@@ -1067,7 +833,7 @@
"click": "UPLOAD_FILE_VERSION"
},
"rules": {
"visible": "app.toolbar.canUploadNewVersion"
"visible": "app.selection.file.canUploadVersion"
}
},
{
@@ -1106,7 +872,7 @@
"order": 402,
"component": "app.toolbar.toggleFavorite",
"rules": {
"visible": "app.toolbar.favorite.canToggle"
"visible": "canToggleFavorite"
}
},
{
@@ -1123,7 +889,7 @@
"click": "COPY_NODES"
},
"rules": {
"visible": "app.toolbar.canCopyNode"
"visible": "canCopyNode"
}
},
{
@@ -1135,7 +901,7 @@
"click": "MOVE_NODES"
},
"rules": {
"visible": "app.toolbar.canDelete"
"visible": "app.selection.canDelete"
}
},
{
@@ -1147,7 +913,7 @@
"click": "DELETE_NODES"
},
"rules": {
"visible": "app.toolbar.canDelete"
"visible": "app.selection.canDelete"
}
},
{
@@ -1165,7 +931,7 @@
"click": "MANAGE_VERSIONS"
},
"rules": {
"visible": "app.toolbar.versions"
"visible": "canManageFileVersions"
}
},
{
@@ -1177,7 +943,7 @@
"click": "MANAGE_PERMISSIONS"
},
"rules": {
"visible": "app.toolbar.permissions"
"visible": "canManagePermissions"
}
}
]
@@ -1255,7 +1021,7 @@
"title": "APP.INFO_DRAWER.TABS.LIBRARY_PROPERTIES",
"component": "app.components.tabs.library.metadata",
"rules": {
"visible": "app.libraries.toolbar"
"visible": "app.selection.library"
}
}
],