mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[ACA-3623] Process definition name filter in task list (#5871)
* [ACA-3623] Process definition name filter in task list * Added unit test * Aligning with changes in process list * Added all option
This commit is contained in:
parent
0d607ba0bd
commit
a64e13bec5
@ -49,7 +49,7 @@ when the process list is empty:
|
|||||||
### Properties
|
### Properties
|
||||||
|
|
||||||
| Name | Type | Default value | Description |
|
| Name | Type | Default value | Description |
|
||||||
| ---- | ---- | ------------- | ----------- |
|
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| actionsPosition | `string` | "right" | Position of the actions dropdown menu. Can be "left" or "right". |
|
| actionsPosition | `string` | "right" | Position of the actions dropdown menu. Can be "left" or "right". |
|
||||||
| appName | `string` | "" | The name of the application. |
|
| appName | `string` | "" | The name of the application. |
|
||||||
| appVersion | `number` | | The release version of the application. |
|
| appVersion | `number` | | The release version of the application. |
|
||||||
@ -74,7 +74,7 @@ when the process list is empty:
|
|||||||
### Events
|
### Events
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
| ---- | ---- | ----------- |
|
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
||||||
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when an error occurs while loading the list of process instances from the server. |
|
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when an error occurs while loading the list of process instances from the server. |
|
||||||
| executeRowAction | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`DataRowActionEvent`](../../../lib/core/datatable/components/data-row-action.event.ts)`>` | Emitted when the user executes a row action. |
|
| executeRowAction | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`DataRowActionEvent`](../../../lib/core/datatable/components/data-row-action.event.ts)`>` | Emitted when the user executes a row action. |
|
||||||
| rowClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when a row in the process list is clicked. |
|
| rowClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when a row in the process list is clicked. |
|
||||||
|
@ -15,19 +15,18 @@ Gets process definitions and starts processes.
|
|||||||
|
|
||||||
- **createProcess**(appName: `string`, payload: [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>`<br/>
|
- **createProcess**(appName: `string`, payload: [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>`<br/>
|
||||||
Create a process based on a process definition, name, form values or variables.
|
Create a process based on a process definition, name, form values or variables.
|
||||||
- _appName:_ `string` - name of the [Application](../../../lib/testing/src/lib/core/structure/application.ts)
|
- _appName:_ `string` - name of the Application
|
||||||
- _payload:_ [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts) - Details of the process (definition key, name, variables, etc)
|
- _payload:_ [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts) - Details of the process (definition key, name, variables, etc)
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just created
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just created
|
||||||
- **deleteProcess**(appName: `string`, processInstanceId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<void>`<br/>
|
- **deleteProcess**(appName: `string`, processInstanceId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<void>`<br/>
|
||||||
Delete an existing process instance
|
Delete an existing process instance
|
||||||
- _appName:_ `string` - name of the [Application](../../../lib/testing/src/lib/core/structure/application.ts)
|
- _appName:_ `string` - name of the Application
|
||||||
- _processInstanceId:_ `string` - process instance to update
|
- _processInstanceId:_ `string` - process instance to update
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<void>` -
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<void>` -
|
||||||
- **getBasePath**(appName: `string`): `string`<br/>
|
- **getBasePath**(appName: `string`): `string`<br/>
|
||||||
|
|
||||||
- _appName:_ `string` -
|
- _appName:_ `string` -
|
||||||
- **Returns** `string` -
|
- **Returns** `string` -
|
||||||
|
|
||||||
- **getProcessDefinitions**(appName: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessDefinitionCloud`](../../../lib/process-services-cloud/src/lib/models/process-definition-cloud.model.ts)`[]>`<br/>
|
- **getProcessDefinitions**(appName: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessDefinitionCloud`](../../../lib/process-services-cloud/src/lib/models/process-definition-cloud.model.ts)`[]>`<br/>
|
||||||
Gets the process definitions associated with an app.
|
Gets the process definitions associated with an app.
|
||||||
- _appName:_ `string` - Name of the target app
|
- _appName:_ `string` - Name of the target app
|
||||||
@ -40,12 +39,12 @@ Gets process definitions and starts processes.
|
|||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just started
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just started
|
||||||
- **startProcess**(appName: `string`, payload: [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>`<br/>
|
- **startProcess**(appName: `string`, payload: [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>`<br/>
|
||||||
Starts a process based on a process definition, name, form values or variables.
|
Starts a process based on a process definition, name, form values or variables.
|
||||||
- _appName:_ `string` - name of the [Application](../../../lib/testing/src/lib/core/structure/application.ts)
|
- _appName:_ `string` - name of the Application
|
||||||
- _payload:_ [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts) - Details of the process (definition key, name, variables, etc)
|
- _payload:_ [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts) - Details of the process (definition key, name, variables, etc)
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just started
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just started
|
||||||
- **updateProcess**(appName: `string`, processInstanceId: `string`, payload: [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>`<br/>
|
- **updateProcess**(appName: `string`, processInstanceId: `string`, payload: [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>`<br/>
|
||||||
Update an existing process instance
|
Update an existing process instance
|
||||||
- _appName:_ `string` - name of the [Application](../../../lib/testing/src/lib/core/structure/application.ts)
|
- _appName:_ `string` - name of the Application
|
||||||
- _processInstanceId:_ `string` - process instance to update
|
- _processInstanceId:_ `string` - process instance to update
|
||||||
- _payload:_ [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts) - Details of the process (definition key, name, variables, etc)
|
- _payload:_ [`ProcessPayloadCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-payload-cloud.model.ts) - Details of the process (definition key, name, variables, etc)
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just started
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessInstanceCloud`](../../../lib/process-services-cloud/src/lib/process/start-process/models/process-instance-cloud.model.ts)`>` - Details of the process instance just started
|
||||||
|
@ -45,7 +45,6 @@ Manages task cloud.
|
|||||||
|
|
||||||
- _appName:_ `string` -
|
- _appName:_ `string` -
|
||||||
- **Returns** `string` -
|
- **Returns** `string` -
|
||||||
|
|
||||||
- **getCandidateGroups**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<string[]>`<br/>
|
- **getCandidateGroups**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<string[]>`<br/>
|
||||||
Gets candidate groups of the task.
|
Gets candidate groups of the task.
|
||||||
- _appName:_ `string` - Name of the app
|
- _appName:_ `string` - Name of the app
|
||||||
@ -56,6 +55,10 @@ Manages task cloud.
|
|||||||
- _appName:_ `string` - Name of the app
|
- _appName:_ `string` - Name of the app
|
||||||
- _taskId:_ `string` - ID of the task
|
- _taskId:_ `string` - ID of the task
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<string[]>` - Candidate users
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<string[]>` - Candidate users
|
||||||
|
- **getProcessDefinitions**(appName: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessDefinitionCloud`](../../../lib/process-services-cloud/src/lib/models/process-definition-cloud.model.ts)`[]>`<br/>
|
||||||
|
Gets the process definitions associated with an app.
|
||||||
|
- _appName:_ `string` - Name of the target app
|
||||||
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessDefinitionCloud`](../../../lib/process-services-cloud/src/lib/models/process-definition-cloud.model.ts)`[]>` - Array of process definitions
|
||||||
- **getTaskById**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`<br/>
|
- **getTaskById**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`<br/>
|
||||||
Gets details of a task.
|
Gets details of a task.
|
||||||
- _appName:_ `string` - Name of the app
|
- _appName:_ `string` - Name of the app
|
||||||
|
@ -126,6 +126,7 @@
|
|||||||
"LABEL": {
|
"LABEL": {
|
||||||
"APP_NAME": "ApplicationName",
|
"APP_NAME": "ApplicationName",
|
||||||
"TASK_ID": "Task ID",
|
"TASK_ID": "Task ID",
|
||||||
|
"PROCESS_DEF_NAME": "ProcessDefinitionName",
|
||||||
"PROCESS_DEF_ID": "ProcessDefinitionId",
|
"PROCESS_DEF_ID": "ProcessDefinitionId",
|
||||||
"STATUS": "Status",
|
"STATUS": "Status",
|
||||||
"ASSIGNMENT": "Assignee",
|
"ASSIGNMENT": "Assignee",
|
||||||
|
@ -22,6 +22,7 @@ import { map } from 'rxjs/operators';
|
|||||||
import { TaskDetailsCloudModel, StartTaskCloudResponseModel } from '../start-task/models/task-details-cloud.model';
|
import { TaskDetailsCloudModel, StartTaskCloudResponseModel } from '../start-task/models/task-details-cloud.model';
|
||||||
import { BaseCloudService } from '../../services/base-cloud.service';
|
import { BaseCloudService } from '../../services/base-cloud.service';
|
||||||
import { StartTaskCloudRequestModel } from '../start-task/models/start-task-cloud-request.model';
|
import { StartTaskCloudRequestModel } from '../start-task/models/start-task-cloud-request.model';
|
||||||
|
import { ProcessDefinitionCloud } from '../../models/process-definition-cloud.model';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@ -236,6 +237,26 @@ export class TaskCloudService extends BaseCloudService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the process definitions associated with an app.
|
||||||
|
* @param appName Name of the target app
|
||||||
|
* @returns Array of process definitions
|
||||||
|
*/
|
||||||
|
getProcessDefinitions(appName: string): Observable<ProcessDefinitionCloud[]> {
|
||||||
|
if (appName || appName === '') {
|
||||||
|
const url = `${this.getBasePath(appName)}/rb/v1/process-definitions`;
|
||||||
|
|
||||||
|
return this.get(url).pipe(
|
||||||
|
map((res: any) => {
|
||||||
|
return res.list.entries.map((processDefs) => new ProcessDefinitionCloud(processDefs.entry));
|
||||||
|
})
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.logService.error('AppName is mandatory for querying task');
|
||||||
|
return throwError('AppName not configured');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private isAssignedToMe(assignee: string): boolean {
|
private isAssignedToMe(assignee: string): boolean {
|
||||||
const currentUser = this.identityUserService.getCurrentUserInfo().username;
|
const currentUser = this.identityUserService.getCurrentUserInfo().username;
|
||||||
return assignee === currentUser;
|
return assignee === currentUser;
|
||||||
|
@ -31,6 +31,7 @@ import { fakeApplicationInstance } from '../../../app/mock/app-model.mock';
|
|||||||
import { TaskFiltersCloudModule } from '../task-filters-cloud.module';
|
import { TaskFiltersCloudModule } from '../task-filters-cloud.module';
|
||||||
import { EditTaskFilterCloudComponent } from './edit-task-filter-cloud.component';
|
import { EditTaskFilterCloudComponent } from './edit-task-filter-cloud.component';
|
||||||
import { TaskFilterCloudService } from '../services/task-filter-cloud.service';
|
import { TaskFilterCloudService } from '../services/task-filter-cloud.service';
|
||||||
|
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||||
import { TaskFilterDialogCloudComponent } from './task-filter-dialog-cloud.component';
|
import { TaskFilterDialogCloudComponent } from './task-filter-dialog-cloud.component';
|
||||||
import { fakeFilter } from '../mock/task-filters-cloud.mock';
|
import { fakeFilter } from '../mock/task-filters-cloud.mock';
|
||||||
import { AbstractControl } from '@angular/forms';
|
import { AbstractControl } from '@angular/forms';
|
||||||
@ -45,6 +46,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
|||||||
let dialog: MatDialog;
|
let dialog: MatDialog;
|
||||||
let getTaskFilterSpy: jasmine.Spy;
|
let getTaskFilterSpy: jasmine.Spy;
|
||||||
let getRunningApplicationsSpy: jasmine.Spy;
|
let getRunningApplicationsSpy: jasmine.Spy;
|
||||||
|
let taskService: TaskCloudService;
|
||||||
|
|
||||||
setupTestBed({
|
setupTestBed({
|
||||||
imports: [
|
imports: [
|
||||||
@ -63,6 +65,7 @@ describe('EditTaskFilterCloudComponent', () => {
|
|||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
service = TestBed.inject(TaskFilterCloudService);
|
service = TestBed.inject(TaskFilterCloudService);
|
||||||
appsService = TestBed.inject(AppsProcessCloudService);
|
appsService = TestBed.inject(AppsProcessCloudService);
|
||||||
|
taskService = TestBed.inject(TaskCloudService);
|
||||||
dialog = TestBed.inject(MatDialog);
|
dialog = TestBed.inject(MatDialog);
|
||||||
spyOn(dialog, 'open').and.returnValue({ afterClosed: of({
|
spyOn(dialog, 'open').and.returnValue({ afterClosed: of({
|
||||||
action: TaskFilterDialogCloudComponent.ACTION_SAVE,
|
action: TaskFilterDialogCloudComponent.ACTION_SAVE,
|
||||||
@ -90,6 +93,22 @@ describe('EditTaskFilterCloudComponent', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should fetch process definitions when processDefinitionName filter property is set', async(() => {
|
||||||
|
const processSpy = spyOn(taskService, 'getProcessDefinitions').and.returnValue(of([{ id: 'fake-id', name: 'fake-name' }]));
|
||||||
|
fixture.detectChanges();
|
||||||
|
component.filterProperties = ['processDefinitionName'];
|
||||||
|
fixture.detectChanges();
|
||||||
|
const taskFilterIdChange = new SimpleChange(null, 'mock-process-filter-id', true);
|
||||||
|
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||||
|
fixture.detectChanges();
|
||||||
|
const controller = component.editTaskFilterForm.get('processDefinitionName');
|
||||||
|
fixture.detectChanges();
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
expect(processSpy).toHaveBeenCalled();
|
||||||
|
expect(controller).toBeDefined();
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
it('should display filter name as title', async(() => {
|
it('should display filter name as title', async(() => {
|
||||||
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
const taskFilterIdChange = new SimpleChange(undefined, 'mock-task-filter-id', true);
|
||||||
component.ngOnChanges({ 'id': taskFilterIdChange });
|
component.ngOnChanges({ 'id': taskFilterIdChange });
|
||||||
|
@ -31,6 +31,8 @@ import { TranslationService, UserPreferencesService, UserPreferenceValues } from
|
|||||||
import { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service';
|
import { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service';
|
||||||
import { ApplicationInstanceModel } from '../../../app/models/application-instance.model';
|
import { ApplicationInstanceModel } from '../../../app/models/application-instance.model';
|
||||||
import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.model';
|
import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.model';
|
||||||
|
import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud.model';
|
||||||
|
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-cloud-edit-task-filter',
|
selector: 'adf-cloud-edit-task-filter',
|
||||||
@ -44,6 +46,7 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
public static ACTION_DELETE = 'delete';
|
public static ACTION_DELETE = 'delete';
|
||||||
public static APP_RUNNING_STATUS: string = 'RUNNING';
|
public static APP_RUNNING_STATUS: string = 'RUNNING';
|
||||||
public static APPLICATION_NAME: string = 'appName';
|
public static APPLICATION_NAME: string = 'appName';
|
||||||
|
public static PROCESS_DEFINITION_NAME: string = 'processDefinitionName';
|
||||||
public static LAST_MODIFIED: string = 'lastModified';
|
public static LAST_MODIFIED: string = 'lastModified';
|
||||||
public static SORT: string = 'sort';
|
public static SORT: string = 'sort';
|
||||||
public static ORDER: string = 'order';
|
public static ORDER: string = 'order';
|
||||||
@ -116,8 +119,10 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
EditTaskFilterCloudComponent.ACTION_SAVE,
|
EditTaskFilterCloudComponent.ACTION_SAVE,
|
||||||
EditTaskFilterCloudComponent.ACTION_DELETE
|
EditTaskFilterCloudComponent.ACTION_DELETE
|
||||||
];
|
];
|
||||||
|
allProcessDefinitionNamesOption = { label: 'All', value: '' };
|
||||||
|
|
||||||
private applicationNames: any[] = [];
|
private applicationNames: any[] = [];
|
||||||
|
private processDefinitionNames: any[] = [];
|
||||||
private formHasBeenChanged = false;
|
private formHasBeenChanged = false;
|
||||||
editTaskFilterForm: FormGroup;
|
editTaskFilterForm: FormGroup;
|
||||||
taskFilterProperties: TaskFilterProperties[] = [];
|
taskFilterProperties: TaskFilterProperties[] = [];
|
||||||
@ -134,7 +139,8 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
private taskFilterCloudService: TaskFilterCloudService,
|
private taskFilterCloudService: TaskFilterCloudService,
|
||||||
private dateAdapter: DateAdapter<Moment>,
|
private dateAdapter: DateAdapter<Moment>,
|
||||||
private userPreferencesService: UserPreferencesService,
|
private userPreferencesService: UserPreferencesService,
|
||||||
private appsProcessCloudService: AppsProcessCloudService) {
|
private appsProcessCloudService: AppsProcessCloudService,
|
||||||
|
private taskCloudService: TaskCloudService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -227,10 +233,14 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
createAndFilterProperties() {
|
createAndFilterProperties() {
|
||||||
this.checkMandatoryFilterProperties();
|
this.checkMandatoryFilterProperties();
|
||||||
|
|
||||||
if (this.checkForApplicationNameProperty()) {
|
if (this.checkForProperty(EditTaskFilterCloudComponent.APPLICATION_NAME)) {
|
||||||
this.applicationNames = [];
|
this.applicationNames = [];
|
||||||
this.getRunningApplications();
|
this.getRunningApplications();
|
||||||
}
|
}
|
||||||
|
if (this.checkForProperty(EditTaskFilterCloudComponent.PROCESS_DEFINITION_NAME)) {
|
||||||
|
this.processDefinitionNames = [];
|
||||||
|
this.getProcessDefinitions();
|
||||||
|
}
|
||||||
|
|
||||||
const defaultProperties = this.createTaskFilterProperties(this.taskFilter);
|
const defaultProperties = this.createTaskFilterProperties(this.taskFilter);
|
||||||
let filteredProperties = defaultProperties.filter((filterProperty: TaskFilterProperties) => this.isValidProperty(this.filterProperties, filterProperty));
|
let filteredProperties = defaultProperties.filter((filterProperty: TaskFilterProperties) => this.isValidProperty(this.filterProperties, filterProperty));
|
||||||
@ -255,8 +265,8 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
return filterProperties ? filterProperties.indexOf(filterProperty.key) >= 0 : true;
|
return filterProperties ? filterProperties.indexOf(filterProperty.key) >= 0 : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForApplicationNameProperty(): boolean {
|
checkForProperty(property: string): boolean {
|
||||||
return this.filterProperties ? this.filterProperties.indexOf(EditTaskFilterCloudComponent.APPLICATION_NAME) >= 0 : false;
|
return this.filterProperties ? this.filterProperties.indexOf(property) >= 0 : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hasSortProperty(): boolean {
|
hasSortProperty(): boolean {
|
||||||
@ -359,6 +369,19 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getProcessDefinitions() {
|
||||||
|
this.taskCloudService.getProcessDefinitions(this.appName)
|
||||||
|
.pipe(takeUntil(this.onDestroy$))
|
||||||
|
.subscribe((processDefinitions: ProcessDefinitionCloud[]) => {
|
||||||
|
if (processDefinitions && processDefinitions.length > 0) {
|
||||||
|
this.processDefinitionNames.push(this.allProcessDefinitionNamesOption);
|
||||||
|
processDefinitions.map((processDefinition) => {
|
||||||
|
this.processDefinitionNames.push({ label: processDefinition.name, value: processDefinition.name });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
executeFilterActions(action: TaskFilterAction): void {
|
executeFilterActions(action: TaskFilterAction): void {
|
||||||
if (action.actionType === EditTaskFilterCloudComponent.ACTION_SAVE) {
|
if (action.actionType === EditTaskFilterCloudComponent.ACTION_SAVE) {
|
||||||
this.save(action);
|
this.save(action);
|
||||||
@ -567,6 +590,13 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
key: 'assignee',
|
key: 'assignee',
|
||||||
value: currentTaskFilter.assignee || ''
|
value: currentTaskFilter.assignee || ''
|
||||||
}),
|
}),
|
||||||
|
new TaskFilterProperties({
|
||||||
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_DEF_NAME',
|
||||||
|
type: 'select',
|
||||||
|
key: 'processDefinitionName',
|
||||||
|
value: currentTaskFilter.processDefinitionName || '',
|
||||||
|
options: this.processDefinitionNames
|
||||||
|
}),
|
||||||
new TaskFilterProperties({
|
new TaskFilterProperties({
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_INSTANCE_ID',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_INSTANCE_ID',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
|
@ -29,6 +29,7 @@ export class TaskFilterCloudModel {
|
|||||||
assignee: string;
|
assignee: string;
|
||||||
order: string;
|
order: string;
|
||||||
owner: string;
|
owner: string;
|
||||||
|
processDefinitionName?: string;
|
||||||
processDefinitionId: string;
|
processDefinitionId: string;
|
||||||
processInstanceId: string;
|
processInstanceId: string;
|
||||||
createdDate: Date;
|
createdDate: Date;
|
||||||
@ -56,6 +57,7 @@ export class TaskFilterCloudModel {
|
|||||||
this.assignee = obj.assignee || null;
|
this.assignee = obj.assignee || null;
|
||||||
this.order = obj.order || null;
|
this.order = obj.order || null;
|
||||||
this.owner = obj.owner || null;
|
this.owner = obj.owner || null;
|
||||||
|
this.processDefinitionName = obj.processDefinitionName || null;
|
||||||
this.processDefinitionId = obj.processDefinitionId || null;
|
this.processDefinitionId = obj.processDefinitionId || null;
|
||||||
this.processInstanceId = obj.processInstanceId || null;
|
this.processInstanceId = obj.processInstanceId || null;
|
||||||
this.createdDate = obj.createdDate || null;
|
this.createdDate = obj.createdDate || null;
|
||||||
|
@ -90,6 +90,10 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
|
|||||||
@Input()
|
@Input()
|
||||||
parentTaskId: string = '';
|
parentTaskId: string = '';
|
||||||
|
|
||||||
|
/** Filter the tasks. Display only tasks with processDefinitionName equal to the supplied value. */
|
||||||
|
@Input()
|
||||||
|
processDefinitionName: string = '';
|
||||||
|
|
||||||
/** Filter the tasks. Display only tasks with processDefinitionId equal to the supplied value. */
|
/** Filter the tasks. Display only tasks with processDefinitionId equal to the supplied value. */
|
||||||
@Input()
|
@Input()
|
||||||
processDefinitionId: string = '';
|
processDefinitionId: string = '';
|
||||||
@ -346,6 +350,7 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
|
|||||||
id: this.id,
|
id: this.id,
|
||||||
name: this.name,
|
name: this.name,
|
||||||
parentTaskId: this.parentTaskId,
|
parentTaskId: this.parentTaskId,
|
||||||
|
processDefinitionName: this.processDefinitionName,
|
||||||
processDefinitionId: this.processDefinitionId,
|
processDefinitionId: this.processDefinitionId,
|
||||||
processInstanceId: this.processInstanceId,
|
processInstanceId: this.processInstanceId,
|
||||||
owner: this.owner,
|
owner: this.owner,
|
||||||
|
@ -36,6 +36,7 @@ export class TaskQueryCloudRequestModel {
|
|||||||
standalone?: boolean;
|
standalone?: boolean;
|
||||||
priority?: number;
|
priority?: number;
|
||||||
processDefinitionId?: string;
|
processDefinitionId?: string;
|
||||||
|
processDefinitionName?: string;
|
||||||
processInstanceId?: string;
|
processInstanceId?: string;
|
||||||
status?: string;
|
status?: string;
|
||||||
maxItems: number;
|
maxItems: number;
|
||||||
@ -62,6 +63,7 @@ export class TaskQueryCloudRequestModel {
|
|||||||
this.standalone = obj.standalone;
|
this.standalone = obj.standalone;
|
||||||
this.priority = obj.priority;
|
this.priority = obj.priority;
|
||||||
this.processDefinitionId = obj.processDefinitionId;
|
this.processDefinitionId = obj.processDefinitionId;
|
||||||
|
this.processDefinitionName = obj.processDefinitionName;
|
||||||
this.processInstanceId = obj.processInstanceId;
|
this.processInstanceId = obj.processInstanceId;
|
||||||
this.status = obj.status;
|
this.status = obj.status;
|
||||||
this.maxItems = obj.maxItems;
|
this.maxItems = obj.maxItems;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user