mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACA-3897] Extendable viewer navigation (#2109)
* [ACA-3897] Extendable viewer navigation * Update app.extensions.json
This commit is contained in:
parent
cd5ccc4c4d
commit
6700830c9d
@ -569,6 +569,11 @@ export interface ViewerRules {
|
||||
* Checks if user can preview the node.
|
||||
*/
|
||||
canPreview?: string;
|
||||
|
||||
/**
|
||||
* Shows navigation options
|
||||
*/
|
||||
showNavigation?: string;
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -780,6 +780,10 @@
|
||||
"canPreview": {
|
||||
"description": "Controls whether preview is enabled for particular node",
|
||||
"type": "string"
|
||||
},
|
||||
"showNavigation": {
|
||||
"description": "Controls viewer navigation options",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -28,4 +28,9 @@ export interface ViewerRules {
|
||||
* Checks if user can preview the node.
|
||||
*/
|
||||
canPreview?: string;
|
||||
|
||||
/**
|
||||
* Shows navigation options
|
||||
*/
|
||||
showNavigation?: string;
|
||||
}
|
||||
|
@ -497,4 +497,17 @@ export class AppExtensionService implements RuleContext {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
canShowViewerNavigation(node: NodeEntry) {
|
||||
const rules = this.viewerRules;
|
||||
|
||||
if (this.isRuleDefined(rules.showNavigation)) {
|
||||
const showNavigation = this.evaluateRule(rules.showNavigation, node);
|
||||
if (!showNavigation) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -214,6 +214,12 @@ export class AppViewerComponent implements OnInit, OnDestroy {
|
||||
this.node = await this.contentApi.getNodeInfo(nodeId).toPromise();
|
||||
this.canUpdateNode = this.content.canUpdateNode(this.node);
|
||||
this.store.dispatch(new SetSelectedNodesAction([{ entry: this.node }]));
|
||||
this.navigateMultiple = this.extensions.canShowViewerNavigation({ entry: this.node });
|
||||
if (!this.navigateMultiple) {
|
||||
this.nodeId = this.node.id;
|
||||
this.fileName = this.node.name + this.node?.properties?.['cm:versionLabel'];
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.node && this.node.isFile) {
|
||||
const nearest = await this.getNearestNodes(this.node.id, this.node.parentId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user