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

View File

@ -25,7 +25,6 @@ export class TaskQueryComponent implements OnInit {
orderBy = new SortingModel(TaskanaQueryParameters.parameters.CREATED);
orientationSubscription: Subscription;
taskQuerySubscription: Subscription;
created = undefined;
taskQueryForm = new FormGroup({
});
@ -181,26 +180,7 @@ export class TaskQueryComponent implements OnInit {
this.taskQuerySubscription = this.taskQueryService.queryTask(
this.orderBy.sortBy.replace(/([A-Z])|([0-9])/g, (g) => `-${g[0].toLowerCase()}`),
this.orderBy.sortDirection,
this.taskQueryForm.get('taskId') ? this.taskQueryForm.get('taskId').value : undefined,
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,
new TaskHistoryEventData(this.taskQueryForm.value),
false).subscribe(taskQueryResource => {
this.requestInProgressService.setRequestInProgress(false);
if (!taskQueryResource.taskHistoryEvents) {
@ -231,7 +211,7 @@ export class TaskQueryComponent implements OnInit {
}
updateDate($event: string) {
this.created = new Date($event);
this.taskQueryForm.get('created').setValue($event.substring(0, 10));
this.performRequest();
}

View File

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