mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2905] Updated JSDocs for content services (#3262)
* [ADF-2905] Updated JSDocs for content services * [ADF-2905] Updated JSDocs for content services * [ADF-2911] Improved error message handling in doc tools (#3267) * [ADF-2772] Sidenav Layout - UX review (#3264) * Add border-right in mat-sidenav * workaround for enum issue in js-api * fix the AoT buid error * fix AoT build error * fix export problem for AoT * [ADF-2905] Updated JSDocs for content services * [ADF-2905] Updated JSDocs for content services
This commit is contained in:
committed by
Eugenio Romano
parent
7f020348ad
commit
b393708514
@@ -31,21 +31,29 @@ import { CardViewGroup } from '../../interfaces/content-metadata.interfaces';
|
||||
})
|
||||
export class ContentMetadataComponent implements OnChanges, OnInit {
|
||||
|
||||
/** (required) The node entity to fetch metadata about */
|
||||
@Input()
|
||||
node: MinimalNodeEntryEntity;
|
||||
|
||||
/** Toggles whether the edit button should be shown */
|
||||
@Input()
|
||||
editable: boolean = false;
|
||||
|
||||
/** Toggles whether to display empty values in the card view */
|
||||
@Input()
|
||||
displayEmpty: boolean = false;
|
||||
|
||||
/** Toggles between expanded (ie, full information) and collapsed
|
||||
* (ie, reduced information) in the display
|
||||
*/
|
||||
@Input()
|
||||
expanded: boolean = false;
|
||||
|
||||
/** The multi parameter of the underlying material expansion panel */
|
||||
@Input()
|
||||
multi = false;
|
||||
|
||||
/** Name of the metadata preset, which defines aspects and their properties */
|
||||
@Input()
|
||||
preset: string;
|
||||
|
||||
|
@@ -32,6 +32,7 @@ import 'rxjs/operator/switchMap';
|
||||
@Injectable()
|
||||
export class ContentNodeDialogService {
|
||||
|
||||
/** Emitted when an error occurs. */
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
@@ -42,8 +43,11 @@ export class ContentNodeDialogService {
|
||||
private translation: TranslationService) {
|
||||
}
|
||||
|
||||
/** Opens a file browser at a chosen folder location. */
|
||||
/** @param folderNodeId ID of the folder to use */
|
||||
/**
|
||||
* Opens a file browser at a chosen folder location.
|
||||
* @param folderNodeId ID of the folder to use
|
||||
* @returns Information about the selected file(s)
|
||||
*/
|
||||
openFileBrowseDialogByFolderId(folderNodeId: string): Observable<MinimalNodeEntryEntity[]> {
|
||||
return this.documentListService.getFolderNode(folderNodeId).switchMap((node: MinimalNodeEntryEntity) => {
|
||||
return this.openUploadFileDialog('Choose', node);
|
||||
@@ -51,9 +55,9 @@ export class ContentNodeDialogService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a lock node dialog
|
||||
*
|
||||
* Opens a lock node dialog.
|
||||
* @param contentEntry Node to lock
|
||||
* @returns Error/status message (if any)
|
||||
*/
|
||||
public openLockNodeDialog(contentEntry: MinimalNodeEntryEntity): Subject<string> {
|
||||
const observable: Subject<string> = new Subject<string>();
|
||||
@@ -76,33 +80,44 @@ export class ContentNodeDialogService {
|
||||
return observable;
|
||||
}
|
||||
|
||||
/** Opens a file browser at a chosen site location. */
|
||||
/**
|
||||
* Opens a file browser at a chosen site location.
|
||||
* @returns Information about the selected file(s)
|
||||
*/
|
||||
openFileBrowseDialogBySite(): Observable<MinimalNodeEntryEntity[]> {
|
||||
return this.siteService.getSites().switchMap((response: SitePaging) => {
|
||||
return this.openFileBrowseDialogByFolderId(response.list.entries[0].entry.guid);
|
||||
});
|
||||
}
|
||||
|
||||
/** Opens a folder browser at a chosen site location. */
|
||||
/**
|
||||
* Opens a folder browser at a chosen site location.
|
||||
* @returns Information about the selected folder(s)
|
||||
*/
|
||||
openFolderBrowseDialogBySite(): Observable<MinimalNodeEntryEntity[]> {
|
||||
return this.siteService.getSites().switchMap((response: SitePaging) => {
|
||||
return this.openFolderBrowseDialogByFolderId(response.list.entries[0].entry.guid);
|
||||
});
|
||||
}
|
||||
|
||||
/** Opens a folder browser at a chosen folder location. */
|
||||
/** @param folderNodeId ID of the folder to use */
|
||||
/**
|
||||
* Opens a folder browser at a chosen folder location.
|
||||
* @param folderNodeId ID of the folder to use
|
||||
* @returns Information about the selected folder(s)
|
||||
*/
|
||||
openFolderBrowseDialogByFolderId(folderNodeId: string): Observable<MinimalNodeEntryEntity[]> {
|
||||
return this.documentListService.getFolderNode(folderNodeId).switchMap((node: MinimalNodeEntryEntity) => {
|
||||
return this.openUploadFolderDialog('Choose', node);
|
||||
});
|
||||
}
|
||||
|
||||
/** Opens a dialog to copy or move an item to a new location. */
|
||||
/** @param action Name of the action (eg, "Copy" or "Move") to show in the title */
|
||||
|
||||
/** @param contentEntry Item to be copied or moved */
|
||||
/** @param permission Permission for the operation */
|
||||
/**
|
||||
* Opens a dialog to copy or move an item to a new location.
|
||||
* @param action Name of the action (eg, "Copy" or "Move") to show in the title
|
||||
* @param contentEntry Item to be copied or moved
|
||||
* @param permission Permission for the operation
|
||||
* @returns Information about files that were copied/moved
|
||||
*/
|
||||
openCopyMoveDialog(action: string, contentEntry: MinimalNodeEntryEntity, permission?: string): Observable<MinimalNodeEntryEntity[]> {
|
||||
if (this.contentService.hasPermission(contentEntry, permission)) {
|
||||
|
||||
@@ -132,18 +147,22 @@ export class ContentNodeDialogService {
|
||||
}
|
||||
}
|
||||
|
||||
/** Gets the translation of the dialog title. */
|
||||
|
||||
/** @param action Name of the action to display in the dialog title */
|
||||
/** @param name Name of the item on which the action is being performed */
|
||||
/**
|
||||
* Gets the translation of the dialog title.
|
||||
* @param action Name of the action to display in the dialog title
|
||||
* @param name Name of the item on which the action is being performed
|
||||
* @returns Translated version of the title
|
||||
*/
|
||||
getTitleTranslation(action: string, name: string): string {
|
||||
return this.translation.instant(`NODE_SELECTOR.${action.toUpperCase()}_ITEM`, { name });
|
||||
}
|
||||
|
||||
/** Opens a dialog to choose a folder to upload. */
|
||||
|
||||
/** @param action Name of the action to show in the title */
|
||||
/** @param contentEntry Item to upload */
|
||||
/**
|
||||
* Opens a dialog to choose folders to upload.
|
||||
* @param action Name of the action to show in the title
|
||||
* @param contentEntry Item to upload
|
||||
* @returns Information about the chosed folder(s)
|
||||
*/
|
||||
openUploadFolderDialog(action: string, contentEntry: MinimalNodeEntryEntity): Observable<MinimalNodeEntryEntity[]> {
|
||||
const select = new Subject<MinimalNodeEntryEntity[]>();
|
||||
select.subscribe({
|
||||
@@ -164,10 +183,12 @@ export class ContentNodeDialogService {
|
||||
return select;
|
||||
}
|
||||
|
||||
/** Opens a dialog to choose a file to upload. */
|
||||
|
||||
/** @param action Name of the action to show in the title */
|
||||
/** @param contentEntry Item to upload */
|
||||
/**
|
||||
* Opens a dialog to choose a file to upload.
|
||||
* @param action Name of the action to show in the title
|
||||
* @param contentEntry Item to upload
|
||||
* @returns Information about the chosen file(s)
|
||||
*/
|
||||
openUploadFileDialog(action: string, contentEntry: MinimalNodeEntryEntity): Observable<MinimalNodeEntryEntity[]> {
|
||||
const select = new Subject<MinimalNodeEntryEntity[]>();
|
||||
select.subscribe({
|
||||
|
@@ -27,6 +27,7 @@ import { ContentNodeDialogService } from '../content-node-selector/content-node-
|
||||
})
|
||||
export class NodeLockDirective implements AfterViewInit {
|
||||
|
||||
/** Node to lock/unlock. */
|
||||
@Input('adf-node-lock')
|
||||
node: MinimalNodeEntryEntity;
|
||||
|
||||
|
@@ -40,6 +40,12 @@ export class CustomResourcesService {
|
||||
private logService: LogService) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets files recently accessed by a user.
|
||||
* @param personId ID of the user
|
||||
* @param pagination Specifies how to paginate the results
|
||||
* @returns List of nodes for the recently used files
|
||||
*/
|
||||
getRecentFiles(personId: string, pagination: PaginationModel): Observable<NodePaging> {
|
||||
return new Observable(observer => {
|
||||
this.apiService.peopleApi.getPerson(personId)
|
||||
@@ -83,6 +89,12 @@ export class CustomResourcesService {
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets favorite files for the current user.
|
||||
* @param pagination Specifies how to paginate the results
|
||||
* @param includeFields List of data field names to include in the results
|
||||
* @returns List of favorite files
|
||||
*/
|
||||
loadFavorites(pagination: PaginationModel, includeFields: string[] = []): Observable<NodePaging> {
|
||||
let includeFieldsRequest = this.getIncludesFields(includeFields);
|
||||
|
||||
@@ -123,6 +135,11 @@ export class CustomResourcesService {
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets sites that the current user is a member of.
|
||||
* @param pagination Specifies how to paginate the results
|
||||
* @returns List of sites
|
||||
*/
|
||||
loadMemberSites(pagination: PaginationModel): Observable<NodePaging> {
|
||||
const options = {
|
||||
include: ['properties'],
|
||||
@@ -157,6 +174,11 @@ export class CustomResourcesService {
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all sites in the respository.
|
||||
* @param pagination Specifies how to paginate the results
|
||||
* @returns List of sites
|
||||
*/
|
||||
loadSites(pagination: PaginationModel): Observable<NodePaging> {
|
||||
const options = {
|
||||
include: ['properties'],
|
||||
@@ -183,6 +205,12 @@ export class CustomResourcesService {
|
||||
}).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all items currently in the trash.
|
||||
* @param pagination Specifies how to paginate the results
|
||||
* @param includeFields List of data field names to include in the results
|
||||
* @returns List of deleted items
|
||||
*/
|
||||
loadTrashcan(pagination: PaginationModel, includeFields: string[] = []): Observable<DeletedNodesPaging> {
|
||||
let includeFieldsRequest = this.getIncludesFields(includeFields);
|
||||
|
||||
@@ -196,6 +224,12 @@ export class CustomResourcesService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets shared links for the current user.
|
||||
* @param pagination Specifies how to paginate the results
|
||||
* @param includeFields List of data field names to include in the results
|
||||
* @returns List of shared links
|
||||
*/
|
||||
loadSharedLinks(pagination: PaginationModel, includeFields: string[] = []): Observable<NodePaging> {
|
||||
let includeFieldsRequest = this.getIncludesFields(includeFields);
|
||||
|
||||
@@ -208,6 +242,11 @@ export class CustomResourcesService {
|
||||
return Observable.fromPromise(this.apiService.sharedLinksApi.findSharedLinks(options)).catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the folder ID one of the well-known aliases?
|
||||
* @param folderId Folder ID name to check
|
||||
* @returns True if the ID is a well-known name, false otherwise
|
||||
*/
|
||||
isCustomSource(folderId: string): boolean {
|
||||
let isCustomSources = false;
|
||||
const sources = ['-trashcan-', '-sharedlinks-', '-sites-', '-mysites-', '-favorites-', '-recent-'];
|
||||
@@ -219,6 +258,13 @@ export class CustomResourcesService {
|
||||
return isCustomSources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a folder's contents.
|
||||
* @param nodeId ID of the target folder node
|
||||
* @param pagination Specifies how to paginate the results
|
||||
* @param includeFields List of data field names to include in the results
|
||||
* @returns List of items contained in the folder
|
||||
*/
|
||||
loadFolderByNodeId(nodeId: string, pagination: PaginationModel, includeFields: string[]): Observable<NodePaging> {
|
||||
if (nodeId === '-trashcan-') {
|
||||
return this.loadTrashcan(pagination, includeFields);
|
||||
@@ -236,6 +282,13 @@ export class CustomResourcesService {
|
||||
}
|
||||
|
||||
// TODO: remove it from here
|
||||
|
||||
/**
|
||||
* Gets the contents of one of the well-known aliases in the form of node ID strings.
|
||||
* @param nodeId ID of the target folder node
|
||||
* @param pagination Specifies how to paginate the results
|
||||
* @returns List of node IDs
|
||||
*/
|
||||
getCorrespondingNodeIds(nodeId: string, pagination: PaginationModel): Observable<string[]> {
|
||||
if (nodeId === '-trashcan-') {
|
||||
return Observable.fromPromise(this.apiService.nodesApi.getDeletedNodes()
|
||||
|
@@ -35,16 +35,19 @@ export class FolderCreateDirective {
|
||||
@Input('adf-create-folder')
|
||||
parentNodeId: string = DEFAULT_FOLDER_PARENT_ID;
|
||||
|
||||
/** Title of folder creation dialog. */
|
||||
@Input()
|
||||
title: string = null;
|
||||
|
||||
/** Type of node to create. */
|
||||
@Input()
|
||||
nodeType = 'cm:folder';
|
||||
|
||||
/** Emitted when the create folder give error for example a folder with same name already exist */
|
||||
/** Emitted when an error occurs (eg, a folder with same name already exists). */
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
/** Emitted when the folder is created successfully. */
|
||||
@Output()
|
||||
success: EventEmitter<MinimalNodeEntryEntity> = new EventEmitter<MinimalNodeEntryEntity>();
|
||||
|
||||
|
@@ -35,13 +35,15 @@ export class FolderEditDirective {
|
||||
@Input('adf-edit-folder')
|
||||
folder: MinimalNodeEntryEntity;
|
||||
|
||||
/** Emitted when the edit/create folder give error for example a folder with same name already exist */
|
||||
/** Emitted when an error occurs (eg, a folder with same name already exists). */
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
/** Title of folder edit dialog. */
|
||||
@Input()
|
||||
title: string = null;
|
||||
|
||||
/** Emitted when the folder has been edited successfully. */
|
||||
@Output()
|
||||
success: EventEmitter<MinimalNodeEntryEntity> = new EventEmitter<MinimalNodeEntryEntity>();
|
||||
|
||||
|
@@ -29,9 +29,11 @@ import { NodePermissionService } from '../../services/node-permission.service';
|
||||
})
|
||||
export class PermissionListComponent implements OnInit {
|
||||
|
||||
/** ID of the node whose permissions you want to show. */
|
||||
@Input()
|
||||
nodeId: string = '';
|
||||
|
||||
/** Emitted when the permission is updated. */
|
||||
@Output()
|
||||
update: EventEmitter<PermissionElement> = new EventEmitter();
|
||||
|
||||
|
@@ -31,6 +31,11 @@ export class NodePermissionService {
|
||||
private nodeService: NodesApiService) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of roles for the current node.
|
||||
* @param node The target node
|
||||
* @returns Array of strings representing the roles
|
||||
*/
|
||||
getNodeRoles(node: MinimalNodeEntryEntity): Observable<string[]> {
|
||||
const retrieveSiteQueryBody: QueryBody = this.buildRetrieveSiteQueryBody(node.path.elements);
|
||||
return this.searchApiService.searchByQueryBody(retrieveSiteQueryBody)
|
||||
@@ -44,7 +49,14 @@ export class NodePermissionService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the permission for a node.
|
||||
* @param node Target node
|
||||
* @param updatedPermissionRole Permission role to update or add
|
||||
* @returns Node with updated permission
|
||||
*/
|
||||
updatePermissionRole(node: MinimalNodeEntryEntity, updatedPermissionRole: PermissionElement): Observable<MinimalNodeEntryEntity> {
|
||||
|
||||
let permissionBody = { permissions: { locallySet: []} };
|
||||
const index = node.permissions.locallySet.map((permission) => permission.authorityId).indexOf(updatedPermissionRole.authorityId);
|
||||
permissionBody.permissions.locallySet = permissionBody.permissions.locallySet.concat(node.permissions.locallySet);
|
||||
@@ -109,6 +121,12 @@ export class NodePermissionService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all members related to a group name.
|
||||
* @param groupName Name of group to look for members
|
||||
* @param opts Extra options supported by JSAPI
|
||||
* @returns List of members
|
||||
*/
|
||||
getGroupMemeberByGroupName(groupName: string, opts?: any): Observable<GroupMemberPaging> {
|
||||
return Observable.fromPromise(this.apiService.groupsApi.getGroupMembers(groupName, opts));
|
||||
}
|
||||
|
Reference in New Issue
Block a user