mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-24 14:31:16 +00:00
[ACA-3897] Extendable viewer navigation (#2109)
* [ACA-3897] Extendable viewer navigation * Update app.extensions.json
This commit is contained in:
@@ -569,6 +569,11 @@ export interface ViewerRules {
|
|||||||
* Checks if user can preview the node.
|
* Checks if user can preview the node.
|
||||||
*/
|
*/
|
||||||
canPreview?: string;
|
canPreview?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows navigation options
|
||||||
|
*/
|
||||||
|
showNavigation?: string;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -780,6 +780,10 @@
|
|||||||
"canPreview": {
|
"canPreview": {
|
||||||
"description": "Controls whether preview is enabled for particular node",
|
"description": "Controls whether preview is enabled for particular node",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
},
|
||||||
|
"showNavigation": {
|
||||||
|
"description": "Controls viewer navigation options",
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -28,4 +28,9 @@ export interface ViewerRules {
|
|||||||
* Checks if user can preview the node.
|
* Checks if user can preview the node.
|
||||||
*/
|
*/
|
||||||
canPreview?: string;
|
canPreview?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows navigation options
|
||||||
|
*/
|
||||||
|
showNavigation?: string;
|
||||||
}
|
}
|
||||||
|
@@ -497,4 +497,17 @@ export class AppExtensionService implements RuleContext {
|
|||||||
|
|
||||||
return true;
|
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.node = await this.contentApi.getNodeInfo(nodeId).toPromise();
|
||||||
this.canUpdateNode = this.content.canUpdateNode(this.node);
|
this.canUpdateNode = this.content.canUpdateNode(this.node);
|
||||||
this.store.dispatch(new SetSelectedNodesAction([{ entry: 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) {
|
if (this.node && this.node.isFile) {
|
||||||
const nearest = await this.getNearestNodes(this.node.id, this.node.parentId);
|
const nearest = await this.getNearestNodes(this.node.id, this.node.parentId);
|
||||||
|
Reference in New Issue
Block a user