TSK-982: Beautify Task-Query for History-Events

This commit is contained in:
BVier 2019-12-09 15:43:38 +01:00 committed by Mustapha Zorgati
parent 0913085c30
commit b0ee202402
3 changed files with 27 additions and 62 deletions

View File

@ -19,52 +19,33 @@ export class TaskQueryService {
queryTask( queryTask(
orderBy: string = 'created', orderBy: string = 'created',
sortDirection: string = Direction.ASC, sortDirection: string = Direction.ASC,
taskId: string, searchForValues: TaskHistoryEventData,
parentBPI: string,
BPI: string,
eventType: string,
userId: string,
domain: string,
workbasketKey: string,
porCompany: string,
porSystem: string,
porInstance: string,
porType: string,
porValue: string,
taskClassificationKey: string,
taskClassificationCategory: string,
attachmentClassificationKey: string,
custom1: string,
custom2: string,
custom3: string,
custom4: string,
created: string,
allPages: boolean = false allPages: boolean = false
): Observable<TaskHistoryEventResourceData> { ): Observable<TaskHistoryEventResourceData> {
return this.httpClient.get<TaskHistoryEventResourceData>(`${this.url}/v1/task-history-event${this.getQueryParameters( return this.httpClient.get<TaskHistoryEventResourceData>(`${this.url}/v1/task-history-event${this.getQueryParameters(
orderBy, orderBy,
sortDirection, sortDirection,
taskId, searchForValues.taskId,
parentBPI, searchForValues.parentBusinessProcessId,
BPI, searchForValues.businessProcessId,
eventType, searchForValues.eventType,
userId, searchForValues.userId,
domain, searchForValues.domain,
workbasketKey, searchForValues.workbasketKey,
porCompany, searchForValues.porCompany,
porSystem, searchForValues.porSystem,
porInstance, searchForValues.porInstance,
porType, searchForValues.porType,
porValue, searchForValues.porValue,
taskClassificationKey, searchForValues.taskClassificationKey,
taskClassificationCategory, searchForValues.taskClassificationCategory,
attachmentClassificationKey, searchForValues.attachmentClassificationKey,
custom1, searchForValues.custom1,
custom2, searchForValues.custom2,
custom3, searchForValues.custom3,
custom4, searchForValues.custom4,
created, searchForValues.created,
allPages allPages
)}`); )}`);

View File

@ -25,7 +25,6 @@ export class TaskQueryComponent implements OnInit {
orderBy = new SortingModel(TaskanaQueryParameters.parameters.CREATED); orderBy = new SortingModel(TaskanaQueryParameters.parameters.CREATED);
orientationSubscription: Subscription; orientationSubscription: Subscription;
taskQuerySubscription: Subscription; taskQuerySubscription: Subscription;
created = undefined;
taskQueryForm = new FormGroup({ taskQueryForm = new FormGroup({
}); });
@ -181,26 +180,7 @@ export class TaskQueryComponent implements OnInit {
this.taskQuerySubscription = this.taskQueryService.queryTask( this.taskQuerySubscription = this.taskQueryService.queryTask(
this.orderBy.sortBy.replace(/([A-Z])|([0-9])/g, (g) => `-${g[0].toLowerCase()}`), this.orderBy.sortBy.replace(/([A-Z])|([0-9])/g, (g) => `-${g[0].toLowerCase()}`),
this.orderBy.sortDirection, this.orderBy.sortDirection,
this.taskQueryForm.get('taskId') ? this.taskQueryForm.get('taskId').value : undefined, new TaskHistoryEventData(this.taskQueryForm.value),
this.taskQueryForm.get('parentBusinessProcessId') ? this.taskQueryForm.get('parentBusinessProcessId').value : undefined,
this.taskQueryForm.get('businessProcessId') ? this.taskQueryForm.get('businessProcessId').value : undefined,
this.taskQueryForm.get('eventType') ? this.taskQueryForm.get('eventType').value : undefined,
this.taskQueryForm.get('userId') ? this.taskQueryForm.get('userId').value : undefined,
this.taskQueryForm.get('domain') ? this.taskQueryForm.get('domain').value : undefined,
this.taskQueryForm.get('workbasketKey') ? this.taskQueryForm.get('workbasketKey').value : undefined,
this.taskQueryForm.get('porCompany') ? this.taskQueryForm.get('porCompany').value : undefined,
this.taskQueryForm.get('porSystem') ? this.taskQueryForm.get('porSystem').value : undefined,
this.taskQueryForm.get('porInstance') ? this.taskQueryForm.get('porInstance').value : undefined,
this.taskQueryForm.get('porType') ? this.taskQueryForm.get('porType').value : undefined,
this.taskQueryForm.get('porValue') ? this.taskQueryForm.get('porValue').value : undefined,
this.taskQueryForm.get('taskClassificationKey') ? this.taskQueryForm.get('taskClassificationKey').value : undefined,
this.taskQueryForm.get('taskClassificationCategory') ? this.taskQueryForm.get('taskClassificationCategory').value : undefined,
this.taskQueryForm.get('attachmentClassificationKey') ? this.taskQueryForm.get('attachmentClassificationKey').value : undefined,
this.taskQueryForm.get('custom1') ? this.taskQueryForm.get('custom1').value : undefined,
this.taskQueryForm.get('custom2') ? this.taskQueryForm.get('custom2').value : undefined,
this.taskQueryForm.get('custom3') ? this.taskQueryForm.get('custom3').value : undefined,
this.taskQueryForm.get('custom4') ? this.taskQueryForm.get('custom4').value : undefined,
this.created ? this.created.toISOString().substring(0, 10) : undefined,
false).subscribe(taskQueryResource => { false).subscribe(taskQueryResource => {
this.requestInProgressService.setRequestInProgress(false); this.requestInProgressService.setRequestInProgress(false);
if (!taskQueryResource.taskHistoryEvents) { if (!taskQueryResource.taskHistoryEvents) {
@ -231,7 +211,7 @@ export class TaskQueryComponent implements OnInit {
} }
updateDate($event: string) { updateDate($event: string) {
this.created = new Date($event); this.taskQueryForm.get('created').setValue($event.substring(0, 10));
this.performRequest(); this.performRequest();
} }

View File

@ -28,4 +28,8 @@ export class TaskHistoryEventData {
oldData = ''; oldData = '';
newData = ''; newData = '';
page = new Page(); page = new Page();
public constructor(init?: Partial<TaskHistoryEventData>) {
Object.assign(this, init);
}
} }