[ACS-6071] fix docs for process cloud (#8947)

* fix docs for process cloud

* fix typo
This commit is contained in:
Denys Vuika
2023-09-28 16:44:57 +01:00
committed by GitHub
parent a48438e1c1
commit d78dcd2156
23 changed files with 202 additions and 58 deletions

View File

@@ -36,16 +36,26 @@ export class AppDetailsCloudComponent {
/** /**
* Pass the selected app as next * Pass the selected app as next
* *
* @param app * @param app application model
*/ */
onSelectApp(app: ApplicationInstanceModel): void { onSelectApp(app: ApplicationInstanceModel): void {
this.selectedApp.emit(app); this.selectedApp.emit(app);
} }
/**
* Get application instance theme
*
* @returns the name of the theme
*/
getTheme(): string { getTheme(): string {
return this.applicationInstance.theme || DEFAULT_APP_INSTANCE_THEME; return this.applicationInstance.theme || DEFAULT_APP_INSTANCE_THEME;
} }
/**
* Get application instance icon
*
* @returns the name of the icon
*/
getIcon(): string { getIcon(): string {
return this.applicationInstance.icon || DEFAULT_APP_INSTANCE_ICON; return this.applicationInstance.icon || DEFAULT_APP_INSTANCE_ICON;
} }

View File

@@ -45,7 +45,8 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
@ContentChild(CustomEmptyContentTemplateDirective) @ContentChild(CustomEmptyContentTemplateDirective)
emptyCustomContent: 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". * values, "GRID" and "LIST".
*/ */
@Input() @Input()
@@ -87,6 +88,8 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
/** /**
* Check if the value of the layoutType property is an allowed value * Check if the value of the layoutType property is an allowed value
*
* @returns `true` if layout type is valid, otherwise `false`
*/ */
isValidType(): boolean { isValidType(): boolean {
if (this.layoutType && (this.layoutType === LAYOUT_LIST || this.layoutType === LAYOUT_GRID)) { if (this.layoutType && (this.layoutType === LAYOUT_LIST || this.layoutType === LAYOUT_GRID)) {
@@ -103,14 +106,18 @@ export class AppListCloudComponent implements OnInit, AfterContentInit {
} }
/** /**
* Return true if the layout type is LIST * Check if the layout type is LIST
*
* @returns `true` if the layout is list, otherwise `false`
*/ */
isList(): boolean { isList(): boolean {
return this.layoutType === LAYOUT_LIST; return this.layoutType === LAYOUT_LIST;
} }
/** /**
* Return true if the layout type is GRID * Check if the layout type is GRID
*
* @returns `true` if layout is grid, otherwise `false`
*/ */
isGrid(): boolean { isGrid(): boolean {
return this.layoutType === LAYOUT_GRID; return this.layoutType === LAYOUT_GRID;

View File

@@ -323,6 +323,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
* Get custom set of outcomes for a Form Definition. * Get custom set of outcomes for a Form Definition.
* *
* @param form Form definition model. * @param form Form definition model.
* @returns list of form outcomes
*/ */
getFormDefinitionOutcomes(form: FormModel): FormOutcomeModel[] { getFormDefinitionOutcomes(form: FormModel): FormOutcomeModel[] {
return [new FormOutcomeModel(form, { id: '$save', name: FormOutcomeModel.SAVE_ACTION, isSystem: true })]; return [new FormOutcomeModel(form, { id: '$save', name: FormOutcomeModel.SAVE_ACTION, isSystem: true })];

View File

@@ -41,7 +41,8 @@ export class PropertiesViewerWrapperComponent implements OnInit, OnChanges {
@Input() @Input()
displayEmpty: boolean; displayEmpty: boolean;
/** Toggles between expanded (ie, full information) and collapsed /**
* Toggles between expanded (ie, full information) and collapsed
* (ie, reduced information) in the display * (ie, reduced information) in the display
*/ */
@Input() @Input()

View File

@@ -22,7 +22,7 @@ import { ProcessServiceCloudTestingModule } from './../../testing/process-servic
import { GroupCloudModule } from '../group-cloud.module'; import { GroupCloudModule } from '../group-cloud.module';
import { GroupCloudComponent } from './group-cloud.component'; import { GroupCloudComponent } from './group-cloud.component';
import { CoreTestingModule } from '@alfresco/adf-core'; import { CoreTestingModule } from '@alfresco/adf-core';
import { SimpleChange } from '@angular/core'; import { DebugElement, SimpleChange } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { IdentityGroupService } from '../services/identity-group.service'; import { IdentityGroupService } from '../services/identity-group.service';
import { mockFoodGroups, mockMeatChicken, mockVegetableAubergine } from '../mock/group-cloud.mock'; import { mockFoodGroups, mockMeatChicken, mockVegetableAubergine } from '../mock/group-cloud.mock';
@@ -35,10 +35,21 @@ describe('GroupCloudComponent', () => {
let findGroupsByNameSpy: jasmine.Spy; let findGroupsByNameSpy: jasmine.Spy;
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions // eslint-disable-next-line prefer-arrow/prefer-arrow-functions
/**
* get the native element for the selector
*
* @param selector selector
* @returns native element
*/
function getElement<T = HTMLElement>(selector: string): T { function getElement<T = HTMLElement>(selector: string): T {
return fixture.nativeElement.querySelector(selector); return fixture.nativeElement.querySelector(selector);
} }
/**
* search group by value
*
* @param value element input value
*/
async function searchGroup(value: string) { async function searchGroup(value: string) {
const input = getElement<HTMLInputElement>('input'); const input = getElement<HTMLInputElement>('input');
input.focus(); input.focus();
@@ -50,6 +61,11 @@ describe('GroupCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
} }
/**
* search group and invoke the blur event
*
* @param value value
*/
async function searchGroupsAndBlur(value: string) { async function searchGroupsAndBlur(value: string) {
const input = getElement<HTMLInputElement>('input'); const input = getElement<HTMLInputElement>('input');
input.focus(); input.focus();
@@ -64,7 +80,12 @@ describe('GroupCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
} }
function getGroupListUI() { /**
* get the group list UI
*
* @returns a list of debug elements
*/
function getGroupListUI(): DebugElement[] {
return fixture.debugElement.queryAll(By.css('[data-automation-id="adf-cloud-group-row"]')); return fixture.debugElement.queryAll(By.css('[data-automation-id="adf-cloud-group-row"]'));
} }

View File

@@ -68,19 +68,22 @@ export class GroupCloudComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
preSelectGroups: IdentityGroupModel[] = []; preSelectGroups: IdentityGroupModel[] = [];
/** This flag enables the validation on the preSelectGroups passed as input. /**
* This flag enables the validation on the preSelectGroups passed as input.
* In case the flag is true the components call the identity service to verify the validity of the information passed as input. * In case the flag is true the components call the identity service to verify the validity of the information passed as input.
* Otherwise, no check will be done. * Otherwise, no check will be done.
*/ */
@Input() @Input()
validate = false; validate = false;
/** Show the info in readonly mode /**
* Show the info in readonly mode
*/ */
@Input() @Input()
readOnly = false; readOnly = false;
/** Mark this field as required /**
* Mark this field as required
*/ */
@Input() @Input()
required = false; required = false;

View File

@@ -42,10 +42,21 @@ describe('PeopleCloudComponent', () => {
let searchSpy: jasmine.Spy; let searchSpy: jasmine.Spy;
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions // eslint-disable-next-line prefer-arrow/prefer-arrow-functions
/**
* get the native element by selector
*
* @param selector selector
* @returns native element
*/
function getElement<T = HTMLElement>(selector: string): T { function getElement<T = HTMLElement>(selector: string): T {
return fixture.nativeElement.querySelector(selector); return fixture.nativeElement.querySelector(selector);
} }
/**
* Search users by value
*
* @param value value
*/
async function searchUsers(value: string) { async function searchUsers(value: string) {
const input = getElement<HTMLInputElement>('input'); const input = getElement<HTMLInputElement>('input');
input.focus(); input.focus();
@@ -57,6 +68,11 @@ describe('PeopleCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
} }
/**
* Search users and blur the input
*
* @param value value
*/
async function searchUsersAndBlur(value: string) { async function searchUsersAndBlur(value: string) {
const input = getElement<HTMLInputElement>('input'); const input = getElement<HTMLInputElement>('input');
input.focus(); input.focus();
@@ -71,14 +87,29 @@ describe('PeopleCloudComponent', () => {
fixture.detectChanges(); fixture.detectChanges();
} }
/**
* Get users list UI
*
* @returns list of debug elements
*/
function getUsersListUI(): DebugElement[] { function getUsersListUI(): DebugElement[] {
return fixture.debugElement.queryAll(By.css('[data-automation-id="adf-people-cloud-row"]')); return fixture.debugElement.queryAll(By.css('[data-automation-id="adf-people-cloud-row"]'));
} }
/**
* Get users chip list UI
*
* @returns list of debug elements
*/
function getUsersChipsUI(): DebugElement[] { function getUsersChipsUI(): DebugElement[] {
return fixture.debugElement.queryAll(By.css('mat-chip')); return fixture.debugElement.queryAll(By.css('mat-chip'));
} }
/**
* Get the first user from the list
*
* @returns native element
*/
function getFirstUserFromListUI(): Element { function getFirstUserFromListUI(): Element {
return element.querySelector('[data-automation-id="adf-people-cloud-row"]'); return element.querySelector('[data-automation-id="adf-people-cloud-row"]');
} }

View File

@@ -65,24 +65,28 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
roles: string[]; roles: string[];
/** This flag enables the validation on the preSelectUsers passed as input. /**
* This flag enables the validation on the preSelectUsers passed as input.
* In case the flag is true the components call the identity service to verify the validity of the information passed as input. * In case the flag is true the components call the identity service to verify the validity of the information passed as input.
* Otherwise, no check will be done. * Otherwise, no check will be done.
*/ */
@Input() @Input()
validate: boolean = false; validate: boolean = false;
/** Show the info in readonly mode /**
* Show the info in readonly mode
*/ */
@Input() @Input()
readOnly: boolean = false; readOnly: boolean = false;
/** Mark this field as required /**
* Mark this field as required
*/ */
@Input() @Input()
required = false; required = false;
/** Array of users to be pre-selected. All users in the /**
* Array of users to be pre-selected. All users in the
* array are pre-selected in multi selection mode, but only the first user * array are pre-selected in multi selection mode, but only the first user
* is pre-selected in single selection mode. * is pre-selected in single selection mode.
* Mandatory properties are: id, email, username * Mandatory properties are: id, email, username
@@ -90,13 +94,15 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
preSelectUsers: IdentityUserModel[] = []; preSelectUsers: IdentityUserModel[] = [];
/** Array of users to be excluded. /**
* Array of users to be excluded.
* Mandatory properties are: id, email, username * Mandatory properties are: id, email, username
*/ */
@Input() @Input()
excludedUsers: IdentityUserModel[] = []; excludedUsers: IdentityUserModel[] = [];
/** Array of groups to restrict user searches. /**
* Array of groups to restrict user searches.
* Mandatory property is group name * Mandatory property is group name
*/ */
@Input() @Input()
@@ -110,7 +116,8 @@ export class PeopleCloudComponent implements OnInit, OnChanges, OnDestroy {
@Input() @Input()
searchUserCtrl = new UntypedFormControl({ value: '', disabled: false }); searchUserCtrl = new UntypedFormControl({ value: '', disabled: false });
/** Placeholder translation key /**
* Placeholder translation key
*/ */
@Input() @Input()
title: string; title: string;

View File

@@ -452,6 +452,8 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
/** /**
* Delete a process instance filter * Delete a process instance filter
*
* @param deleteAction filter action
*/ */
delete(deleteAction: ProcessFilterAction) { delete(deleteAction: ProcessFilterAction) {
this.processFilterCloudService this.processFilterCloudService
@@ -469,6 +471,8 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
/** /**
* Save As a process instance filter * Save As a process instance filter
*
* @param saveAsAction filter action
*/ */
saveAs(saveAsAction: ProcessFilterAction) { saveAs(saveAsAction: ProcessFilterAction) {
const dialogRef = this.dialog.open(ProcessFilterDialogCloudComponent, { const dialogRef = this.dialog.open(ProcessFilterDialogCloudComponent, {
@@ -512,9 +516,10 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
} }
/** /**
* Return filter name * Get sanitized filter name
* *
* @param filterName * @param filterName filter name
* @returns sanitized filter name
*/ */
getSanitizeFilterName(filterName: string): string { getSanitizeFilterName(filterName: string): string {
const nameWithHyphen = this.replaceSpaceWithHyphen(filterName.trim()); const nameWithHyphen = this.replaceSpaceWithHyphen(filterName.trim());
@@ -524,7 +529,8 @@ export class EditProcessFilterCloudComponent implements OnInit, OnChanges, OnDes
/** /**
* Return name with hyphen * Return name with hyphen
* *
* @param name * @param name name
* @returns updated value
*/ */
replaceSpaceWithHyphen(name: string): string { replaceSpaceWithHyphen(name: string): string {
const regExt = new RegExp(' ', 'g'); const regExt = new RegExp(' ', 'g');

View File

@@ -84,8 +84,10 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
/** /**
* Fetch the filter list based on appName * Fetch the filter list based on appName
*
* @param appName application name
*/ */
getFilters(appName: string) { getFilters(appName: string): void {
this.filters$ = this.processFilterCloudService.getProcessFilters(appName); this.filters$ = this.processFilterCloudService.getProcessFilters(appName);
this.filters$.pipe(takeUntil(this.onDestroy$)).subscribe( this.filters$.pipe(takeUntil(this.onDestroy$)).subscribe(
@@ -103,8 +105,10 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
/** /**
* Pass the selected filter as next * Pass the selected filter as next
*
* @param paramFilter filter model
*/ */
public selectFilter(paramFilter: FilterParamsModel) { selectFilter(paramFilter: FilterParamsModel) {
if (paramFilter) { if (paramFilter) {
this.currentFilter = this.filters.find( this.currentFilter = this.filters.find(
(filter, index) => (filter, index) =>
@@ -118,6 +122,10 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
/** /**
* Check equality of the filter names by translating the given name strings * Check equality of the filter names by translating the given name strings
*
* @param name1 source name
* @param name2 target name
* @returns `true` if filter names are equal, otherwise `false`
*/ */
private checkFilterNamesEquality(name1: string, name2: string): boolean { private checkFilterNamesEquality(name1: string, name2: string): boolean {
const translatedName1 = this.translationService.instant(name1); const translatedName1 = this.translationService.instant(name1);
@@ -128,8 +136,10 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
/** /**
* Selects and emits the given filter * Selects and emits the given filter
*
* @param newParamFilter new parameter filter
*/ */
public selectFilterAndEmit(newParamFilter: FilterParamsModel) { selectFilterAndEmit(newParamFilter: FilterParamsModel) {
if (newParamFilter) { if (newParamFilter) {
this.selectFilter(newParamFilter); this.selectFilter(newParamFilter);
this.filterSelected.emit(this.currentFilter); this.filterSelected.emit(this.currentFilter);
@@ -140,15 +150,19 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
/** /**
* Select filter with the id * Select filter with the id
*
* @param id filter id
*/ */
public selectFilterById(id: string) { selectFilterById(id: string) {
this.selectFilterAndEmit({ id }); this.selectFilterAndEmit({ id });
} }
/** /**
* Selects and emits the clicked filter * Selects and emits the clicked filter
*
* @param filter filter model
*/ */
public onFilterClick(filter: ProcessFilterCloudModel) { onFilterClick(filter: ProcessFilterCloudModel) {
if (filter) { if (filter) {
this.selectFilter(filter); this.selectFilter(filter);
this.filterClicked.emit(this.currentFilter); this.filterClicked.emit(this.currentFilter);
@@ -160,14 +174,16 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
/** /**
* Select as default process filter the first in the list * Select as default process filter the first in the list
*/ */
public selectDefaultProcessFilter() { selectDefaultProcessFilter() {
if (!this.isFilterListEmpty()) { if (!this.isFilterListEmpty()) {
this.currentFilter = this.filters[0]; this.currentFilter = this.filters[0];
} }
} }
/** /**
* Return the current process * Get current filter
*
* @returns filter model
*/ */
getCurrentFilter(): ProcessFilterCloudModel { getCurrentFilter(): ProcessFilterCloudModel {
return this.currentFilter; return this.currentFilter;
@@ -175,6 +191,8 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
/** /**
* Check if the filter list is empty * Check if the filter list is empty
*
* @returns `true` if filter list is empty, otherwise `false`
*/ */
isFilterListEmpty(): boolean { isFilterListEmpty(): boolean {
return this.filters === undefined || (this.filters && this.filters.length === 0); return this.filters === undefined || (this.filters && this.filters.length === 0);
@@ -193,7 +211,7 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges, OnDestro
this.onDestroy$.complete(); this.onDestroy$.complete();
} }
isActiveFilter(filter: any): boolean { isActiveFilter(filter: ProcessFilterCloudModel): boolean {
return this.currentFilter.name === filter.name; return this.currentFilter.name === filter.name;
} }
} }

View File

@@ -94,9 +94,8 @@ export class ProcessFilterCloudService {
* Creates and returns the default process instance filters for a app. * Creates and returns the default process instance filters for a app.
* *
* @param appName Name of the target app * @param appName Name of the target app
* @returns Observable of default process instance filters just created or created filters
*/ */
private createDefaultFilters(appName: string) { private createDefaultFilters(appName: string): void {
const key: string = this.prepareKey(appName); const key: string = this.prepareKey(appName);
this.preferenceService this.preferenceService
.getPreferences(appName, key) .getPreferences(appName, key)
@@ -334,8 +333,8 @@ export class ProcessFilterCloudService {
* Finds and returns the process instance filters from preferences * Finds and returns the process instance filters from preferences
* *
* @returns Array of ProcessFilterCloudModel * @returns Array of ProcessFilterCloudModel
* @param preferences * @param preferences preferences
* @param key * @param key key
*/ */
private findFiltersByKeyInPreferences(preferences: any, key: string): ProcessFilterCloudModel[] { private findFiltersByKeyInPreferences(preferences: any, key: string): ProcessFilterCloudModel[] {
const result = preferences.find((filter: any) => filter.entry.key === key); const result = preferences.find((filter: any) => filter.entry.key === key);

View File

@@ -24,6 +24,10 @@ import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud
import { BaseCloudService } from '../../../services/base-cloud.service'; import { BaseCloudService } from '../../../services/base-cloud.service';
import { TaskVariableCloud } from '../../../form/models/task-variable-cloud.model'; import { TaskVariableCloud } from '../../../form/models/task-variable-cloud.model';
export interface QueryParams {
include: 'variables';
}
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
@@ -32,9 +36,10 @@ export class StartProcessCloudService extends BaseCloudService {
* Gets the process definitions associated with an app. * Gets the process definitions associated with an app.
* *
* @param appName Name of the target app * @param appName Name of the target app
* @param queryParams optional query parameters
* @returns Array of process definitions * @returns Array of process definitions
*/ */
getProcessDefinitions(appName: string, queryParams?: { include: 'variables' }): Observable<ProcessDefinitionCloud[]> { getProcessDefinitions(appName: string, queryParams?: QueryParams): Observable<ProcessDefinitionCloud[]> {
if (appName || appName === '') { if (appName || appName === '') {
const url = `${this.getBasePath(appName)}/rb/v1/process-definitions`; const url = `${this.getBasePath(appName)}/rb/v1/process-definitions`;
@@ -85,6 +90,7 @@ export class StartProcessCloudService extends BaseCloudService {
* *
* @param appName name of the Application * @param appName name of the Application
* @param processInstanceId process instance to update * @param processInstanceId process instance to update
* @returns Observable<void>
*/ */
deleteProcess(appName: string, processInstanceId: string): Observable<void> { deleteProcess(appName: string, processInstanceId: string): Observable<void> {
const url = `${this.getBasePath(appName)}/rb/v1/process-instances/${processInstanceId}`; const url = `${this.getBasePath(appName)}/rb/v1/process-instances/${processInstanceId}`;

View File

@@ -60,7 +60,7 @@ export class UserPreferenceCloudService extends BaseCloudService implements Pref
* *
* @param appName Name of the target app * @param appName Name of the target app
* @param key Key of the target preference * @param key Key of the target preference
* @newPreference Details of new user preference * @param newPreference Details of new user preference
* @returns Observable of created user preferences * @returns Observable of created user preferences
*/ */
createPreference(appName: string, key: string, newPreference: any): Observable<any> { createPreference(appName: string, key: string, newPreference: any): Observable<any> {

View File

@@ -194,7 +194,8 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi
/** /**
* Creates a new standalone task. * Creates a new standalone task.
* *
* @param taskDetails Details of the task to create * @param startTaskRequest request model
* @param appName application name
* @returns Details of the newly created task * @returns Details of the newly created task
*/ */
createNewTask(startTaskRequest: StartTaskCloudRequestModel, appName: string): Observable<TaskDetailsCloudModel> { createNewTask(startTaskRequest: StartTaskCloudRequestModel, appName: string): Observable<TaskDetailsCloudModel> {

View File

@@ -215,9 +215,10 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
} }
/** /**
* Return filter name * Get the sanitized filter name
* *
* @param filterName * @param filterName filter name
* @returns sanitized filter name
*/ */
getSanitizeFilterName(filterName: string): string { getSanitizeFilterName(filterName: string): string {
const nameWithHyphen = this.replaceSpaceWithHyphen(filterName.trim()); const nameWithHyphen = this.replaceSpaceWithHyphen(filterName.trim());

View File

@@ -120,12 +120,20 @@ describe('EditTaskFilterCloudComponent', () => {
processInstanceIdInput: '[data-automation-id="adf-cloud-edit-task-property-processInstanceId"]' processInstanceIdInput: '[data-automation-id="adf-cloud-edit-task-property-processInstanceId"]'
}; };
/**
* expand filter panel
*/
function expandFilterPanel(){ function expandFilterPanel(){
const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header'); const expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
expansionPanel.click(); expansionPanel.click();
fixture.detectChanges(); fixture.detectChanges();
} }
/**
* resolve filter instance input element
*
* @returns native element
*/
function getProcessInstanceIdInputElement(){ function getProcessInstanceIdInputElement(){
return fixture.debugElement.query(By.css(cssSelector.processInstanceIdInput)).nativeElement; return fixture.debugElement.query(By.css(cssSelector.processInstanceIdInput)).nativeElement;
} }

View File

@@ -63,9 +63,11 @@ export class ServiceTaskFiltersCloudComponent extends BaseTaskFiltersCloudCompon
} }
/** /**
* Return the filter list filtered by appName * Load the filter list filtered by appName
*
* @param appName application name
*/ */
getFilters(appName: string) { getFilters(appName: string): void {
this.filters$ = this.serviceTaskFilterCloudService.getTaskListFilters(appName); this.filters$ = this.serviceTaskFilterCloudService.getTaskListFilters(appName);
this.filters$.pipe(takeUntil(this.onDestroy$)).subscribe( this.filters$.pipe(takeUntil(this.onDestroy$)).subscribe(
@@ -81,7 +83,12 @@ export class ServiceTaskFiltersCloudComponent extends BaseTaskFiltersCloudCompon
); );
} }
public selectFilter(paramFilter: FilterParamsModel) { /**
* Select filter
*
* @param paramFilter filter model
*/
selectFilter(paramFilter: FilterParamsModel) {
if (paramFilter) { if (paramFilter) {
this.currentFilter = this.filters.find((filter, index) => this.currentFilter = this.filters.find((filter, index) =>
paramFilter.index === index || paramFilter.index === index ||
@@ -107,8 +114,10 @@ export class ServiceTaskFiltersCloudComponent extends BaseTaskFiltersCloudCompon
/** /**
* Selects and emits the clicked filter. * Selects and emits the clicked filter.
*
* @param filter filter to select
*/ */
public onFilterClick(filter: FilterParamsModel) { onFilterClick(filter: FilterParamsModel) {
if (filter) { if (filter) {
this.selectFilter(filter); this.selectFilter(filter);
this.filterClicked.emit(this.currentFilter); this.filterClicked.emit(this.currentFilter);
@@ -128,6 +137,8 @@ export class ServiceTaskFiltersCloudComponent extends BaseTaskFiltersCloudCompon
/** /**
* Check if the filter list is empty * Check if the filter list is empty
*
* @returns `true` if filter list is empty, otherwise `false`
*/ */
isFilterListEmpty(): boolean { isFilterListEmpty(): boolean {
return this.filters === undefined || (this.filters && this.filters.length === 0); return this.filters === undefined || (this.filters && this.filters.length === 0);

View File

@@ -34,6 +34,11 @@ describe('TaskAssignmentFilterComponent', () => {
let fixture: ComponentFixture<TaskAssignmentFilterCloudComponent>; let fixture: ComponentFixture<TaskAssignmentFilterCloudComponent>;
let identityUserService: IdentityUserService; let identityUserService: IdentityUserService;
/**
* select the assignment type
*
* @param type type to select
*/
function selectAssignmentType(type: AssignmentType) { function selectAssignmentType(type: AssignmentType) {
const assignmentTypeChangeSpy = spyOn(component.assignmentTypeChange, 'emit'); const assignmentTypeChangeSpy = spyOn(component.assignmentTypeChange, 'emit');

View File

@@ -73,13 +73,15 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp
} }
/** /**
* Return the filter list filtered by appName * Loads the filter list filtered by appName
*
* @param appName application name
*/ */
getFilters(appName: string) { getFilters(appName: string): void {
this.filters$ = this.taskFilterCloudService.getTaskListFilters(appName); this.filters$ = this.taskFilterCloudService.getTaskListFilters(appName);
this.filters$.pipe(takeUntil(this.onDestroy$)).subscribe( this.filters$.pipe(takeUntil(this.onDestroy$)).subscribe(
(res: TaskFilterCloudModel[]) => { (res) => {
this.resetFilter(); this.resetFilter();
this.filters = res || []; this.filters = res || [];
this.selectFilterAndEmit(this.filterParam); this.selectFilterAndEmit(this.filterParam);
@@ -157,8 +159,10 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp
/** /**
* Selects and emits the clicked filter. * Selects and emits the clicked filter.
*
* @param filter filter model
*/ */
public onFilterClick(filter: FilterParamsModel) { onFilterClick(filter: FilterParamsModel) {
if (filter) { if (filter) {
this.selectFilter(filter); this.selectFilter(filter);
this.updateFilterCounter(this.currentFilter); this.updateFilterCounter(this.currentFilter);
@@ -179,6 +183,8 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp
/** /**
* Check if the filter list is empty * Check if the filter list is empty
*
* @returns `true` if filter list is empty, otherwise `false`
*/ */
isFilterListEmpty(): boolean { isFilterListEmpty(): boolean {
return this.filters === undefined || (this.filters && this.filters.length === 0); return this.filters === undefined || (this.filters && this.filters.length === 0);

View File

@@ -40,9 +40,8 @@ export class ServiceTaskFilterCloudService {
* Creates and returns the default task filters for an app. * Creates and returns the default task filters for an app.
* *
* @param appName Name of the target app * @param appName Name of the target app
* @returns Observable of default filters task filters just created or created filters
*/ */
private createDefaultFilters(appName: string) { private createDefaultFilters(appName: string): void {
const key: string = this.prepareKey(appName); const key: string = this.prepareKey(appName);
this.preferenceService this.preferenceService
.getPreferences(appName, key) .getPreferences(appName, key)
@@ -251,8 +250,8 @@ export class ServiceTaskFilterCloudService {
* Finds and returns the task filters from preferences * Finds and returns the task filters from preferences
* *
* @returns Array of TaskFilterCloudModel * @returns Array of TaskFilterCloudModel
* @param preferences * @param preferences preferences
* @param key * @param key key
*/ */
private findFiltersByKeyInPreferences(preferences: any, key: string): ServiceTaskFilterCloudModel[] { private findFiltersByKeyInPreferences(preferences: any, key: string): ServiceTaskFilterCloudModel[] {
const result = preferences.find((filter: any) => filter.entry.key === key); const result = preferences.find((filter: any) => filter.entry.key === key);

View File

@@ -65,9 +65,8 @@ export class TaskFilterCloudService extends BaseCloudService {
* Creates and returns the default task filters for an app. * Creates and returns the default task filters for an app.
* *
* @param appName Name of the target app * @param appName Name of the target app
* @returns Observable of default filters task filters just created or created filters
*/ */
private createDefaultFilters(appName: string) { private createDefaultFilters(appName: string): void {
const key: string = this.prepareKey(appName); const key: string = this.prepareKey(appName);
this.preferenceService this.preferenceService
.getPreferences(appName, key) .getPreferences(appName, key)
@@ -254,9 +253,9 @@ export class TaskFilterCloudService extends BaseCloudService {
* Finds a task using an object with optional query properties. * Finds a task using an object with optional query properties.
* *
* @returns Task information * @returns Task information
* @param taskFilter * @param taskFilter task filter model
*/ */
getTaskFilterCounter(taskFilter: TaskFilterCloudModel): Observable<any> { getTaskFilterCounter(taskFilter: TaskFilterCloudModel): Observable<number> {
if (taskFilter.appName || taskFilter.appName === '') { if (taskFilter.appName || taskFilter.appName === '') {
const queryUrl = `${this.getBasePath(taskFilter.appName)}/query/v1/tasks`; const queryUrl = `${this.getBasePath(taskFilter.appName)}/query/v1/tasks`;
const queryParams = { const queryParams = {
@@ -313,8 +312,8 @@ export class TaskFilterCloudService extends BaseCloudService {
* Finds and returns the task filters from preferences * Finds and returns the task filters from preferences
* *
* @returns Array of TaskFilterCloudModel * @returns Array of TaskFilterCloudModel
* @param preferences * @param preferences preferences
* @param key * @param key key
*/ */
private findFiltersByKeyInPreferences(preferences: any, key: string): TaskFilterCloudModel[] { private findFiltersByKeyInPreferences(preferences: any, key: string): TaskFilterCloudModel[] {
const result = preferences.find((filter: any) => filter.entry.key === key); const result = preferences.find((filter: any) => filter.entry.key === key);

View File

@@ -96,13 +96,15 @@ export class TaskFormCloudComponent implements OnInit, OnChanges, OnDestroy {
@Output() @Output()
formContentClicked: EventEmitter<ContentLinkModel> = new EventEmitter(); formContentClicked: EventEmitter<ContentLinkModel> = 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()`. * via `event.preventDefault()`.
*/ */
@Output() @Output()
executeOutcome = new EventEmitter<FormOutcomeEvent>(); executeOutcome = new EventEmitter<FormOutcomeEvent>();
/** Emitted when a task is loaded`. /**
* Emitted when a task is loaded`.
*/ */
@Output() @Output()
onTaskLoaded = new EventEmitter<TaskDetailsCloudModel>(); /* eslint-disable-line */ onTaskLoaded = new EventEmitter<TaskDetailsCloudModel>(); /* eslint-disable-line */

View File

@@ -288,7 +288,7 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
/** /**
* Save a task detail and update it after a successful response * Save a task detail and update it after a successful response
* *
* @param updateNotification * @param updateNotification notification model
*/ */
private updateTaskDetails(updateNotification: UpdateNotification) { private updateTaskDetails(updateNotification: UpdateNotification) {
this.taskCloudService.updateTask(this.appName, this.taskId, updateNotification.changed) this.taskCloudService.updateTask(this.appName, this.taskId, updateNotification.changed)
@@ -336,6 +336,8 @@ export class TaskHeaderCloudComponent implements OnInit, OnDestroy, OnChanges {
/** /**
* as per [ACA-3960] it required an empty array argument for now * as per [ACA-3960] it required an empty array argument for now
* Empty array will be replaced with candidateGroups in feature * Empty array will be replaced with candidateGroups in feature
*
* @returns `true` if assignee property is clickable, otherwise `false`
*/ */
isAssigneePropertyClickable(): boolean { isAssigneePropertyClickable(): boolean {
return this.taskCloudService.isAssigneePropertyClickable(this.taskDetails, this.candidateUsers, []); return this.taskCloudService.isAssigneePropertyClickable(this.taskDetails, this.candidateUsers, []);