[ADF-3976] EditTaskComponent - Be able to customise the sorting and actions (#4251)

* [ADF-3841] Improve edit-task-filter-cloud by adding inputs to control filters, sort and actions* Provided an input to pass  sort properties* Provided an input to pass filter actions

* * Provided way to configure sort and action properties from app.config
* Updated unit tests the recent changes

* * Added missing properties* Removed unwanted properties* Provided a way to to show range when the lastModified is passed* Fixed order should be visible if sort as been passed

* * Provided way to show checkbox

* * Changed to state, assignment to status and assignee* Updated Document* Updated unit tests

* * Removed unnecessary mock object

* * Removed FilterActionType * Updated documentation

* * Modified editTaskFilterCLoud component e2e tests to the recent changes

* * Fixed e2e tests

* * Fixed failing e2e test

* * Removed unwanted comment

* * After rebase

* * After rebase

* * After rebase

* * Fixed e2e conflict
This commit is contained in:
siva kumar
2019-03-20 21:19:54 +05:30
committed by Eugenio Romano
parent 355e97ef39
commit dccc6b8127
20 changed files with 609 additions and 533 deletions

View File

@@ -114,7 +114,7 @@
"APP_NAME": "ApplicationName",
"PROCESS_DEF_ID": "ProcessDefinitionId",
"STATUS": "Status",
"ASSIGNMENT": "Assignment",
"ASSIGNMENT": "Assignee",
"DIRECTION": "Direction",
"PROCESS_INSTANCE_ID": "ProcessInstanceId",
"TASK_NAME": "TaskName",
@@ -124,8 +124,9 @@
"LAST_MODIFIED_FROM": "LastModifiedFrom",
"LAST_MODIFIED_TO": "LastModifiedTo",
"OWNER": "Owner",
"SORT": "Sort"
"DUE_DATE": "DueDate",
"SORT": "Sort",
"START_DATE": "StartDate"
},
"DIALOG": {
"TITLE": "Save filter as",
@@ -139,7 +140,7 @@
"APP_NAME": "ApplicationName",
"STATUS": "Status",
"INITIATOR": "Initiator",
"ASSIGNMENT": "Assignment",
"ASSIGNMENT": "Assignee",
"SORT": "Sort",
"DIRECTION": "Direction",
"PROCESS_DEF_ID": "ProcessDefinitionId",

View File

@@ -6,14 +6,8 @@
<span *ngIf="showTitle">{{ 'ADF_CLOUD_EDIT_TASK_FILTER.TITLE' | translate}}</span>
<div *ngIf="showActions()" class="adf-cloud-edit-task-filter-actions">
<ng-container *ngIf="toggleFilterActions">
<button mat-icon-button matTooltip="{{'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.SAVE' | translate}}" id="adf-save-id" [disabled]="!formHasBeenChanged" (click)="onSave()">
<mat-icon>save</mat-icon>
</button>
<button mat-icon-button matTooltip="{{'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.SAVE_AS' | translate}}" id="adf-save-as-id" [disabled]="!formHasBeenChanged" (click)="onSaveAs()">
<mat-icon>unarchive</mat-icon>
</button>
<button mat-icon-button matTooltip="{{'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.DELETE' | translate}}" id="adf-delete-id" (click)="onDelete()">
<mat-icon>delete</mat-icon>
<button *ngFor="let filterAction of taskFilterActions" mat-icon-button matTooltip="{{ filterAction.tooltip | translate}}" [attr.data-automation-id]="'adf-filter-action-' + filterAction.actionType" [disabled]="hasFormChanged(filterAction)" (click)="executeFilterActions(filterAction)">
<mat-icon>{{filterAction.icon}}</mat-icon>
</button>
</ng-container>
</div>
@@ -27,7 +21,7 @@
placeholder="{{taskFilterProperty.label | translate}}"
[formControlName]="taskFilterProperty.key"
[attr.data-automation-id]="'adf-cloud-edit-task-property-' + taskFilterProperty.key">
<mat-option *ngFor="let propertyOption of taskFilterProperty.options" [value]="propertyOption.value" [attr.data-automation-id]="'adf-cloud-edit-task-property-options' + taskFilterProperty.key">
<mat-option *ngFor="let propertyOption of taskFilterProperty.options" [value]="propertyOption.value" [attr.data-automation-id]="'adf-cloud-edit-task-property-options-' + taskFilterProperty.key">
{{ propertyOption.label }}
</mat-option>
</mat-select>
@@ -50,8 +44,8 @@
[(ngModel)]="dateFilter[taskFilterProperty.key]"
[ngModelOptions]="{standalone: true}"
[attr.data-automation-id]="'adf-cloud-edit-task-property-' + taskFilterProperty.key">
<mat-datepicker-toggle matSuffix [for]="dateController" [attr.data-automation-id]="'adf-cloud-edit-task-property-date-toggle' + taskFilterProperty.key"></mat-datepicker-toggle>
<mat-datepicker #dateController [attr.data-automation-id]="'adf-cloud-edit-task-property-date-picker' + taskFilterProperty.key"></mat-datepicker>
<mat-datepicker-toggle matSuffix [for]="dateController" [attr.data-automation-id]="'adf-cloud-edit-task-property-date-toggle-' + taskFilterProperty.key"></mat-datepicker-toggle>
<mat-datepicker #dateController [attr.data-automation-id]="'adf-cloud-edit-task-property-date-picker-' + taskFilterProperty.key"></mat-datepicker>
<div class="adf-edit-task-filter-date-error-container">
<div *ngIf="hasError(taskFilterProperty)">
<div class="adf-error-text">{{'ADF_TASK_LIST.START_TASK.FORM.ERROR.DATE'|translate}}</div>
@@ -59,6 +53,14 @@
</div>
</div>
</mat-form-field>
<div fxFlex="23%" class="adf-edit-task-filter-checkbox" *ngIf="isCheckBoxType(taskFilterProperty)">
<mat-checkbox
color="primary"
[formControlName]="taskFilterProperty.key"
[attr.data-automation-id]="taskFilterProperty.key">
{{taskFilterProperty.label | translate}}
</mat-checkbox>
</div>
</ng-container>
</div>
</form>

View File

@@ -2,6 +2,12 @@
$warn: map-get($theme, warn);
.adf-edit-task-filter-checkbox {
font-size: 16px;
padding-top: 10px;
text-align: center;
}
.adf-edit-task-filter-date-error-container {
position: absolute;
height: 20px;

View File

@@ -26,11 +26,11 @@ import { of } from 'rxjs';
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
import { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service';
import { fakeApplicationInstance } from '../../../app/mock/app-model.mock';
import { TaskFilterCloudModel } from '../models/filter-cloud.model';
import { TaskFiltersCloudModule } from '../task-filters-cloud.module';
import { EditTaskFilterCloudComponent } from './edit-task-filter-cloud.component';
import { TaskFilterCloudService } from '../services/task-filter-cloud.service';
import { TaskFilterDialogCloudComponent } from './task-filter-dialog-cloud.component';
import { fakeFilter } from '../mock/task-filters-cloud.mock';
describe('EditTaskFilterCloudComponent', () => {
let component: EditTaskFilterCloudComponent;
@@ -41,18 +41,6 @@ describe('EditTaskFilterCloudComponent', () => {
let getTaskFilterSpy: jasmine.Spy;
let getRunningApplicationsSpy: jasmine.Spy;
let fakeFilter = new TaskFilterCloudModel({
name: 'FakeInvolvedTasks',
icon: 'adjust',
id: 'mock-task-filter-id',
state: 'CREATED',
appName: 'mock-app-name',
processDefinitionId: 'process-def-id',
assignment: 'fake-involved',
order: 'ASC',
sort: 'id'
});
setupTestBed({
imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule],
providers: [MatDialog]
@@ -86,7 +74,7 @@ describe('EditTaskFilterCloudComponent', () => {
expect(getTaskFilterSpy).toHaveBeenCalled();
expect(component.taskFilter.name).toEqual('FakeInvolvedTasks');
expect(component.taskFilter.icon).toEqual('adjust');
expect(component.taskFilter.state).toEqual('CREATED');
expect(component.taskFilter.status).toEqual('CREATED');
expect(component.taskFilter.order).toEqual('ASC');
expect(component.taskFilter.sort).toEqual('id');
});
@@ -119,20 +107,20 @@ describe('EditTaskFilterCloudComponent', () => {
it('should create editTaskFilter form with default properties', async(() => {
fixture.detectChanges();
fixture.whenStable().then(() => {
const stateController = component.editTaskFilterForm.get('state');
const stateController = component.editTaskFilterForm.get('status');
const sortController = component.editTaskFilterForm.get('sort');
const orderController = component.editTaskFilterForm.get('order');
const assignmentController = component.editTaskFilterForm.get('assignment');
const assigneeController = component.editTaskFilterForm.get('assignee');
expect(component.editTaskFilterForm).toBeDefined();
expect(stateController).toBeDefined();
expect(sortController).toBeDefined();
expect(orderController).toBeDefined();
expect(assignmentController).toBeDefined();
expect(assigneeController).toBeDefined();
expect(stateController.value).toBe('CREATED');
expect(sortController.value).toBe('id');
expect(orderController.value).toBe('ASC');
expect(assignmentController.value).toBe('fake-involved');
expect(assigneeController.value).toBe('fake-involved');
});
}));
@@ -142,7 +130,7 @@ describe('EditTaskFilterCloudComponent', () => {
expansionPanel.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
let saveButton = fixture.debugElement.nativeElement.querySelector('#adf-save-id');
let saveButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-save"]');
expect(saveButton.disabled).toBe(true);
});
}));
@@ -153,7 +141,7 @@ describe('EditTaskFilterCloudComponent', () => {
expansionPanel.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
let saveButton = fixture.debugElement.nativeElement.querySelector('#adf-save-as-id');
let saveButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-saveAs"]');
expect(saveButton.disabled).toBe(true);
});
}));
@@ -165,7 +153,7 @@ describe('EditTaskFilterCloudComponent', () => {
expansionPanel.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
let deleteButton = fixture.debugElement.nativeElement.querySelector('#adf-delete-id');
let deleteButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-delete"]');
expect(deleteButton.disabled).toBe(false);
});
}));
@@ -176,26 +164,26 @@ describe('EditTaskFilterCloudComponent', () => {
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
expansionPanel.click();
fixture.detectChanges();
let stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-state"]');
let assignmentElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-assignment"]');
let stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-status"]');
let assigneeElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-assignee"]');
let sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
let orderElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-order"]');
expect(stateElement).toBeDefined();
expect(assignmentElement).toBeDefined();
expect(assigneeElement).toBeDefined();
expect(sortElement).toBeDefined();
expect(orderElement).toBeDefined();
expect(stateElement.textContent.trim()).toBe('CREATED');
expect(sortElement.textContent.trim()).toBe('ID');
expect(sortElement.textContent.trim()).toBe('Id');
expect(orderElement.textContent.trim()).toBe('ASC');
});
}));
it('should display state drop down', async(() => {
it('should display status drop down', async(() => {
fixture.detectChanges();
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
expansionPanel.click();
fixture.detectChanges();
let stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-state"] .mat-select-trigger');
let stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-status"] .mat-select-trigger');
stateElement.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -214,7 +202,7 @@ describe('EditTaskFilterCloudComponent', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
const sortOptions = fixture.debugElement.queryAll(By.css('.mat-option-text'));
expect(sortOptions.length).toEqual(5);
expect(sortOptions.length).toEqual(4);
});
}));
@@ -237,7 +225,7 @@ describe('EditTaskFilterCloudComponent', () => {
component.ngOnChanges({ 'id': taskFilterIDchange});
component.filterProperties = [];
fixture.detectChanges();
const stateController = component.editTaskFilterForm.get('state');
const stateController = component.editTaskFilterForm.get('status');
const sortController = component.editTaskFilterForm.get('sort');
const orderController = component.editTaskFilterForm.get('order');
fixture.whenStable().then(() => {
@@ -253,15 +241,9 @@ describe('EditTaskFilterCloudComponent', () => {
expect(orderController.value).toBe('ASC');
});
}));
});
describe('Task filterProperties', () => {
beforeEach(() => {
component.filterProperties = ['appName', 'processInstanceId', 'priority'];
});
it('should able to fetch running applications when appName property defined in the input', async(() => {
component.filterProperties = ['appName', 'processInstanceId', 'priority'];
fixture.detectChanges();
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
component.ngOnChanges({ 'id': taskFilterIDchange});
@@ -273,26 +255,141 @@ describe('EditTaskFilterCloudComponent', () => {
expect(appController.value).toBe('mock-app-name');
});
}));
});
it('should able to build a editTaskFilter form with given input properties', async(() => {
fixture.detectChanges();
getTaskFilterSpy.and.returnValue({ appName: 'mock-app-name', processInstanceId: 'process-instance-id', priority: '12' });
describe('sort properties', () => {
it('should display default sort properties', async(() => {
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
component.ngOnChanges({ 'id': taskFilterIDchange});
fixture.detectChanges();
const appController = component.editTaskFilterForm.get('appName');
const priorityController = component.editTaskFilterForm.get('priority');
const processInsIdController = component.editTaskFilterForm.get('processInstanceId');
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
expansionPanel.click();
fixture.detectChanges();
let sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
sortElement.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(component.taskFilterProperties).toBeDefined();
expect(component.editTaskFilterForm).toBeDefined();
expect(component.taskFilterProperties.length).toBe(3);
expect(appController).toBeDefined();
expect(priorityController.value).toBe('12');
expect(processInsIdController).toBeDefined();
expect(appController.value).toBe('mock-app-name');
const sortController = component.editTaskFilterForm.get('sort');
const sortOptions = fixture.debugElement.queryAll(By.css('.mat-option-text'));
expect(sortController).toBeDefined();
expect(sortController.value).toBe('id');
expect(sortOptions.length).toEqual(4);
});
}));
it('should display sort properties when sort properties are specified', async(() => {
component.sortProperties = ['id', 'name', 'processInstanceId'];
getTaskFilterSpy.and.returnValue({ sort: 'my-custom-sort', processInstanceId: 'process-instance-id', priority: '12' });
fixture.detectChanges();
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
component.ngOnChanges({ 'id': taskFilterIDchange});
fixture.detectChanges();
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
expansionPanel.click();
fixture.detectChanges();
let sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
sortElement.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
const sortController = component.editTaskFilterForm.get('sort');
const sortOptions = fixture.debugElement.queryAll(By.css('.mat-option-text'));
expect(sortController).toBeDefined();
expect(component.sortProperties).toBeDefined();
expect(component.sortProperties.length).toBe(3);
expect(sortController.value).toBe('my-custom-sort');
expect(sortOptions.length).toEqual(3);
});
}));
it('should display default sort properties if input is empty', async(() => {
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
component.ngOnChanges({ 'id': taskFilterIDchange});
fixture.detectChanges();
component.sortProperties = [];
fixture.detectChanges();
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
expansionPanel.click();
fixture.detectChanges();
let sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"]');
sortElement.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
const sortController = component.editTaskFilterForm.get('sort');
const sortOptions = fixture.debugElement.queryAll(By.css('.mat-option-text'));
expect(sortController).toBeDefined();
expect(sortController.value).toBe('id');
expect(sortOptions.length).toEqual(4);
});
}));
});
describe('filter actions', () => {
it('should display default filter actions', async(() => {
component.toggleFilterActions = true;
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
component.ngOnChanges({ 'id': taskFilterIDchange});
fixture.detectChanges();
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
expansionPanel.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
const saveAsButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-saveAs"]');
const saveButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-save"]');
const deleteButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-delete"]');
expect(component.taskFilterActions).toBeDefined();
expect(component.taskFilterActions.length).toBe(3);
expect(saveButton).toBeDefined();
expect(saveAsButton).toBeDefined();
expect(deleteButton).toBeDefined();
expect(saveButton.disabled).toBeTruthy();
expect(saveAsButton.disabled).toBeTruthy(false);
expect(deleteButton.disabled).toBe(false);
});
}));
it('should display filter actions when input actions are specified', async(() => {
component.actions = ['save'];
fixture.detectChanges();
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
component.ngOnChanges({ 'id': taskFilterIDchange});
fixture.detectChanges();
component.toggleFilterActions = true;
fixture.detectChanges();
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
expansionPanel.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
const saveButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-save"]');
expect(component.taskFilterActions).toBeDefined();
expect(component.taskFilterActions.length).toBe(1);
expect(saveButton).toBeDefined();
expect(saveButton.disabled).toBeTruthy();
});
}));
it('should display default filter actions if input is empty', async(() => {
component.toggleFilterActions = true;
component.actions = [];
let taskFilterIDchange = new SimpleChange(undefined, 'mock-task-filter-id', true);
component.ngOnChanges({ 'id': taskFilterIDchange});
fixture.detectChanges();
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
expansionPanel.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
const saveAsButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-saveAs"]');
const saveButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-save"]');
const deleteButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-delete"]');
expect(component.taskFilterActions).toBeDefined();
expect(component.taskFilterActions.length).toBe(3);
expect(saveButton).toBeDefined();
expect(saveAsButton).toBeDefined();
expect(deleteButton).toBeDefined();
expect(saveButton.disabled).toBeTruthy();
expect(saveAsButton.disabled).toBeTruthy(false);
expect(deleteButton.disabled).toBe(false);
});
}));
});
@@ -317,10 +414,10 @@ describe('EditTaskFilterCloudComponent', () => {
let stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"] .mat-select-trigger');
stateElement.click();
fixture.detectChanges();
const stateOptions = fixture.debugElement.queryAll(By.css('.mat-option-text'));
stateOptions[3].nativeElement.click();
const sortOptions = fixture.debugElement.queryAll(By.css('.mat-option-text'));
sortOptions[3].nativeElement.click();
fixture.detectChanges();
const saveButton = fixture.debugElement.nativeElement.querySelector('#adf-save-id');
const saveButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-save"]');
saveButton.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -340,7 +437,7 @@ describe('EditTaskFilterCloudComponent', () => {
let stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"] .mat-select-trigger');
stateElement.click();
fixture.detectChanges();
let deleteButton = fixture.debugElement.nativeElement.querySelector('#adf-delete-id');
let deleteButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-delete"]');
deleteButton.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
@@ -357,14 +454,14 @@ describe('EditTaskFilterCloudComponent', () => {
let expansionPanel = fixture.debugElement.nativeElement.querySelector('mat-expansion-panel-header');
expansionPanel.click();
fixture.detectChanges();
let stateElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"] .mat-select-trigger');
stateElement.click();
let sortElement = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-cloud-edit-task-property-sort"] .mat-select-trigger');
sortElement.click();
fixture.detectChanges();
const saveButton = fixture.debugElement.nativeElement.querySelector('#adf-save-as-id');
const stateOptions = fixture.debugElement.queryAll(By.css('.mat-option-text'));
stateOptions[2].nativeElement.click();
const saveAsButton = fixture.debugElement.nativeElement.querySelector('[data-automation-id="adf-filter-action-saveAs"]');
const sortOptions = fixture.debugElement.queryAll(By.css('.mat-option-text'));
sortOptions[2].nativeElement.click();
fixture.detectChanges();
saveButton.click();
saveAsButton.click();
fixture.detectChanges();
fixture.whenStable().then(() => {
expect(saveAsFilterSpy).toHaveBeenCalled();

View File

@@ -17,7 +17,7 @@
import { Component, OnChanges, Input, Output, EventEmitter, SimpleChanges, OnInit } from '@angular/core';
import { AbstractControl, FormGroup, FormBuilder } from '@angular/forms';
import { TaskFilterCloudModel, FilterActionType, TaskFilterProperties } from './../models/filter-cloud.model';
import { TaskFilterCloudModel, TaskFilterProperties, FilterOptions, TaskFilterAction } from './../models/filter-cloud.model';
import { TaskFilterCloudService } from '../services/task-filter-cloud.service';
import { MatDialog, DateAdapter } from '@angular/material';
import { TaskFilterDialogCloudComponent } from './task-filter-dialog-cloud.component';
@@ -35,13 +35,18 @@ import { Moment } from 'moment';
})
export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
public static ACTION_SAVE = 'SAVE';
public static ACTION_SAVE_AS = 'SAVE_AS';
public static ACTION_DELETE = 'DELETE';
public static ACTION_SAVE = 'save';
public static ACTION_SAVE_AS = 'saveAs';
public static ACTION_DELETE = 'delete';
public static APP_RUNNING_STATUS: string = 'RUNNING';
public static MIN_VALUE = 1;
public static APPLICATION_NAME: string = 'appName';
public static DEFAULT_TASK_FILTER_PROPERTIES = ['state', 'assignment', 'sort', 'order'];
public static LAST_MODIFIED: string = 'lastModified';
public static SORT: string = 'sort';
public static ORDER: string = 'order';
public static DEFAULT_TASK_FILTER_PROPERTIES = ['status', 'assignee', 'sort', 'order'];
public static DEFAULT_SORT_PROPERTIES = ['id', 'name', 'createdDate', 'priority'];
public static DEFAULT_ACTIONS = ['save', 'saveAs', 'delete'];
public FORMAT_DATE: string = 'DD/MM/YYYY';
/** (required) Name of the app. */
@@ -54,7 +59,15 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
/** List of task filter properties to display. */
@Input()
filterProperties: string[] = EditTaskFilterCloudComponent.DEFAULT_TASK_FILTER_PROPERTIES; // default ['state', 'assignment', 'sort', 'order']
filterProperties: string[] = EditTaskFilterCloudComponent.DEFAULT_TASK_FILTER_PROPERTIES;
/** List of sort properties to display. */
@Input()
sortProperties: string[] = EditTaskFilterCloudComponent.DEFAULT_SORT_PROPERTIES;
/** List of task filter actions. */
@Input()
actions: string[] = EditTaskFilterCloudComponent.DEFAULT_ACTIONS;
/** Toggles the filter actions. */
@Input()
@@ -70,19 +83,11 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
/** Emitted when a filter action occurs (i.e Save, Save As, Delete). */
@Output()
action: EventEmitter<FilterActionType> = new EventEmitter();
action: EventEmitter<TaskFilterAction> = new EventEmitter();
taskFilter: TaskFilterCloudModel;
changedTaskFilter: TaskFilterCloudModel;
columns = [
{ value: 'id', label: 'ID' },
{ value: 'name', label: 'NAME' },
{ value: 'createdDate', label: 'Created Date' },
{ value: 'priority', label: 'PRIORITY' },
{ value: 'processDefinitionId', label: 'PROCESS DEFINITION ID' }
];
status = [
{ label: 'ALL', value: '' },
{ label: 'CREATED', value: 'CREATED' },
@@ -102,7 +107,8 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
dateFilter: any[] = [];
formHasBeenChanged = false;
editTaskFilterForm: FormGroup;
taskFilterProperties: any[] = [];
taskFilterProperties: TaskFilterProperties[] = [];
taskFilterActions: TaskFilterAction[] = [];
toggleFilterActions: boolean = false;
constructor(
@@ -125,6 +131,7 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
const id = changes['id'];
if (id && id.currentValue !== id.previousValue) {
this.taskFilterProperties = this.createAndFilterProperties();
this.taskFilterActions = this.createAndFilterActions();
this.buildForm(this.taskFilterProperties);
}
}
@@ -162,13 +169,25 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
createAndFilterProperties(): TaskFilterProperties[] {
this.checkMandatoryFilterProperties();
if (this.checkForApplicationNameProperty()) {
this.applicationNames = [];
this.getRunningApplications();
}
this.taskFilter = this.retrieveTaskFilter();
const defaultProperties = this.createTaskFilterProperties(this.taskFilter);
return defaultProperties.filter((filterProperty: TaskFilterProperties) => this.isValidProperty(this.filterProperties, filterProperty));
let filteredProperties = defaultProperties.filter((filterProperty: TaskFilterProperties) => this.isValidProperty(this.filterProperties, filterProperty));
if (!this.hasSortProperty()) {
filteredProperties = this.removeOrderProperty(filteredProperties);
}
if (this.hasLastModifiedProperty()) {
filteredProperties = [...filteredProperties, ...this.createLastModifiedProperty()];
}
return filteredProperties;
}
checkMandatoryFilterProperties() {
@@ -185,6 +204,51 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
return this.filterProperties ? this.filterProperties.indexOf(EditTaskFilterCloudComponent.APPLICATION_NAME) >= 0 : false;
}
hasSortProperty(): boolean {
return this.filterProperties.indexOf(EditTaskFilterCloudComponent.SORT) >= 0;
}
removeOrderProperty(filteredProperties: TaskFilterProperties[]) {
if (filteredProperties && filteredProperties.length > 0) {
const propertiesWithOutOrderProperty = filteredProperties.filter((property: TaskFilterProperties) => { return property.key !== EditTaskFilterCloudComponent.ORDER; });
return propertiesWithOutOrderProperty;
}
}
hasLastModifiedProperty(): boolean {
return this.filterProperties.indexOf(EditTaskFilterCloudComponent.LAST_MODIFIED) >= 0;
}
createSortProperties(): any {
this.checkMandatorySortProperties();
const sortProperties = this.sortProperties.map((property: string) => {
return <FilterOptions> { label: property.charAt(0).toUpperCase() + property.slice(1), value: property };
});
return sortProperties;
}
checkMandatorySortProperties() {
if (this.sortProperties === undefined || this.sortProperties.length === 0) {
this.sortProperties = EditTaskFilterCloudComponent.DEFAULT_SORT_PROPERTIES;
}
}
createAndFilterActions() {
this.checkMandatoryActions();
const allActions = this.createFilterActions();
return allActions.filter((action: TaskFilterAction) => this.isValidAction(this.actions, action));
}
checkMandatoryActions() {
if (this.actions === undefined || this.actions.length === 0) {
this.actions = EditTaskFilterCloudComponent.DEFAULT_ACTIONS;
}
}
private isValidAction(actions: string[], action: any): boolean {
return actions ? actions.indexOf(action.actionType) >= 0 : true;
}
isFormValid(): boolean {
return this.editTaskFilterForm.valid;
}
@@ -228,18 +292,30 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
});
}
onSave() {
executeFilterActions(action: TaskFilterAction): void {
if (action.actionType === EditTaskFilterCloudComponent.ACTION_SAVE) {
this.save(action);
} else if (action.actionType === EditTaskFilterCloudComponent.ACTION_SAVE_AS) {
this.saveAs(action);
} else if (action.actionType === EditTaskFilterCloudComponent.ACTION_DELETE) {
this.delete(action);
}
}
save(saveAction: TaskFilterAction) {
this.taskFilterCloudService.updateFilter(this.changedTaskFilter);
this.action.emit({actionType: EditTaskFilterCloudComponent.ACTION_SAVE, filter: this.changedTaskFilter});
saveAction.filter = this.changedTaskFilter;
this.action.emit(saveAction);
this.formHasBeenChanged = this.compareFilters(this.changedTaskFilter, this.taskFilter);
}
onDelete() {
delete(deleteAction: TaskFilterAction) {
this.taskFilterCloudService.deleteFilter(this.taskFilter);
this.action.emit({actionType: EditTaskFilterCloudComponent.ACTION_DELETE, filter: this.taskFilter});
deleteAction.filter = this.taskFilter;
this.action.emit(deleteAction);
}
onSaveAs() {
saveAs(saveAsAction: TaskFilterAction) {
const dialogRef = this.dialog.open(TaskFilterDialogCloudComponent, {
data: {
name: this.translateService.instant(this.taskFilter.name)
@@ -259,7 +335,8 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
};
const resultFilter = Object.assign({}, this.changedTaskFilter, newFilter);
this.taskFilterCloudService.addFilter(resultFilter);
this.action.emit({actionType: EditTaskFilterCloudComponent.ACTION_SAVE_AS, filter: resultFilter});
saveAsAction.filter = resultFilter;
this.action.emit(saveAsAction);
}
});
@@ -299,6 +376,60 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
return property.type === 'text';
}
isCheckBoxType(property: TaskFilterProperties): boolean {
return property.type === 'checkbox';
}
hasFormChanged(action: any): boolean {
if (action.actionType === EditTaskFilterCloudComponent.ACTION_SAVE) {
return !this.formHasBeenChanged;
}
if (action.actionType === EditTaskFilterCloudComponent.ACTION_SAVE_AS) {
return !this.formHasBeenChanged;
}
if (action.actionType === EditTaskFilterCloudComponent.ACTION_DELETE) {
return false;
}
}
createFilterActions(): TaskFilterAction[] {
return [
new TaskFilterAction({
actionType: EditTaskFilterCloudComponent.ACTION_SAVE,
icon: 'save',
tooltip: 'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.SAVE'
}),
new TaskFilterAction({
actionType: EditTaskFilterCloudComponent.ACTION_SAVE_AS,
icon: 'unarchive',
tooltip: 'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.SAVE_AS'
}),
new TaskFilterAction({
actionType: EditTaskFilterCloudComponent.ACTION_DELETE,
icon: 'delete',
tooltip: 'ADF_CLOUD_EDIT_TASK_FILTER.TOOL_TIP.DELETE'
})
];
}
createLastModifiedProperty(): TaskFilterProperties[] {
return [
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.LAST_MODIFIED_FROM',
type: 'date',
key: 'lastModifiedFrom',
value: ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.LAST_MODIFIED_TO',
type: 'date',
key: 'lastModifiedTo',
value: ''
})
];
}
createTaskFilterProperties(currentTaskFilter: TaskFilterCloudModel): TaskFilterProperties[] {
return [
new TaskFilterProperties({
@@ -311,35 +442,15 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.STATUS',
type: 'select',
key: 'state',
value: currentTaskFilter.state || this.status[0].value,
key: 'status',
value: currentTaskFilter.status || this.status[0].value,
options: this.status
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.ASSIGNMENT',
type: 'text',
key: 'assignment',
value: currentTaskFilter.assignment || ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_DEF_ID',
type: 'text',
key: 'processDefinitionId',
value: currentTaskFilter.processDefinitionId || ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.SORT',
type: 'select',
key: 'sort',
value: currentTaskFilter.sort || this.columns[0].value,
options: this.columns
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DIRECTION',
type: 'select',
key: 'order',
value: currentTaskFilter.order || this.directions[0].value,
options: this.directions
key: 'assignee',
value: currentTaskFilter.assignee || ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_INSTANCE_ID',
@@ -347,6 +458,12 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
key: 'processInstanceId',
value: currentTaskFilter.processInstanceId || ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.PROCESS_DEF_ID',
type: 'text',
key: 'processDefinitionId',
value: currentTaskFilter.processDefinitionId || ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.TASK_NAME',
type: 'text',
@@ -365,31 +482,43 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges {
key: 'priority',
value: currentTaskFilter.priority || ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.STAND_ALONE',
type: 'text',
key: 'standAlone',
value: currentTaskFilter.standAlone || ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.LAST_MODIFIED_FROM',
type: 'date',
key: 'lastModifiedFrom',
value: ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.LAST_MODIFIED_TO',
type: 'date',
key: 'lastModifiedTo',
value: ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.OWNER',
type: 'text',
key: 'owner',
value: currentTaskFilter.owner || ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.CREATED_DATE',
type: 'date',
key: 'createdDate',
value: ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DUE_DATE',
type: 'date',
key: 'dueDate',
value: ''
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.SORT',
type: 'select',
key: 'sort',
value: currentTaskFilter.sort || this.createSortProperties[0].value,
options: this.createSortProperties()
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DIRECTION',
type: 'select',
key: 'order',
value: currentTaskFilter.order || this.directions[0].value,
options: this.directions
}),
new TaskFilterProperties({
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.STAND_ALONE',
type: 'checkbox',
key: 'standAlone',
value: currentTaskFilter.standAlone || false
})
];
}

View File

@@ -19,44 +19,18 @@ import { SimpleChange } from '@angular/core';
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { setupTestBed } from '@alfresco/adf-core';
import { from, Observable } from 'rxjs';
import { TaskFilterCloudModel, FilterParamsModel } from '../models/filter-cloud.model';
import { FilterParamsModel } from '../models/filter-cloud.model';
import { TaskFilterCloudService } from '../services/task-filter-cloud.service';
import { TaskFiltersCloudComponent } from './task-filters-cloud.component';
import { By } from '@angular/platform-browser';
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
import { TaskFiltersCloudModule } from '../task-filters-cloud.module';
import { fakeGlobalFilter } from '../mock/task-filters-cloud.mock';
describe('TaskFiltersCloudComponent', () => {
let taskFilterService: TaskFilterCloudService;
let fakeGlobalFilter = [
new TaskFilterCloudModel({
name: 'FakeInvolvedTasks',
key: 'fake-involved-tasks',
icon: 'adjust',
id: 10,
state: 'open',
assignment: 'fake-involved'
}),
new TaskFilterCloudModel({
name: 'FakeMyTasks1',
key: 'fake-my-tast1',
icon: 'done',
id: 11,
state: 'open',
assignment: 'fake-assignee'
}),
new TaskFilterCloudModel({
name: 'FakeMyTasks2',
key: 'fake-my-tast2',
icon: 'inbox',
id: 12,
state: 'open',
assignment: 'fake-assignee'
})
];
let fakeGlobalFilterObservable =
new Observable(function(observer) {
observer.next(fakeGlobalFilter);

View File

@@ -0,0 +1,57 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { TaskFilterCloudModel } from '../models/filter-cloud.model';
export let fakeGlobalFilter = [
new TaskFilterCloudModel({
name: 'FakeInvolvedTasks',
key: 'fake-involved-tasks',
icon: 'adjust',
id: 10,
status: 'open',
assignee: 'fake-involved'
}),
new TaskFilterCloudModel({
name: 'FakeMyTasks1',
key: 'fake-my-tast1',
icon: 'done',
id: 11,
status: 'open',
assignee: 'fake-assignee'
}),
new TaskFilterCloudModel({
name: 'FakeMyTasks2',
key: 'fake-my-tast2',
icon: 'inbox',
id: 12,
status: 'open',
assignee: 'fake-assignee'
})
];
export let fakeFilter = new TaskFilterCloudModel({
name: 'FakeInvolvedTasks',
icon: 'adjust',
id: 'mock-task-filter-id',
status: 'CREATED',
appName: 'mock-app-name',
processDefinitionId: 'process-def-id',
assignee: 'fake-involved',
order: 'ASC',
sort: 'id'
});

View File

@@ -1,267 +0,0 @@
/*!
* @license
* Copyright 2019 Alfresco Software, Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { FilterRepresentationModel, AppDefinitionRepresentationModel } from '../models/filter-cloud.model';
export let fakeFilters = {
size: 2, total: 2, start: 0,
data: [
new AppDefinitionRepresentationModel(
{
id: 1, name: 'FakeInvolvedTasks', recent: false, icon: 'glyphicon-align-left',
filter: { sort: 'created-desc', name: '', state: 'open', assignment: 'fake-involved' }
}
),
{
id: 2, name: 'FakeMyTasks', recent: false, icon: 'glyphicon-align-left',
filter: { sort: 'created-desc', name: '', state: 'open', assignment: 'fake-assignee' }
}
]
};
export let fakeAppFilter = {
size: 1, total: 1, start: 0,
data: [
{
id: 1, name: 'FakeInvolvedTasks', recent: false, icon: 'glyphicon-align-left',
filter: { sort: 'created-desc', name: '', state: 'open', assignment: 'fake-involved' }
}
]
};
export let fakeApps = {
size: 2, total: 2, start: 0,
data: [
{
id: 1, defaultAppId: null, name: 'Sales-Fakes-App', description: 'desc-fake1', modelId: 22,
theme: 'theme-1-fake', icon: 'glyphicon-asterisk', 'deploymentId': '111', 'tenantId': null
},
{
id: 2, defaultAppId: null, name: 'health-care-Fake', description: 'desc-fake2', modelId: 33,
theme: 'theme-2-fake', icon: 'glyphicon-asterisk', 'deploymentId': '444', 'tenantId': null
}
]
};
export let fakeFilter = {
sort: 'created-desc', text: '', state: 'open', assignment: 'fake-assignee'
};
export let fakeUser1 = { id: 1, email: 'fake-email@dom.com', firstName: 'firstName', lastName: 'lastName' };
export let fakeUser2 = { id: 1001, email: 'some-one@somegroup.com', firstName: 'some', lastName: 'one' };
export let fakeTaskList = {
size: 1, total: 1, start: 0,
data: [
{
id: '1', name: 'FakeNameTask', description: null, category: null,
assignee: fakeUser1,
created: '2016-07-15T11:19:17.440+0000'
}
]
};
export let fakeTaskListDifferentProcessDefinitionKey = {
size: 2, total: 1, start: 0,
data: [
{
id: '1', name: 'FakeNameTask', description: null, category: null,
assignee: fakeUser1,
processDefinitionKey: '1',
created: '2016-07-15T11:19:17.440+0000'
},
{
id: '2', name: 'FakeNameTask2', description: null, category: null,
assignee: fakeUser1,
processDefinitionKey: '2',
created: '2016-07-15T11:19:17.440+0000'
}
]
};
export let secondFakeTaskList = {
size: 1, total: 1, start: 0,
data: [
{
id: '200', name: 'FakeNameTask', description: null, category: null,
assignee: fakeUser1,
created: '2016-07-15T11:19:17.440+0000'
}
]
};
export let mockErrorTaskList = {
error: 'wrong request'
};
export let fakeTaskDetails = { id: '999', name: 'fake-task-name', formKey: '99', assignee: fakeUser1 };
export let fakeTasksComment = {
size: 2, total: 2, start: 0,
data: [
{
id: 1, message: 'fake-message-1', created: '', createdBy: fakeUser1
},
{
id: 2, message: 'fake-message-2', created: '', createdBy: fakeUser1
}
]
};
export let fakeTasksChecklist = {
size: 1, total: 1, start: 0,
data: [
{
id: 1, name: 'FakeCheckTask1', description: null, category: null,
assignee: fakeUser1,
created: '2016-07-15T11:19:17.440+0000'
},
{
id: 2, name: 'FakeCheckTask2', description: null, category: null,
assignee: fakeUser1,
created: '2016-07-15T11:19:17.440+0000'
}
]
};
export let fakeRepresentationFilter1: FilterRepresentationModel = new FilterRepresentationModel({
appId: 1,
name: 'CONTAIN FILTER',
recent: true,
icon: 'glyphicon-align-left',
filter: {
processDefinitionId: null,
processDefinitionKey: null,
name: null,
state: 'open',
sort: 'created-desc',
assignment: 'involved',
dueAfter: null,
dueBefore: null
}
});
export let fakeRepresentationFilter2: FilterRepresentationModel = new FilterRepresentationModel({
appId: 2,
name: 'NO TASK FILTER',
recent: false,
icon: 'glyphicon-inbox',
filter: {
processDefinitionId: null,
processDefinitionKey: null,
name: null,
state: 'open',
sort: 'created-desc',
assignment: 'assignee',
dueAfter: null,
dueBefore: null
}
});
export let fakeAppPromise = new Promise(function (resolve, reject) {
resolve(fakeAppFilter);
});
export let fakeFormList = {
size: 2,
total: 2,
start: 0,
data: [{
id: 1,
name: 'form with all widgets',
description: '',
createdBy: 2,
createdByFullName: 'Admin Admin',
lastUpdatedBy: 2,
lastUpdatedByFullName: 'Admin Admin',
lastUpdated: 1491400951205,
latestVersion: true,
version: 4,
comment: null,
stencilSet: null,
referenceId: null,
modelType: 2,
favorite: null,
permission: 'write',
tenantId: null
}, {
id: 2,
name: 'uppy',
description: '',
createdBy: 2,
createdByFullName: 'Admin Admin',
lastUpdatedBy: 2,
lastUpdatedByFullName: 'Admin Admin',
lastUpdated: 1490951054477,
latestVersion: true,
version: 2,
comment: null,
stencilSet: null,
referenceId: null,
modelType: 2,
favorite: null,
permission: 'write',
tenantId: null
}]
};
export let fakeTaskOpen1 = {
id: '1', name: 'FakeOpenTask1', description: null, category: null,
assignee: fakeUser1,
created: '2017-07-15T11:19:17.440+0000',
dueDate: null,
endDate: null
};
export let fakeTaskOpen2 = {
id: '1', name: 'FakeOpenTask2', description: null, category: null,
assignee: { id: 1, email: 'fake-open-email@dom.com', firstName: 'firstName', lastName: 'lastName' },
created: '2017-07-15T11:19:17.440+0000',
dueDate: null,
endDate: null
};
export let fakeTaskCompleted1 = {
id: '1', name: 'FakeCompletedTaskName1', description: null, category: null,
assignee: { id: 1, email: 'fake-completed-email@dom.com', firstName: 'firstName', lastName: 'lastName' },
created: '2016-07-15T11:19:17.440+0000',
dueDate: null,
endDate: '2016-11-03T15:25:42.749+0000'
};
export let fakeTaskCompleted2 = {
id: '1', name: 'FakeCompletedTaskName2', description: null, category: null,
assignee: fakeUser1,
created: null,
dueDate: null,
endDate: '2016-11-03T15:25:42.749+0000'
};
export let fakeOpenTaskList = {
size: 2,
total: 2,
start: 0,
data: [fakeTaskOpen1, fakeTaskOpen2]
};
export let fakeCompletedTaskList = {
size: 2,
total: 2,
start: 0,
data: [fakeTaskCompleted1, fakeTaskCompleted2]
};

View File

@@ -22,26 +22,19 @@ export class TaskFilterCloudModel {
icon: string;
index: number;
appName: string;
processDefinitionId: string;
state: string;
status: string;
sort: string;
assignment: string;
assignee: string;
order: string;
description: string;
dueAfter: Date;
dueBefore: Date;
owner: string;
processDefinitionId: string;
processInstanceId: string;
claimedDateFrom: Date;
claimedDateTo: Date;
createdDateFrom: Date;
createdDateTo: Date;
dueDateFrom: Date;
dueDateTo: Date;
createdDate: Date;
dueDate: Date;
taskName: string;
parentTaskId: string;
priority: number;
standAlone: any;
standAlone: boolean;
lastModifiedFrom: Date;
lastModifiedTo: Date;
@@ -53,24 +46,17 @@ export class TaskFilterCloudModel {
this.icon = obj.icon || null;
this.index = obj.index || null;
this.appName = obj.appName || null;
this.processDefinitionId = obj.processDefinitionId || null;
this.state = obj.state || null;
this.status = obj.status || null;
this.sort = obj.sort || null;
this.assignment = obj.assignment || null;
this.assignee = obj.assignee || null;
this.order = obj.order || null;
this.description = obj.description || null;
this.dueAfter = obj.dueAfter || null;
this.dueBefore = obj.dueBefore || null;
this.owner = obj.owner || null;
this.processDefinitionId = obj.processDefinitionId || null;
this.processInstanceId = obj.processInstanceId || null;
this.claimedDateFrom = obj.claimedDateFrom || null;
this.claimedDateTo = obj.claimedDateTo || null;
this.createdDateFrom = obj.createdDateFrom || null;
this.createdDateTo = obj.createdDateTo || null;
this.dueDateFrom = obj.dueDateFrom || null;
this.dueDateTo = obj.dueDateTo || null;
this.createdDate = obj.createdDate || null;
this.dueDate = obj.dueDate || null;
this.taskName = obj.taskName || null;
this.parentTaskId = obj.parentTaskId || null;
this.owner = obj.owner;
this.priority = obj.priority || null;
this.standAlone = obj.standAlone || null;
this.lastModifiedFrom = obj.lastModifiedFrom || null;
@@ -95,9 +81,20 @@ export class FilterParamsModel {
}
}
export interface FilterActionType {
export class TaskFilterAction {
actionType: string;
icon: string;
tooltip: string;
filter: TaskFilterCloudModel;
constructor(obj?: any) {
if (obj) {
this.actionType = obj.actionType || null;
this.icon = obj.icon || null;
this.tooltip = obj.tooltip || null;
this.filter = obj.filter || null;
}
}
}
export interface FilterOptions {
@@ -108,7 +105,7 @@ export interface FilterOptions {
export class TaskFilterProperties {
label: string;
type: string;
value: string;
value: any;
key: string;
options: FilterOptions[];

View File

@@ -166,8 +166,8 @@ export class TaskFilterCloudService {
key: 'my-tasks',
icon: 'inbox',
appName: appName,
state: 'ASSIGNED',
assignment: username,
status: 'ASSIGNED',
assignee: username,
sort: 'createdDate',
order: 'DESC'
});
@@ -184,8 +184,8 @@ export class TaskFilterCloudService {
key: 'completed-tasks',
icon: 'done',
appName: appName,
state: 'COMPLETED',
assignment: '',
status: 'COMPLETED',
assignee: '',
sort: 'createdDate',
order: 'DESC'
});

View File

@@ -263,6 +263,8 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
lastModifiedFrom: this.lastModifiedFrom,
lastModifiedTo: this.lastModifiedTo,
status: this.status,
dueDate: this.dueDate,
createdDate: this.createdDate,
maxItems: this.size,
skipCount: this.skipCount,
sorting: this.sorting