mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-1769] Added JSDocs for services (#2949)
This commit is contained in:
committed by
Eugenio Romano
parent
8bfac2f9f8
commit
9887d8bca4
@@ -26,12 +26,23 @@ export class NotificationService {
|
||||
constructor(public snackbar: MatSnackBar) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a snackbar notification to show a message.
|
||||
* @param message The message to show
|
||||
* @param millisecondsDuration Time before notification disappears after being shown
|
||||
*/
|
||||
public openSnackMessage(message: string, millisecondsDuration?: number): MatSnackBarRef<any> {
|
||||
return this.snackbar.open(message, null, {
|
||||
duration: millisecondsDuration || NotificationService.DEFAULT_DURATION_MESSAGE
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a snackbar notification with a message and a response button.
|
||||
* @param message The message to show
|
||||
* @param action Caption for the response button
|
||||
* @param millisecondsDuration Time before the notification disappears (unless the button is clicked)
|
||||
*/
|
||||
public openSnackMessageAction(message: string, action: string, millisecondsDuration?: number): MatSnackBarRef<any> {
|
||||
return this.snackbar.open(message, action, {
|
||||
duration: millisecondsDuration || NotificationService.DEFAULT_DURATION_MESSAGE
|
||||
|
@@ -26,6 +26,10 @@ export class PageTitleService {
|
||||
private titleService: Title,
|
||||
private appConfig: AppConfigService) {}
|
||||
|
||||
/**
|
||||
* Sets the page title.
|
||||
* @param value The new title
|
||||
*/
|
||||
setTitle(value: string = '') {
|
||||
const name = this.appConfig.get('application.name') || 'Alfresco ADF Application';
|
||||
const title = value ? `${value} - ${name}` : `${name}`;
|
||||
|
@@ -29,6 +29,10 @@ export class PeopleContentService {
|
||||
return this.apiService.getInstance().core.peopleApi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information about a user identified by their username.
|
||||
* @param personId ID of the target user
|
||||
*/
|
||||
getPerson(personId: string): Observable<any> {
|
||||
const { peopleApi, handleError } = this;
|
||||
const promise = peopleApi.getPerson(personId);
|
||||
@@ -38,6 +42,7 @@ export class PeopleContentService {
|
||||
.catch(handleError);
|
||||
}
|
||||
|
||||
/** Gets information about the user who is currently logged-in. */
|
||||
getCurrentPerson(): Observable<any> {
|
||||
return this.getPerson('-me-');
|
||||
}
|
||||
|
@@ -31,6 +31,11 @@ export class PeopleProcessService {
|
||||
private logService: LogService) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information about users across all tasks.
|
||||
* @param taskId ID of the task
|
||||
* @param searchWord Filter text to search for
|
||||
*/
|
||||
getWorkflowUsers(taskId?: string, searchWord?: string): Observable<UserProcessModel[]> {
|
||||
let option = { excludeTaskId: taskId, filter: searchWord };
|
||||
return Observable.fromPromise(this.getWorkflowUserApi(option))
|
||||
@@ -38,16 +43,30 @@ export class PeopleProcessService {
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the profile picture URL for the specified user.
|
||||
* @param user The target user
|
||||
*/
|
||||
getUserImage(user: UserProcessModel): string {
|
||||
return this.getUserProfileImageApi(user.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a user to be involved with a task.
|
||||
* @param taskId ID of the target task
|
||||
* @param idToInvolve ID of the user to involve
|
||||
*/
|
||||
involveUserWithTask(taskId: string, idToInvolve: string): Observable<UserProcessModel[]> {
|
||||
let node = {userId: idToInvolve};
|
||||
return Observable.fromPromise(this.involveUserToTaskApi(taskId, node))
|
||||
.catch(err => this.handleError(err));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a user who is currently involved with a task.
|
||||
* @param taskId ID of the target task
|
||||
* @param idToRemove ID of the user to remove
|
||||
*/
|
||||
removeInvolvedUser(taskId: string, idToRemove: string): Observable<UserProcessModel[]> {
|
||||
let node = {userId: idToRemove};
|
||||
return Observable.fromPromise(this.removeInvolvedUserFromTaskApi(taskId, node))
|
||||
|
@@ -33,6 +33,10 @@ export class SharedLinksApiService {
|
||||
return this.apiService.getInstance().core.sharedlinksApi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets shared links available to the current user.
|
||||
* @param options Options supported by JSAPI
|
||||
*/
|
||||
getSharedLinks(options: any = {}): Observable<NodePaging> {
|
||||
const { sharedLinksApi, handleError } = this;
|
||||
const defaultOptions = {
|
||||
|
@@ -29,6 +29,10 @@ export class SitesService {
|
||||
constructor(
|
||||
private apiService: AlfrescoApiService) { }
|
||||
|
||||
/**
|
||||
* Gets a list of all sites in the repository.
|
||||
* @param opts Options supported by JSAPI
|
||||
*/
|
||||
getSites(opts: any = {}): Observable<SitePaging> {
|
||||
const defaultOptions = {
|
||||
skipCount: 0,
|
||||
@@ -39,11 +43,21 @@ export class SitesService {
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the details for a site.
|
||||
* @param siteId ID of the target site
|
||||
* @param opts Options supported by JSAPI
|
||||
*/
|
||||
getSite(siteId: string, opts?: any): Observable<SiteEntry> {
|
||||
return Observable.fromPromise(this.apiService.getInstance().core.sitesApi.getSite(siteId, opts))
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a site.
|
||||
* @param siteId Site to delete
|
||||
* @param permanentFlag True: deletion is permanent; False: site is moved to the trash
|
||||
*/
|
||||
deleteSite(siteId: string, permanentFlag: boolean = true): Observable<any> {
|
||||
let options: any = {};
|
||||
options.permanent = permanentFlag;
|
||||
@@ -51,10 +65,18 @@ export class SitesService {
|
||||
.catch(this.handleError));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a site's content.
|
||||
* @param siteId ID of the target site
|
||||
*/
|
||||
getSiteContent(siteId: string): Observable<SiteEntry> {
|
||||
return this.getSite(siteId, { relations: ['containers'] });
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of all a site's members.
|
||||
* @param siteId ID of the target site
|
||||
*/
|
||||
getSiteMembers(siteId: string): Observable<SiteEntry> {
|
||||
return this.getSite(siteId, { relations: ['members'] });
|
||||
}
|
||||
|
@@ -27,6 +27,10 @@ export class StorageService {
|
||||
this.useLocalStorage = this.storageAvailable('localStorage');
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an item.
|
||||
* @param key Key to identify the item
|
||||
*/
|
||||
getItem(key: string): string | null {
|
||||
if (this.useLocalStorage) {
|
||||
return localStorage.getItem(key);
|
||||
@@ -35,6 +39,11 @@ export class StorageService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores an item
|
||||
* @param key Key to identify the item
|
||||
* @param data Data to store
|
||||
*/
|
||||
setItem(key: string, data: string) {
|
||||
if (this.useLocalStorage) {
|
||||
localStorage.setItem(key, data);
|
||||
@@ -43,6 +52,7 @@ export class StorageService {
|
||||
}
|
||||
}
|
||||
|
||||
/** Removes all currently stored items. */
|
||||
clear() {
|
||||
if (this.useLocalStorage) {
|
||||
localStorage.clear();
|
||||
@@ -51,6 +61,10 @@ export class StorageService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a single item.
|
||||
* @param key Key to identify the item
|
||||
*/
|
||||
removeItem(key: string) {
|
||||
if (this.useLocalStorage) {
|
||||
localStorage.removeItem(key);
|
||||
@@ -59,6 +73,10 @@ export class StorageService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is any item currently stored under `key`?
|
||||
* @param key Key identifying item to check
|
||||
*/
|
||||
hasItem(key: string): boolean {
|
||||
if (this.useLocalStorage) {
|
||||
return localStorage.getItem(key) ? true : false;
|
||||
|
Reference in New Issue
Block a user