mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-6071] documentation fixes for process lib (#8943)
* doc and api fixes * doc fixes * fix docs * code fixes * typo fixes
This commit is contained in:
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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<any> = new EventEmitter<any>();
|
||||
|
||||
/** Emitted when an attachment is successfully created or uploaded
|
||||
/**
|
||||
* Emitted when an attachment is successfully created or uploaded
|
||||
* from within the component.
|
||||
*/
|
||||
@Output()
|
||||
|
@@ -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<any> = new EventEmitter<any>();
|
||||
|
||||
/** Emitted when an attachment is created or uploaded successfully
|
||||
/**
|
||||
* Emitted when an attachment is created or uploaded successfully
|
||||
* from within the component.
|
||||
*/
|
||||
@Output()
|
||||
|
@@ -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()
|
||||
|
@@ -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()
|
||||
|
@@ -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<UserProcessModel[]> {
|
||||
|
@@ -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 })];
|
||||
|
@@ -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<AlfrescoContentRepresentation[]> {
|
||||
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<any> {
|
||||
getAlfrescoRepositories(tenantId?: string, includeAccount?: boolean): Observable<AlfrescoEndpointRepresentation[]> {
|
||||
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<ExternalContentLink> {
|
||||
linkAlfrescoNode(accountId: string, node: ExternalContent, siteId: string): Observable<RelatedContentRepresentation> {
|
||||
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<RelatedContentRepresentation> {
|
||||
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<any> {
|
||||
private handleError(error: any): Observable<never> {
|
||||
let errMsg = ActivitiContentService.UNKNOWN_ERROR_MESSAGE;
|
||||
if (error) {
|
||||
errMsg = error.message
|
||||
|
@@ -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<ResultListDataRepresentationRelatedProcessTask>
|
||||
* @returns Promise<ResultListDataRepresentationRelatedProcessTask>
|
||||
*/
|
||||
getProcessesAndTasksOnContent(sourceId: string, source: string, size?: number, page?: number): Observable<ResultListDataRepresentationRelatedProcessTask> {
|
||||
return from(this.contentApi.getProcessesAndTasksOnContent(sourceId, source, size, page)).pipe(catchError((err) => this.handleError(err)));
|
||||
|
@@ -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<Node[]> {
|
||||
|
@@ -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) => {
|
||||
|
@@ -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(
|
||||
|
@@ -58,6 +58,9 @@ describe('PeopleSearchComponent', () => {
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
/**
|
||||
* trigger search
|
||||
*/
|
||||
function triggerSearch() {
|
||||
searchInput = element.querySelector('#userSearchText');
|
||||
searchInput.value = 'fake-search';
|
||||
|
@@ -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<CommentModel[]> {
|
||||
@@ -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
|
||||
*/
|
||||
|
@@ -58,10 +58,6 @@ export class ProcessAuditDirective implements OnChanges {
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
/**
|
||||
* @param downloadService
|
||||
* @param processListService
|
||||
*/
|
||||
constructor(private downloadService: DownloadService,
|
||||
private processListService: ProcessService) {
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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) {
|
||||
|
@@ -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()
|
||||
|
@@ -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<any>) {
|
||||
if (event.detail.keyboardEvent.key === 'Enter') {
|
||||
|
@@ -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(() => {
|
||||
|
@@ -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()
|
||||
|
@@ -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()
|
||||
|
@@ -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;
|
||||
|
@@ -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<any>();
|
||||
|
||||
/** 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()
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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<void>();
|
||||
|
||||
/** 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()
|
||||
|
@@ -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<string, string> {
|
||||
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;
|
||||
|
@@ -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) => {
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user