mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1769] Added JSDocs and methods and updated script (#2927)
This commit is contained in:
committed by
Eugenio Romano
parent
2bfed5818f
commit
76ad797488
@@ -41,6 +41,10 @@ export class DocumentActionsService {
|
||||
this.setupActionHandlers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the handler for an action.
|
||||
* @param key Identifier of the action
|
||||
*/
|
||||
getHandler(key: string): ContentActionHandler {
|
||||
if (key) {
|
||||
let lkey = key.toLowerCase();
|
||||
@@ -49,6 +53,11 @@ export class DocumentActionsService {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new handler for an action.
|
||||
* @param key Identifier of the action
|
||||
* @param handler Handler for the action
|
||||
*/
|
||||
setHandler(key: string, handler: ContentActionHandler): boolean {
|
||||
if (key) {
|
||||
let lkey = key.toLowerCase();
|
||||
@@ -58,6 +67,10 @@ export class DocumentActionsService {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if actions can be executed for an item.
|
||||
* @param obj Item to receive an action
|
||||
*/
|
||||
canExecuteAction(obj: any): boolean {
|
||||
return this.documentListService && obj && obj.entry.isFile === true;
|
||||
}
|
||||
|
@@ -62,6 +62,10 @@ export class DocumentListService {
|
||||
return this.apiService.getInstance().nodes.getNodeChildren(rootNodeId, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a node.
|
||||
* @param nodeId ID of the node to delete
|
||||
*/
|
||||
deleteNode(nodeId: string): Observable<any> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().nodes.deleteNode(nodeId));
|
||||
}
|
||||
@@ -70,7 +74,7 @@ export class DocumentListService {
|
||||
* Copy a node to destination node
|
||||
*
|
||||
* @param nodeId The id of the node to be copied
|
||||
* @param targetParentId The id of the folder-node where the node have to be copied to
|
||||
* @param targetParentId The id of the folder where the node will be copied
|
||||
*/
|
||||
copyNode(nodeId: string, targetParentId: string) {
|
||||
return Observable.fromPromise(this.apiService.getInstance().nodes.copyNode(nodeId, { targetParentId }))
|
||||
@@ -81,7 +85,7 @@ export class DocumentListService {
|
||||
* Move a node to destination node
|
||||
*
|
||||
* @param nodeId The id of the node to be moved
|
||||
* @param targetParentId The id of the folder-node where the node have to be moved to
|
||||
* @param targetParentId The id of the folder where the node will be moved
|
||||
*/
|
||||
moveNode(nodeId: string, targetParentId: string) {
|
||||
return Observable.fromPromise(this.apiService.getInstance().nodes.moveNode(nodeId, { targetParentId }))
|
||||
@@ -111,6 +115,10 @@ export class DocumentListService {
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a folder node via its node ID.
|
||||
* @param nodeId ID of the folder node
|
||||
*/
|
||||
getFolderNode(nodeId: string): Promise<MinimalNodeEntryEntity> {
|
||||
let opts: any = {
|
||||
includeSource: true,
|
||||
@@ -130,14 +138,26 @@ export class DocumentListService {
|
||||
return this.thumbnailService.getDocumentThumbnailUrl(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the icon that represents a MIME type.
|
||||
* @param mimeType MIME type to get the icon for
|
||||
*/
|
||||
getMimeTypeIcon(mimeType: string): string {
|
||||
return this.thumbnailService.getMimeTypeIcon(mimeType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a default icon for MIME types with no specific icon.
|
||||
*/
|
||||
getDefaultMimeTypeIcon(): string {
|
||||
return this.thumbnailService.getDefaultMimeTypeIcon();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a node has the specified permission.
|
||||
* @param node Target node
|
||||
* @param permission Permission level to query
|
||||
*/
|
||||
hasPermission(node: any, permission: PermissionsEnum|string): boolean {
|
||||
return this.contentService.hasPermission(node, permission);
|
||||
}
|
||||
|
Reference in New Issue
Block a user