mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
allow showing viewer based on only node id (#2257)
This commit is contained in:
committed by
Mario Romano
parent
549cb505f8
commit
480bef7ad9
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { MdDialog } from '@angular/material';
|
import { MdDialog } from '@angular/material';
|
||||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
import { MinimalNodeEntity, MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||||
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
import { AlfrescoApiService } from 'ng2-alfresco-core';
|
||||||
|
|
||||||
import { ViewerDialogComponent } from './../components/viewer-dialog.component';
|
import { ViewerDialogComponent } from './../components/viewer-dialog.component';
|
||||||
@@ -34,6 +34,10 @@ export class ViewerService {
|
|||||||
return this.apiService.getInstance().content;
|
return this.apiService.getInstance().content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get nodesApi() {
|
||||||
|
return this.apiService.getInstance().nodes;
|
||||||
|
}
|
||||||
|
|
||||||
showViewerForNode(node: MinimalNodeEntryEntity): Promise<boolean> {
|
showViewerForNode(node: MinimalNodeEntryEntity): Promise<boolean> {
|
||||||
return new Promise<boolean>((resolve, reject) => {
|
return new Promise<boolean>((resolve, reject) => {
|
||||||
const settings: ViewerDialogSettings = {
|
const settings: ViewerDialogSettings = {
|
||||||
@@ -53,4 +57,18 @@ export class ViewerService {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showViewerForNodeId(nodeId: string): Promise<boolean> {
|
||||||
|
return new Promise<boolean>((resolve, reject) => {
|
||||||
|
this.nodesApi.getNode(nodeId).then(
|
||||||
|
(node: MinimalNodeEntity) => {
|
||||||
|
if (node && node.entry && node.entry.isFile) {
|
||||||
|
return this.showViewerForNode(node.entry);
|
||||||
|
} else {
|
||||||
|
resolve(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user