diff --git a/lib/process-services/src/lib/app-list/apps-list.component.spec.ts b/lib/process-services/src/lib/app-list/apps-list.component.spec.ts index d91baf2324..158c7bd6ee 100644 --- a/lib/process-services/src/lib/app-list/apps-list.component.spec.ts +++ b/lib/process-services/src/lib/app-list/apps-list.component.spec.ts @@ -25,6 +25,7 @@ import { defaultApp, deployedApps, nonDeployedApps } from '../mock/apps-list.moc import { AppsListComponent, APP_LIST_LAYOUT_GRID, APP_LIST_LAYOUT_LIST } from './apps-list.component'; import { ProcessTestingModule } from '../testing/process.testing.module'; import { TranslateModule } from '@ngx-translate/core'; +import { AppDefinitionRepresentationModel } from '../task-list'; describe('AppsListComponent', () => { @@ -153,7 +154,7 @@ describe('AppsListComponent', () => { const appDataMock = { defaultAppId: 'tasks', name: null - }; + } as AppDefinitionRepresentationModel; component.getAppName(appDataMock).subscribe((name) => { expect(name).toBe('ADF_TASK_LIST.APPS.TASK_APP_NAME'); }); @@ -163,7 +164,7 @@ describe('AppsListComponent', () => { const appDataMock = { defaultAppId: 'uiu', name: 'the-name' - }; + } as AppDefinitionRepresentationModel; component.getAppName(appDataMock).subscribe((name) => { expect(name).toBe(appDataMock.name); diff --git a/lib/process-services/src/lib/app-list/apps-list.component.ts b/lib/process-services/src/lib/app-list/apps-list.component.ts index 85514e700b..c5f22a0166 100644 --- a/lib/process-services/src/lib/app-list/apps-list.component.ts +++ b/lib/process-services/src/lib/app-list/apps-list.component.ts @@ -43,7 +43,8 @@ export class AppsListComponent implements OnInit, AfterContentInit, OnDestroy { @ContentChild(CustomEmptyContentTemplateDirective) emptyCustomContent: CustomEmptyContentTemplateDirective; - /** (**required**) Defines the layout of the apps. There are two possible + /** + * Defines the layout of the apps. There are two possible * values, "GRID" and "LIST". */ @Input() @@ -102,11 +103,11 @@ export class AppsListComponent implements OnInit, AfterContentInit, OnDestroy { } } - isDefaultApp(app) { + isDefaultApp(app: AppDefinitionRepresentationModel) { return app.defaultAppId === DEFAULT_TASKS_APP; } - getAppName(app) { + getAppName(app: AppDefinitionRepresentationModel) { return this.isDefaultApp(app) ? this.translationService.get(DEFAULT_TASKS_APP_NAME) : of(app.name); @@ -115,7 +116,7 @@ export class AppsListComponent implements OnInit, AfterContentInit, OnDestroy { /** * Pass the selected app as next * - * @param app + * @param app application model */ selectApp(app: AppDefinitionRepresentationModel) { this.currentApp = app; @@ -125,7 +126,8 @@ export class AppsListComponent implements OnInit, AfterContentInit, OnDestroy { /** * Return true if the appId is the current app * - * @param appId + * @param appId application id + * @returns `true` if application is selected, otherwise `false` */ isSelected(appId: number): boolean { return (this.currentApp !== undefined && appId === this.currentApp.id); @@ -133,6 +135,8 @@ export class AppsListComponent implements OnInit, AfterContentInit, OnDestroy { /** * Check if the value of the layoutType property is an allowed value + * + * @returns `true` if layout type is valid, otherwise `false` */ isValidType(): boolean { return this.layoutType && (this.layoutType === APP_LIST_LAYOUT_LIST || this.layoutType === APP_LIST_LAYOUT_GRID); @@ -146,14 +150,18 @@ export class AppsListComponent implements OnInit, AfterContentInit, OnDestroy { } /** - * Return true if the layout type is LIST + * Check if the layout type is LIST + * + * @returns `true` if current layout is in the list mode, otherwise `false` */ isList(): boolean { return this.layoutType === APP_LIST_LAYOUT_LIST; } /** - * Return true if the layout type is GRID + * Check if the layout type is GRID + * + * @returns `true` if current layout is in the grid mode, otherwise `false` */ isGrid(): boolean { return this.layoutType === APP_LIST_LAYOUT_GRID; diff --git a/lib/process-services/src/lib/attachment/create-process-attachment.component.ts b/lib/process-services/src/lib/attachment/create-process-attachment.component.ts index ec1750e3a5..0dbf2d8b7f 100644 --- a/lib/process-services/src/lib/attachment/create-process-attachment.component.ts +++ b/lib/process-services/src/lib/attachment/create-process-attachment.component.ts @@ -28,13 +28,15 @@ export class CreateProcessAttachmentComponent implements OnChanges { @Input() processInstanceId: string; - /** Emitted when an error occurs while creating or uploading an attachment + /** + * Emitted when an error occurs while creating or uploading an attachment * from the user within the component. */ @Output() error: EventEmitter = new EventEmitter(); - /** Emitted when an attachment is successfully created or uploaded + /** + * Emitted when an attachment is successfully created or uploaded * from within the component. */ @Output() diff --git a/lib/process-services/src/lib/attachment/create-task-attachment.component.ts b/lib/process-services/src/lib/attachment/create-task-attachment.component.ts index 7850285f6d..9a99a26a33 100644 --- a/lib/process-services/src/lib/attachment/create-task-attachment.component.ts +++ b/lib/process-services/src/lib/attachment/create-task-attachment.component.ts @@ -28,13 +28,15 @@ export class AttachmentComponent implements OnChanges { @Input() taskId: string; - /** Emitted when an error occurs while creating or uploading an + /** + * Emitted when an error occurs while creating or uploading an * attachment from the user within the component. */ @Output() error: EventEmitter = new EventEmitter(); - /** Emitted when an attachment is created or uploaded successfully + /** + * Emitted when an attachment is created or uploaded successfully * from within the component. */ @Output() diff --git a/lib/process-services/src/lib/attachment/process-attachment-list.component.ts b/lib/process-services/src/lib/attachment/process-attachment-list.component.ts index 1dcd62794c..42f8c3c4f9 100644 --- a/lib/process-services/src/lib/attachment/process-attachment-list.component.ts +++ b/lib/process-services/src/lib/attachment/process-attachment-list.component.ts @@ -48,7 +48,8 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn @Input() disabled: boolean = false; - /** Emitted when the attachment is double-clicked or the + /** + * Emitted when the attachment is double-clicked or the * view option is selected from the context menu by the user from * within the component. Returns a Blob representing the object * that was clicked. @@ -56,13 +57,15 @@ export class ProcessAttachmentListComponent implements OnChanges, AfterContentIn @Output() attachmentClick = new EventEmitter(); - /** Emitted when the attachment list has fetched all the attachments. + /** + * Emitted when the attachment list has fetched all the attachments. * Returns a list of attachments. */ @Output() success = new EventEmitter(); - /** Emitted when the attachment list is not able to fetch the attachments + /** + * Emitted when the attachment list is not able to fetch the attachments * (eg, following a network error). */ @Output() diff --git a/lib/process-services/src/lib/attachment/task-attachment-list.component.ts b/lib/process-services/src/lib/attachment/task-attachment-list.component.ts index da84618ba9..3944a9b944 100644 --- a/lib/process-services/src/lib/attachment/task-attachment-list.component.ts +++ b/lib/process-services/src/lib/attachment/task-attachment-list.component.ts @@ -48,14 +48,16 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit @Input() disabled: boolean = false; - /** Emitted when the attachment is double-clicked or a view + /** + * Emitted when the attachment is double-clicked or a view * option is selected from the context menu by the user from within the component. * Returns a Blob representing the clicked object. */ @Output() attachmentClick = new EventEmitter(); - /** Emitted when the attachment list has fetched all the attachments. + /** + * Emitted when the attachment list has fetched all the attachments. * Returns a list of attachments. */ @Output() diff --git a/lib/process-services/src/lib/common/services/people-process.service.ts b/lib/process-services/src/lib/common/services/people-process.service.ts index 6e16766729..573159a824 100644 --- a/lib/process-services/src/lib/common/services/people-process.service.ts +++ b/lib/process-services/src/lib/common/services/people-process.service.ts @@ -106,6 +106,7 @@ export class PeopleProcessService { * * @param taskId ID of the task * @param searchWord Filter text to search for + * @param groupId group id * @returns Array of user information objects */ getWorkflowUsers(taskId?: string, searchWord?: string, groupId?: string): Observable { diff --git a/lib/process-services/src/lib/form/form.component.ts b/lib/process-services/src/lib/form/form.component.ts index 7141a24daf..b7c4dfa11f 100644 --- a/lib/process-services/src/lib/form/form.component.ts +++ b/lib/process-services/src/lib/form/form.component.ts @@ -305,6 +305,7 @@ export class FormComponent extends FormBaseComponent implements OnInit, OnDestro * Get custom set of outcomes for a Form Definition. * * @param form Form definition model. + * @returns list of form outcomes */ getFormDefinitionOutcomes(form: FormModel): FormOutcomeModel[] { return [new FormOutcomeModel(form, { id: '$save', name: FormOutcomeModel.SAVE_ACTION, isSystem: true })]; diff --git a/lib/process-services/src/lib/form/services/activiti-alfresco.service.ts b/lib/process-services/src/lib/form/services/activiti-alfresco.service.ts index 49d84cc09b..674e1525c4 100644 --- a/lib/process-services/src/lib/form/services/activiti-alfresco.service.ts +++ b/lib/process-services/src/lib/form/services/activiti-alfresco.service.ts @@ -15,10 +15,10 @@ * limitations under the License. */ -import { AlfrescoApiService, LogService, ExternalContent, ExternalContentLink } from '@alfresco/adf-core'; +import { AlfrescoApiService, LogService, ExternalContent } from '@alfresco/adf-core'; import { SitesService } from '@alfresco/adf-content-services'; import { Injectable } from '@angular/core'; -import { IntegrationAlfrescoOnPremiseApi, Node, RelatedContentRepresentation, ActivitiContentApi } from '@alfresco/js-api'; +import { IntegrationAlfrescoOnPremiseApi, Node, RelatedContentRepresentation, ActivitiContentApi, AlfrescoEndpointRepresentation, AlfrescoContentRepresentation } from '@alfresco/js-api'; import { Observable, from, throwError } from 'rxjs'; import { map, catchError } from 'rxjs/operators'; @@ -47,13 +47,14 @@ export class ActivitiContentService { /** * Returns a list of child nodes below the specified folder * - * @param accountId - * @param folderId + * @param accountId account id + * @param folderId folder id + * @returns list of external content instances */ - getAlfrescoNodes(accountId: string, folderId: string): Observable<[ExternalContent]> { + getAlfrescoNodes(accountId: string, folderId: string): Observable { const accountShortId = accountId.replace('alfresco-', ''); return from(this.integrationAlfrescoOnPremiseApi.getContentInFolder(accountShortId, folderId)).pipe( - map(this.toJsonArray), + map(res => res?.data || []), catchError((err) => this.handleError(err)) ); } @@ -61,16 +62,17 @@ export class ActivitiContentService { /** * Returns a list of all the repositories configured * - * @param tenantId - * @param includeAccount + * @param tenantId tenant id + * @param includeAccount include accounts + * @returns list of endpoints */ - getAlfrescoRepositories(tenantId?: string, includeAccount?: boolean): Observable { + getAlfrescoRepositories(tenantId?: string, includeAccount?: boolean): Observable { const opts = { tenantId, includeAccounts: includeAccount ? includeAccount : true }; return from(this.integrationAlfrescoOnPremiseApi.getRepositories(opts)).pipe( - map(this.toJsonArray), + map(res => res?.data || []), catchError((err) => this.handleError(err)) ); } @@ -78,11 +80,12 @@ export class ActivitiContentService { /** * Returns a list of child nodes below the specified folder * - * @param accountId - * @param node - * @param siteId + * @param accountId account id + * @param node node details + * @param siteId site id + * @returns link to external content */ - linkAlfrescoNode(accountId: string, node: ExternalContent, siteId: string): Observable { + linkAlfrescoNode(accountId: string, node: ExternalContent, siteId: string): Observable { return from( this.contentApi.createTemporaryRelatedContent({ link: true, @@ -92,12 +95,12 @@ export class ActivitiContentService { sourceId: node.id + '@' + siteId }) ).pipe( - map(this.toJson), + map(res => res || {}), catchError((err) => this.handleError(err)) ); } - applyAlfrescoNode(node: Node, siteId: string, accountId: string) { + applyAlfrescoNode(node: Node, siteId: string, accountId: string): Observable { const currentSideId = siteId ? siteId : this.sitesService.getSiteNameFromNodePath(node); const params: RelatedContentRepresentation = { source: accountId, @@ -107,26 +110,12 @@ export class ActivitiContentService { link: node.isLink }; return from(this.contentApi.createTemporaryRelatedContent(params)).pipe( - map(this.toJson), + map(res => res || {}), catchError((err) => this.handleError(err)) ); } - toJson(res: any) { - if (res) { - return res || {}; - } - return {}; - } - - toJsonArray(res: any) { - if (res) { - return res.data || []; - } - return []; - } - - handleError(error: any): Observable { + private handleError(error: any): Observable { let errMsg = ActivitiContentService.UNKNOWN_ERROR_MESSAGE; if (error) { errMsg = error.message diff --git a/lib/process-services/src/lib/form/services/process-content.service.ts b/lib/process-services/src/lib/form/services/process-content.service.ts index 10eb12c7a9..8703dd6850 100644 --- a/lib/process-services/src/lib/form/services/process-content.service.ts +++ b/lib/process-services/src/lib/form/services/process-content.service.ts @@ -190,7 +190,7 @@ export class ProcessContentService { * @param source - source of the document that workflow or task has been started with * @param size - size of the entries to get * @param page - page number - * @return Promise + * @returns Promise */ getProcessesAndTasksOnContent(sourceId: string, source: string, size?: number, page?: number): Observable { return from(this.contentApi.getProcessesAndTasksOnContent(sourceId, source, size, page)).pipe(catchError((err) => this.handleError(err))); diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.ts index b613ba7e0b..fd42e41e3c 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.ts @@ -44,6 +44,7 @@ export class AttachFileWidgetDialogService { * * @param repository Alfresco endpoint that represents the content service * @param currentFolderId Upload file from specific folder + * @param accountIdentifier account identifier * @returns Information about the chosen file(s) */ openLogin(repository: AlfrescoEndpointRepresentation, currentFolderId = '-my-', accountIdentifier?: string): Observable { diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.ts index a70c671376..c75fe739c6 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.ts @@ -222,14 +222,14 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements private uploadFileFromExternalCS(repository: AlfrescoEndpointRepresentation, currentFolderId?: string) { const accountIdentifier = `alfresco-${repository.id}-${repository.name}`; - this.attachDialogService.openLogin(repository, currentFolderId, accountIdentifier).subscribe((selections: any[]) => { - selections.forEach((node) => (node.isExternal = true)); + this.attachDialogService.openLogin(repository, currentFolderId, accountIdentifier).subscribe((selections) => { + selections.forEach((node) => (node['isExternal'] = true)); this.tempFilesList.push(...selections); this.uploadFileFromCS(selections, accountIdentifier); }); } - private uploadFileFromCS(fileNodeList: any[], accountId: string, siteId?: string) { + private uploadFileFromCS(fileNodeList: Node[], accountId: string, siteId?: string) { const filesSaved = []; fileNodeList.forEach((node) => { @@ -239,13 +239,13 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements from(fileNodeList) .pipe( mergeMap((node) => - zip(of(node?.content?.mimeType), this.activitiContentService.applyAlfrescoNode(node, siteId, accountId), of(node.isExternal)) + zip(of(node?.content?.mimeType), this.activitiContentService.applyAlfrescoNode(node, siteId, accountId), of(node['isExternal'])) ) ) .subscribe( ([mimeType, res, isExternal]) => { res.mimeType = mimeType; - res.isExternal = isExternal; + res['isExternal'] = isExternal; filesSaved.push(res); }, (error) => { diff --git a/lib/process-services/src/lib/form/widgets/document/content.widget.ts b/lib/process-services/src/lib/form/widgets/document/content.widget.ts index 5da67ea42f..cb5fd45d1e 100644 --- a/lib/process-services/src/lib/form/widgets/document/content.widget.ts +++ b/lib/process-services/src/lib/form/widgets/document/content.widget.ts @@ -123,6 +123,8 @@ export class ContentWidgetComponent implements OnChanges { /** * Invoke content download. + * + * @param content content link model */ download(content: ContentLinkModel): void { this.processContentService.getFileRawContent(content.id).subscribe( diff --git a/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts b/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts index 03635d4ed1..ffa922c2c2 100644 --- a/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts @@ -58,6 +58,9 @@ describe('PeopleSearchComponent', () => { fixture.detectChanges(); }); + /** + * trigger search + */ function triggerSearch() { searchInput = element.querySelector('#userSearchText'); searchInput.value = 'fake-search'; diff --git a/lib/process-services/src/lib/process-comments/services/comment-process.service.ts b/lib/process-services/src/lib/process-comments/services/comment-process.service.ts index 1dbec8bdda..f65bea2563 100644 --- a/lib/process-services/src/lib/process-comments/services/comment-process.service.ts +++ b/lib/process-services/src/lib/process-comments/services/comment-process.service.ts @@ -43,7 +43,7 @@ export class CommentProcessService implements CommentsService { /** * Gets all comments that have been added to a process instance. * - * @param processInstanceId ID of the target process instance + * @param id ID of the target process instance * @returns Details for each comment */ get(id: string): Observable { @@ -69,7 +69,7 @@ export class CommentProcessService implements CommentsService { /** * Adds a comment to a process instance. * - * @param processInstanceId ID of the target process instance + * @param id ID of the target process instance * @param message Text for the comment * @returns Details of the comment added */ diff --git a/lib/process-services/src/lib/process-list/components/process-audit.directive.ts b/lib/process-services/src/lib/process-list/components/process-audit.directive.ts index 2f657a947d..4113214546 100644 --- a/lib/process-services/src/lib/process-list/components/process-audit.directive.ts +++ b/lib/process-services/src/lib/process-list/components/process-audit.directive.ts @@ -58,10 +58,6 @@ export class ProcessAuditDirective implements OnChanges { @Output() error: EventEmitter = new EventEmitter(); - /** - * @param downloadService - * @param processListService - */ constructor(private downloadService: DownloadService, private processListService: ProcessService) { } diff --git a/lib/process-services/src/lib/process-list/components/process-filters.component.ts b/lib/process-services/src/lib/process-list/components/process-filters.component.ts index 9ebe86782f..cf0de33aa1 100644 --- a/lib/process-services/src/lib/process-list/components/process-filters.component.ts +++ b/lib/process-services/src/lib/process-list/components/process-filters.component.ts @@ -33,7 +33,8 @@ import { Location } from '@angular/common'; encapsulation: ViewEncapsulation.None }) export class ProcessFiltersComponent implements OnInit, OnChanges, OnDestroy { - /** The parameters to filter the task filter. If there is no match then the default one + /** + * The parameters to filter the task filter. If there is no match then the default one * (ie, the first filter in the list) is selected. */ @Input() @@ -155,9 +156,9 @@ export class ProcessFiltersComponent implements OnInit, OnChanges, OnDestroy { /** * Return the filter list filtered by appName * - * @param appName + * @param appName application name */ - getFiltersByAppName(appName: string) { + getFiltersByAppName(appName: string): void { this.appsProcessService.getDeployedApplicationsByName(appName).subscribe( (application) => { this.getFiltersByAppId(application.id); @@ -172,7 +173,7 @@ export class ProcessFiltersComponent implements OnInit, OnChanges, OnDestroy { /** * Pass the selected filter as next * - * @param filterModel + * @param filterModel filter model */ selectFilter(filterModel: ProcessInstanceFilterRepresentation) { this.currentFilter = filterModel; @@ -182,8 +183,10 @@ export class ProcessFiltersComponent implements OnInit, OnChanges, OnDestroy { /** * Select the first filter of a list if present + * + * @param filterParam filter parameter */ - selectProcessFilter(filterParam: FilterProcessRepresentationModel) { + selectProcessFilter(filterParam: FilterProcessRepresentationModel): void { if (filterParam) { const newFilter = this.filters.find( (processFilter, index) => @@ -219,7 +222,9 @@ export class ProcessFiltersComponent implements OnInit, OnChanges, OnDestroy { } /** - * Return the current task + * Get the current task + * + * @returns process instance filter */ getCurrentFilter(): ProcessInstanceFilterRepresentation { return this.currentFilter; @@ -227,13 +232,18 @@ export class ProcessFiltersComponent implements OnInit, OnChanges, OnDestroy { /** * Check if the filter list is empty + * + * @returns `true` if filter list is empty, otherwise `false` */ isFilterListEmpty(): boolean { return this.filters === undefined || (this.filters && this.filters.length === 0); } /** - * Return current filter icon + * Get the material icons equivalent of the glyphicon icon + * + * @param icon glyphicon name + * @returns material icons equivalent of the icon */ getFilterIcon(icon: string): string { return this.iconsMDL.mapGlyphiconToMaterialDesignIcons(icon); diff --git a/lib/process-services/src/lib/process-list/components/process-instance-details.component.ts b/lib/process-services/src/lib/process-list/components/process-instance-details.component.ts index 9e549ad7a1..a05be48826 100644 --- a/lib/process-services/src/lib/process-list/components/process-instance-details.component.ts +++ b/lib/process-services/src/lib/process-list/components/process-instance-details.component.ts @@ -67,12 +67,6 @@ export class ProcessInstanceDetailsComponent implements OnChanges { processInstanceDetails: ProcessInstance; - /** - * Constructor - * - * @param activitiProcess Process service - * @param logService - */ constructor(private activitiProcess: ProcessService, private logService: LogService) {} ngOnChanges(changes: SimpleChanges) { diff --git a/lib/process-services/src/lib/process-list/components/process-instance-tasks.component.ts b/lib/process-services/src/lib/process-list/components/process-instance-tasks.component.ts index ee3cdb19ff..7111122650 100644 --- a/lib/process-services/src/lib/process-list/components/process-instance-tasks.component.ts +++ b/lib/process-services/src/lib/process-list/components/process-instance-tasks.component.ts @@ -31,11 +31,12 @@ import { share, takeUntil } from 'rxjs/operators'; styleUrls: ['./process-instance-tasks.component.css'] }) export class ProcessInstanceTasksComponent implements OnInit, OnChanges, OnDestroy { - /** (**required**) The ID of the process instance to display tasks for. */ + /** The ID of the process instance to display tasks for. */ @Input() processInstanceDetails: ProcessInstance; - /** Toggles whether to show a refresh button next to the list of tasks to allow + /** + * Toggles whether to show a refresh button next to the list of tasks to allow * it to be updated from the server. */ @Input() diff --git a/lib/process-services/src/lib/process-list/components/process-list.component.ts b/lib/process-services/src/lib/process-list/components/process-list.component.ts index ad35501819..eb7b88e540 100644 --- a/lib/process-services/src/lib/process-list/components/process-list.component.ts +++ b/lib/process-services/src/lib/process-list/components/process-list.component.ts @@ -68,7 +68,8 @@ export class ProcessInstanceListComponent extends DataTableSchema implements OnC @Input() state: string; - /** Defines the sort ordering of the list. Possible values are `created-desc`, `created-asc`, + /** + * Defines the sort ordering of the list. Possible values are `created-desc`, `created-asc`, * `ended-desc`, `ended-asc`. */ @Input() @@ -90,7 +91,8 @@ export class ProcessInstanceListComponent extends DataTableSchema implements OnC @Input() multiselect: boolean = false; - /** Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, + /** + * Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, * you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for * multiple rows. */ @@ -199,7 +201,9 @@ export class ProcessInstanceListComponent extends DataTableSchema implements OnC } /** - * Return the current id + * Get the id of the current instance + * + * @returns instance id */ getCurrentId(): string { return this.currentInstanceId; @@ -207,6 +211,8 @@ export class ProcessInstanceListComponent extends DataTableSchema implements OnC /** * Check if the list is empty + * + * @returns `true` if list is empty, otherwise `false` */ isListEmpty(): boolean { return !this.rows || this.rows.length === 0; @@ -215,7 +221,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements OnC /** * Emit the event rowClick passing the current task id when the row is clicked * - * @param event + * @param event input event */ onRowClick(event: DataRowEvent) { const item = event; @@ -227,7 +233,7 @@ export class ProcessInstanceListComponent extends DataTableSchema implements OnC /** * Emit the event rowClick passing the current task id when pressed the Enter key on the selected row * - * @param event + * @param event keyboard event */ onRowKeyUp(event: CustomEvent) { if (event.detail.keyboardEvent.key === 'Enter') { diff --git a/lib/process-services/src/lib/process-list/components/start-process.component.spec.ts b/lib/process-services/src/lib/process-list/components/start-process.component.spec.ts index faa7044c1e..18e84bdc33 100644 --- a/lib/process-services/src/lib/process-list/components/start-process.component.spec.ts +++ b/lib/process-services/src/lib/process-list/components/start-process.component.spec.ts @@ -64,6 +64,11 @@ describe('StartProcessComponent', () => { } }; + /** + * Change application id + * + * @param appId application id + */ function changeAppId(appId: number) { const change = new SimpleChange(null, appId, true); component.appId = appId; @@ -82,7 +87,7 @@ describe('StartProcessComponent', () => { startProcessSpy = spyOn(processService, 'startProcess').and.returnValue(of(newProcess)); getStartFormDefinitionSpy = spyOn(processService, 'getStartFormDefinition').and.returnValue(of(taskFormMock)); applyAlfrescoNodeSpy = spyOn(activitiContentService, 'applyAlfrescoNode').and.returnValue(of({ id: 1234 })); - spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of([{ id: '1', name: 'fake-repo-name' }])); + spyOn(activitiContentService, 'getAlfrescoRepositories').and.returnValue(of([{ id: '1', name: 'fake-repo-name' } as any])); }); afterEach(() => { diff --git a/lib/process-services/src/lib/process-list/components/start-process.component.ts b/lib/process-services/src/lib/process-list/components/start-process.component.ts index 7e69b5c568..e977300849 100644 --- a/lib/process-services/src/lib/process-list/components/start-process.component.ts +++ b/lib/process-services/src/lib/process-list/components/start-process.component.ts @@ -41,21 +41,23 @@ const MAX_LENGTH = 255; encapsulation: ViewEncapsulation.None }) export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestroy { - /** (optional) Limit the list of processes that can be started to those + /** + * Limit the list of processes that can be started to those * contained in the specified app. */ @Input() - appId: number; + appId?: number; - /** (optional) Define the header of the component. */ + /** Define the header of the component. */ @Input() - title: string; + title?: string; - /** (optional) Definition name of the process to start. */ + /** Definition name of the process to start. */ @Input() - processDefinitionName: string; + processDefinitionName?: string; - /** Variables in the input to the process + /** + * Variables in the input to the process * [RestVariable](https://github.com/Alfresco/alfresco-js-api/tree/master/src/alfresco-activiti-rest-api/docs/RestVariable.md). */ @Input() @@ -65,21 +67,21 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit, OnDestr @Input() values: FormValues; - /** (optional) Name to assign to the current process. */ + /** Name to assign to the current process. */ @Input() - name: string = ''; + name?: string = ''; /** Hide or show the process selection dropdown. */ @Input() showSelectProcessDropdown: boolean = true; - /** (optional) Hide or show application selection dropdown. */ + /** Hide or show application selection dropdown. */ @Input() - showSelectApplicationDropdown: boolean = false; + showSelectApplicationDropdown?: boolean = false; - /** (optional) Parameter to enable selection of process when filtering. */ + /** Parameter to enable selection of process when filtering. */ @Input() - processFilterSelector: boolean = true; + processFilterSelector?: boolean = true; /** Emitted when the process starts. */ @Output() diff --git a/lib/process-services/src/lib/process-user-info/process-user-info.component.ts b/lib/process-services/src/lib/process-user-info/process-user-info.component.ts index 2463fc6abd..3d4f2b84f1 100644 --- a/lib/process-services/src/lib/process-user-info/process-user-info.component.ts +++ b/lib/process-services/src/lib/process-user-info/process-user-info.component.ts @@ -69,7 +69,8 @@ export class ProcessUserInfoComponent implements OnDestroy { @Input() showName: boolean = true; - /** When the username is shown, this defines its position relative to the user info button. + /** + * When the username is shown, this defines its position relative to the user info button. * Can be `right` or `left`. */ @Input() diff --git a/lib/process-services/src/lib/task-list/components/checklist.component.ts b/lib/process-services/src/lib/task-list/components/checklist.component.ts index ffc7f711ab..3f9d25e894 100644 --- a/lib/process-services/src/lib/task-list/components/checklist.component.ts +++ b/lib/process-services/src/lib/task-list/components/checklist.component.ts @@ -26,14 +26,15 @@ import { TaskListService } from './../services/tasklist.service'; styleUrls: ['./checklist.component.scss'] }) export class ChecklistComponent implements OnChanges { - /** (required) The id of the parent task to which subtasks are - * attached. + /** + * The id of the parent task to which subtasks are attached. */ @Input() taskId: string; - /** Toggle readonly state of the form. All form widgets - * will render as readonly if enabled. + /** + * Toggle readonly state of the form. + * All form widgets will render as readonly if enabled. */ @Input() readOnly: boolean = false; diff --git a/lib/process-services/src/lib/task-list/components/task-details.component.ts b/lib/process-services/src/lib/task-list/components/task-details.component.ts index ae4cc33346..d3b138420b 100644 --- a/lib/process-services/src/lib/task-list/components/task-details.component.ts +++ b/lib/process-services/src/lib/task-list/components/task-details.component.ts @@ -112,7 +112,8 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy { @Input() showFormSaveButton: boolean = true; - /** Toggles read-only state of the form. All form widgets render as read-only + /** + * Toggles read-only state of the form. All form widgets render as read-only * if enabled. */ @Input() @@ -154,7 +155,8 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy { @Output() error = new EventEmitter(); - /** Emitted when any outcome is executed. Default behaviour can be prevented + /** + * Emitted when any outcome is executed. Default behaviour can be prevented * via `event.preventDefault()`. */ @Output() diff --git a/lib/process-services/src/lib/task-list/components/task-filters.component.ts b/lib/process-services/src/lib/task-list/components/task-filters.component.ts index 7da75841d7..aab3e84bc8 100644 --- a/lib/process-services/src/lib/task-list/components/task-filters.component.ts +++ b/lib/process-services/src/lib/task-list/components/task-filters.component.ts @@ -32,7 +32,8 @@ import { filter, takeUntil } from 'rxjs/operators'; encapsulation: ViewEncapsulation.None }) export class TaskFiltersComponent implements OnInit, OnChanges, OnDestroy { - /** Parameters to use for the task filter. If there is no match then + /** + * Parameters to use for the task filter. If there is no match then * the default filter (the first one the list) is selected. */ @Input() @@ -121,12 +122,12 @@ export class TaskFiltersComponent implements OnInit, OnChanges, OnDestroy { } /** - * Return the task list filtered by appId or by appName + * Load the task list filtered by appId or by appName * - * @param appId - * @param appName + * @param appId application id + * @param appName application name */ - getFilters(appId?: number, appName?: string) { + getFilters(appId?: number, appName?: string): void { if (appName) { this.getFiltersByAppName(appName); } else { @@ -160,9 +161,9 @@ export class TaskFiltersComponent implements OnInit, OnChanges, OnDestroy { /** * Return the filter list filtered by appName * - * @param appName + * @param appName application name */ - getFiltersByAppName(appName: string) { + getFiltersByAppName(appName: string): void { this.appsProcessService.getDeployedApplicationsByName(appName).subscribe( (application) => { this.getFiltersByAppId(application.id); @@ -176,9 +177,9 @@ export class TaskFiltersComponent implements OnInit, OnChanges, OnDestroy { /** * Create default filters by appId * - * @param appId + * @param appId application id */ - createFiltersByAppId(appId?: number) { + createFiltersByAppId(appId?: number): void { this.taskFilterService.createDefaultFilters(appId).subscribe( (resDefault: FilterRepresentationModel[]) => { this.resetFilter(); @@ -195,9 +196,9 @@ export class TaskFiltersComponent implements OnInit, OnChanges, OnDestroy { /** * Pass the selected filter as next * - * @param newFilter + * @param newFilter new filter model */ - public selectFilter(newFilter: FilterParamsModel) { + public selectFilter(newFilter: FilterParamsModel): void { if (newFilter) { this.currentFilter = this.filters.find( (entry, index) => @@ -215,6 +216,8 @@ export class TaskFiltersComponent implements OnInit, OnChanges, OnDestroy { /** * Selects and emits the clicked filter. + * + * @param filterParams filter parameters model */ onFilterClick(filterParams: FilterParamsModel) { this.selectFilter(filterParams); @@ -224,9 +227,9 @@ export class TaskFiltersComponent implements OnInit, OnChanges, OnDestroy { /** * Select filter with task * - * @param taskId + * @param taskId task id */ - public selectFilterWithTask(taskId: string) { + selectFilterWithTask(taskId: string): void { const filteredFilterList: FilterRepresentationModel[] = []; this.taskListService.getFilterForTaskById(taskId, this.filters).subscribe( (filterModel: FilterRepresentationModel) => { @@ -247,14 +250,16 @@ export class TaskFiltersComponent implements OnInit, OnChanges, OnDestroy { /** * Select as default task filter the first in the list */ - public selectDefaultTaskFilter() { + public selectDefaultTaskFilter(): void { if (!this.isFilterListEmpty()) { this.currentFilter = this.filters[0]; } } /** - * Return the current task + * Get the current filter + * + * @returns filter model */ getCurrentFilter(): FilterRepresentationModel { return this.currentFilter; @@ -262,15 +267,20 @@ export class TaskFiltersComponent implements OnInit, OnChanges, OnDestroy { /** * Check if the filter list is empty + * + * @returns `true` if filter list is empty, otherwise `false` */ isFilterListEmpty(): boolean { return this.filters === undefined || (this.filters && this.filters.length === 0); } /** - * Return current filter icon + * Get the material icons equivalent of the glyphicon icon + * + * @param icon glyphicon name + * @returns material icons equivalent of the icon */ - getFilterIcon(icon): string { + getFilterIcon(icon: string): string { return this.iconsMDL.mapGlyphiconToMaterialDesignIcons(icon); } diff --git a/lib/process-services/src/lib/task-list/components/task-form/task-form.component.ts b/lib/process-services/src/lib/task-list/components/task-form/task-form.component.ts index 7e4babdf63..e3b9385627 100644 --- a/lib/process-services/src/lib/task-list/components/task-form/task-form.component.ts +++ b/lib/process-services/src/lib/task-list/components/task-form/task-form.component.ts @@ -50,8 +50,8 @@ export class TaskFormComponent implements OnInit, OnChanges { @Input() showCancelButton: boolean = true; - /** Toggles read-only state of the form. All form widgets render as read-only - * if enabled. + /** + * Toggles read-only state of the form. All form widgets render as read-only if enabled. */ @Input() readOnlyForm: boolean = false; @@ -88,7 +88,8 @@ export class TaskFormComponent implements OnInit, OnChanges { @Output() showAttachForm = new EventEmitter(); - /** Emitted when any outcome is executed. Default behaviour can be prevented + /** + * Emitted when any outcome is executed. Default behaviour can be prevented * via `event.preventDefault()`. */ @Output() diff --git a/lib/process-services/src/lib/task-list/components/task-header.component.ts b/lib/process-services/src/lib/task-list/components/task-header.component.ts index c7eaf78ce6..d9e5d70e0d 100644 --- a/lib/process-services/src/lib/task-list/components/task-header.component.ts +++ b/lib/process-services/src/lib/task-list/components/task-header.component.ts @@ -121,7 +121,9 @@ export class TaskHeaderComponent implements OnChanges, OnInit { } /** - * Return the process parent information + * Get the process parent information + * + * @returns a map of process instance and definition */ getParentInfo(): Map { if (this.taskDetails.processInstanceId && this.taskDetails.processDefinitionName) { @@ -131,35 +133,46 @@ export class TaskHeaderComponent implements OnChanges, OnInit { } /** - * Does the task have an assignee + * Check if the task has an assignee + * + * @returns `true` if the task has an assignee, otherwise `false` */ hasAssignee(): boolean { return !!this.taskDetails.assignee; } /** - * Returns true if the task is assigned to logged in user + * Check if the task is assigned to a user + * + * @param userId the id of the user to check + * @returns `true` if the task assigned to a user, otherwise `false` */ isAssignedTo(userId: number): boolean { return this.hasAssignee() ? this.taskDetails.assignee.id === userId : false; } /** - * Return true if the task assigned + * Check if the task is assigned to the current user + * + * @returns `true` if the task assigned to current user, otherwise `false` */ isAssignedToCurrentUser(): boolean { return this.hasAssignee() && this.isAssignedTo(this.currentUserId); } /** - * Return true if the user is a candidate member + * Check if the user is a candidate member + * + * @returns `true` if user is a candidate member, otherwise false */ isCandidateMember(): boolean { return this.taskDetails.managerOfCandidateGroup || this.taskDetails.memberOfCandidateGroup || this.taskDetails.memberOfCandidateUsers; } /** - * Return true if the task claimable + * Check if the task is claimable + * + * @returns `true` if task can be claimed, otherwise `false` */ isTaskClaimable(): boolean { return !this.hasAssignee() && this.isCandidateMember(); @@ -167,15 +180,19 @@ export class TaskHeaderComponent implements OnChanges, OnInit { /** * Return true if the task claimed by candidate member. + * + * @returns `true` if the task is claimed, otherwise `false` */ isTaskClaimedByCandidateMember(): boolean { return this.isCandidateMember() && this.isAssignedToCurrentUser() && !this.isCompleted(); } /** - * Returns task's status + * Get the status of the task + * + * @returns `Completed` or `Running` */ - getTaskStatus(): string { + getTaskStatus(): 'Completed' | 'Running' { return this.taskDetails?.isCompleted() ? 'Completed' : 'Running'; } @@ -188,7 +205,9 @@ export class TaskHeaderComponent implements OnChanges, OnInit { } /** - * Returns true if the task is completed + * Returns the task completion state + * + * @returns `true` if the task is completed, otherwise `false` */ isCompleted(): boolean { return !!this.taskDetails?.endDate; diff --git a/lib/process-services/src/lib/task-list/components/task-list.component.ts b/lib/process-services/src/lib/task-list/components/task-list.component.ts index 8922c784bc..a7ffcaac84 100644 --- a/lib/process-services/src/lib/task-list/components/task-list.component.ts +++ b/lib/process-services/src/lib/task-list/components/task-list.component.ts @@ -69,7 +69,8 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft @Input() state: string; - /** The assignment of the process. Possible values are: "assignee" (the current user + /** + * The assignment of the process. Possible values are: "assignee" (the current user * is the assignee), "candidate" (the current user is a task candidate, "group_x" (the task * is assigned to a group where the current user is a member, * no value (the current user is involved). @@ -77,7 +78,8 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft @Input() assignment: string; - /** Define the sort order of the tasks. Possible values are : `created-desc`, + /** + * Define the sort order of the tasks. Possible values are : `created-desc`, * `created-asc`, `due-desc`, `due-asc` */ @Input() @@ -87,7 +89,8 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft @Input() name: string; - /** Define which task id should be selected after reloading. If the task id doesn't + /** + * Define which task id should be selected after reloading. If the task id doesn't * exist or nothing is passed then the first task will be selected. */ @Input() @@ -100,7 +103,8 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft @Input() data: DataTableAdapter; - /** Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, + /** + * Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, * you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for * multiple rows. */ @@ -183,8 +187,6 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft * Toggles custom data source mode. * When enabled the component reloads data from it's current source instead of the server side. * This allows generating and displaying custom data sets (i.e. filtered out content). - * - * @memberOf TaskListComponent */ hasCustomDataSource: boolean = false; @@ -255,6 +257,8 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft /** * Select the task given in input if present + * + * @param taskIdSelected selected task id */ selectTask(taskIdSelected: string): void { if (!this.isListEmpty()) { @@ -278,7 +282,9 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft } /** - * Return the current id + * Return the current instance id + * + * @returns the current instance id */ getCurrentId(): string { return this.currentInstanceId; @@ -287,7 +293,8 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft /** * Check if the taskId is the same of the selected task * - * @param taskId + * @param taskId task id + * @returns `true` if current instance id is the same as task id, otherwise `false` */ isEqualToCurrentId(taskId: string): boolean { return this.currentInstanceId === taskId; @@ -295,6 +302,8 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft /** * Check if the list is empty + * + * @returns `true` if list is empty, otherwise `false` */ isListEmpty(): boolean { return !this.rows || this.rows.length === 0; @@ -397,7 +406,8 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft /** * Optimize name field * - * @param instances + * @param instances task detail models + * @returns list of task detail models */ private optimizeTaskDetails(instances: TaskDetailsModel[]): TaskDetailsModel[] { instances = instances.map((task) => { diff --git a/lib/process-services/src/lib/task-list/services/tasklist.service.ts b/lib/process-services/src/lib/task-list/services/tasklist.service.ts index 120fcb7225..45a0df0b53 100644 --- a/lib/process-services/src/lib/task-list/services/tasklist.service.ts +++ b/lib/process-services/src/lib/task-list/services/tasklist.service.ts @@ -417,7 +417,7 @@ export class TaskListService { /** * Gets the search query for a task based on the supplied filter. * - * @param filter The filter to use + * @param filterModel The filter to use * @returns The search query */ private generateTaskRequestNodeFromFilter(filterModel: FilterRepresentationModel): TaskQueryRequestRepresentationModel {