[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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 327 additions and 374 deletions

View File

@ -113,7 +113,6 @@ Below is the list of public actions types you can use in the plugin definitions
| 1.7.0 | UPLOAD_FOLDER | n/a | Invoke "Upload Folder" dialog and upload selected folder to the currently opened one. |
| 1.7.0 | UPLOAD_FILE_VERSION | n/a | Invoke "New File Version" dialog. |
| 1.7.0 | VIEW_FILE | MinimalNodeEntity | Preview the file (or selection) in the Viewer. |
| 1.8.0 | VIEW_NODE | string | Lightweight preview of a node by id. Can be invoked from extensions. |
| 1.7.0 | UNLOCK_WRITE | NodeEntry | Unlock file from read only mode |
| 1.7.0 | PRINT_FILE | MinimalNodeEntity | Print the file opened in the Viewer (or selected). |
| 1.7.0 | FULLSCREEN_VIEWER | n/a | Enters fullscreen mode to view the file opened in the Viewer. |
@ -122,3 +121,4 @@ Below is the list of public actions types you can use in the plugin definitions
| 1.7.0 | TOGGLE_SEARCH_FILTER | n/a | Toggle Filter component visibility in Search Results. |
| 1.7.0 | SHOW_SEARCH_FILTER | n/a | Show Filter component in Search Results. |
| 1.7.0 | HIDE_SEARCH_FILTER | n/a | Hide Filter component in Search Results |
| 1.8.0 | VIEW_NODE | string | Lightweight preview of a node by id. Can be invoked from extensions. |

View File

@ -56,11 +56,11 @@ in case you do not need providing extra parameters, or chaining multiple rules t
You can create new rules by chaining other rules and evaluators.
| Key | Description |
| ---------- | ----------------------------------------------------------------------------- |
| core.every | Evaluates to `true` if all chained rules evaluate to `true`. |
| core.some | Evaluates to `true` if at least one of the chained rules evaluates to `true`. |
| core.not | Evaluates to `true` if all chained rules evaluate to `false`. |
| Version | Key | Description |
| ------- | ---------- | ----------------------------------------------------------------------------- |
| 1.7.0 | core.every | Evaluates to `true` if all chained rules evaluate to `true`. |
| 1.7.0 | core.some | Evaluates to `true` if at least one of the chained rules evaluates to `true`. |
| 1.7.0 | core.not | Evaluates to `true` if all chained rules evaluate to `false`. |
Below is an example of the composite rule definition that combines the following conditions:
@ -129,31 +129,42 @@ The button will be visible only when the linked rule evaluates to `true`.
## Application Evaluators
| Key | Description |
| ----------------------------------- | ------------------------------------------------------------ |
| app.selection.canDelete | User has permission to delete selected node(s). |
| app.selection.canDownload | User can download selected node(s). |
| app.selection.notEmpty | At least one node is selected. |
| app.selection.canUnshare | User is able to remove selected node(s) from public sharing. |
| app.selection.canAddFavorite | User can add selected node(s) to favorites. |
| app.selection.canRemoveFavorite | User can remove selected node(s) from favorites. |
| app.selection.first.canUpdate | User has permission to update selected node(s). |
| app.selection.file | A single File node is selected. |
| app.selection.file.canShare | User is able to share the selected file. |
| app.selection.file.isShared | A shared node is selected. |
| app.selection.file.isLocked | File is locked for editing. |
| app.selection.file.isLockOwner | File is locked and current user is the lock owner. |
| app.selection.file.canUploadVersion | User can update file version. |
| app.selection.library | A single Library node is selected. |
| app.selection.isPrivateLibrary | A private Library node is selected. |
| app.selection.hasLibraryRole | The selected Library node has a role property. |
| app.selection.hasNoLibraryRole | The selected Library node has no role property. |
| app.selection.folder | A single Folder node is selected. |
| app.selection.folder.canUpdate | User has permissions to update the selected folder. |
| app.selection.folder.canUpdate | User has permissions to update the selected folder. |
| app.selection.file.canLock | User has permissions to lock file. |
| app.selection.file.canUnlock | User has permissions to unlock file. |
| repository.isQuickShareEnabled | Whether the quick share repository option is enabled or not. |
| Ver. | Key | Description |
| ----- | ----------------------------------- | ------------------------------------------------------------------------ |
| 1.7.0 | app.selection.canDelete | User has permission to delete selected node(s). |
| 1.7.0 | app.selection.canDownload | User can download selected node(s). |
| 1.7.0 | app.selection.notEmpty | At least one node is selected. |
| 1.7.0 | app.selection.canUnshare | User is able to remove selected node(s) from public sharing. |
| 1.7.0 | app.selection.canAddFavorite | User can add selected node(s) to favorites. |
| 1.7.0 | app.selection.canRemoveFavorite | User can remove selected node(s) from favorites. |
| 1.7.0 | app.selection.first.canUpdate | User has permission to update selected node(s). |
| 1.7.0 | app.selection.file | A single File node is selected. |
| 1.7.0 | app.selection.file.canShare | User is able to share the selected file. |
| 1.7.0 | app.selection.file.isShared | A shared node is selected. |
| 1.7.0 | app.selection.file.isLocked | File is locked for editing. |
| 1.7.0 | app.selection.file.isLockOwner | File is locked and current user is the lock owner. |
| 1.7.0 | app.selection.file.canUploadVersion | User can update file version. |
| 1.7.0 | app.selection.library | A single Library node is selected. |
| 1.7.0 | app.selection.isPrivateLibrary | A private Library node is selected. |
| 1.7.0 | app.selection.hasLibraryRole | The selected Library node has a role property. |
| 1.7.0 | app.selection.hasNoLibraryRole | The selected Library node has no role property. |
| 1.7.0 | app.selection.folder | A single Folder node is selected. |
| 1.7.0 | app.selection.folder.canUpdate | User has permissions to update the selected folder. |
| 1.7.0 | app.selection.folder.canUpdate | User has permissions to update the selected folder. |
| 1.7.0 | app.selection.file.canLock | User has permissions to lock file. |
| 1.7.0 | app.selection.file.canUnlock | User has permissions to unlock file. |
| 1.7.0 | repository.isQuickShareEnabled | Whether the quick share repository option is enabled or not. |
| 1.8.0 | canCopyNode | Checks if user can copy selected node. |
| 1.8.0 | canToggleJoinLibrary | Checks if user can perform "Join" or "Cancel Join Request" on a library. |
| 1.8.0 | canEditFolder | Checks if user can edit the selected folder. |
| 1.8.0 | isTrashcanItemSelected | Checks if user has trashcan item selected. |
| 1.8.0 | canViewFile | Checks if user can view the file. |
| 1.8.0 | canLeaveLibrary | Checks if user can **Leave** selected library. |
| 1.8.0 | canToggleSharedLink | Checks if user can toggle shared link mode. |
| 1.8.0 | canShowInfoDrawer | Checks if user can show **Info Drawer** for the selected node. |
| 1.8.0 | canManageFileVersions | Checks if user can manage file versions for the selected node. |
| 1.8.0 | canManagePermissions | Checks if user can manage permissions for the selected node. |
| 1.8.0 | canToggleEditOffline | Checks if user can toggle **Edit Offline** mode for selected node. |
## Navigation Evaluators
@ -165,28 +176,28 @@ for example mixing `core.every` and `core.not`.
**Tip:** You can also negate any rule by utilizing a `!` prefix:
`!app.navigation.isTrashcan` is the opposite of the `app.navigation.isTrashcan`.
| Key | Description |
| --------------------------------- | ---------------------------------------------------------------- |
| app.navigation.folder.canCreate | User can create content in the currently opened folder. |
| app.navigation.folder.canUpload | User can upload content to the currently opened folder. |
| app.navigation.isTrashcan | User is using the **Trashcan** page. |
| app.navigation.isNotTrashcan | Current page is not a **Trashcan**. |
| app.navigation.isLibraries | User is using a **Libraries** or **Library Search Result** page. |
| app.navigation.isNotLibraries | Current page is not a **Libraries** page. |
| app.navigation.isSharedFiles | User is using the **Shared Files** page. |
| app.navigation.isNotSharedFiles | Current page is not **Shared Files**. |
| app.navigation.isFavorites | User is using the **Favorites** page. |
| app.navigation.isNotFavorites | Current page is not **Favorites**. |
| app.navigation.isRecentFiles | User is using the **Recent Files** page. |
| app.navigation.isNotRecentFiles | Current page is not **Recent Files**. |
| app.navigation.isSearchResults | User is using the **Search Results** page. |
| app.navigation.isNotSearchResults | Current page is not the **Search Results**. |
| app.navigation.isSharedPreview | Current page is preview **Shared Files**. |
| app.navigation.isFavoritesPreview | Current page is preview **Favorites**. |
| app.navigation.isSharedFileViewer | Current page is shared file preview page. |
| app.navigation.isPreview | Current page is **Preview**. |
| app.navigation.isPersonalFiles | Current page is **Personal Files**. |
| app.navigation.isLibraryFiles | Current page is **Library Files**. |
| Version | Key | Description |
| ------- | --------------------------------- | ---------------------------------------------------------------- |
| 1.7.0 | app.navigation.folder.canCreate | User can create content in the currently opened folder. |
| 1.7.0 | app.navigation.folder.canUpload | User can upload content to the currently opened folder. |
| 1.7.0 | app.navigation.isTrashcan | User is using the **Trashcan** page. |
| 1.7.0 | app.navigation.isNotTrashcan | Current page is not a **Trashcan**. |
| 1.7.0 | app.navigation.isLibraries | User is using a **Libraries** or **Library Search Result** page. |
| 1.7.0 | app.navigation.isNotLibraries | Current page is not a **Libraries** page. |
| 1.7.0 | app.navigation.isSharedFiles | User is using the **Shared Files** page. |
| 1.7.0 | app.navigation.isNotSharedFiles | Current page is not **Shared Files**. |
| 1.7.0 | app.navigation.isFavorites | User is using the **Favorites** page. |
| 1.7.0 | app.navigation.isNotFavorites | Current page is not **Favorites**. |
| 1.7.0 | app.navigation.isRecentFiles | User is using the **Recent Files** page. |
| 1.7.0 | app.navigation.isNotRecentFiles | Current page is not **Recent Files**. |
| 1.7.0 | app.navigation.isSearchResults | User is using the **Search Results** page. |
| 1.7.0 | app.navigation.isNotSearchResults | Current page is not the **Search Results**. |
| 1.7.0 | app.navigation.isSharedPreview | Current page is preview **Shared Files**. |
| 1.7.0 | app.navigation.isFavoritesPreview | Current page is preview **Favorites**. |
| 1.7.0 | app.navigation.isSharedFileViewer | Current page is shared file preview page. |
| 1.7.0 | app.navigation.isPreview | Current page is **Preview**. |
| 1.7.0 | app.navigation.isPersonalFiles | Current page is **Personal Files**. |
| 1.7.0 | app.navigation.isLibraryFiles | Current page is **Library Files**. |
**Tip:** See the [Registration](/extending/registration) section for more details
on how to register your own entries to be re-used at runtime.

View File

@ -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,

View File

@ -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'
}

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);
}

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