From 547c56aeefe08c26947736c8170d40229168dcf1 Mon Sep 17 00:00:00 2001 From: Maurizio Vitale Date: Fri, 3 Aug 2018 15:06:13 +0100 Subject: [PATCH] [ADF-3103] Added new inputs, columns and overall improvement to Task List Demo (#3653) * Added columns, inputs and error message alert * [ADF-3103] Fixed variable name typo * Add basic documentation --- demo-shell/resources/i18n/en.json | 10 ++- .../process-service.component.ts | 2 +- .../task-list-demo.component.html | 67 ++++++++++++++++--- .../task-list-demo.component.scss | 12 +++- .../task-list-demo.component.ts | 55 +++++++++++++-- docs/process-services/task-list.component.md | 3 + .../components/task-list.component.ts | 19 +++++- .../task-list/models/filter.model.ts | 4 ++ 8 files changed, 150 insertions(+), 22 deletions(-) diff --git a/demo-shell/resources/i18n/en.json b/demo-shell/resources/i18n/en.json index 72fd75c4fd..17363b1699 100644 --- a/demo-shell/resources/i18n/en.json +++ b/demo-shell/resources/i18n/en.json @@ -218,8 +218,14 @@ "INHERITED_PERMISSIONS_BUTTON": "Permission Inherited" }, "TASK_LIST_DEMO": { - "APP_ID_REQUIRED_ERROR": "Insert App Id", - "APP_ID_TYPE_ERROR": "App Id must be a number" + "ERROR_MESSAGE": { + "APP_ID_REQUIRED_ERROR": "Insert App Id", + "APP_ID_TYPE_ERROR": "App Id must be a number", + "NUMBER_TYPE_ERROR": "Value must be a number" + }, + "TOOLTIP_MESSAGE": { + "START_INPUT": "Starting page" + } }, "PROCESS_LIST_DEMO": { "APP_ID_REQUIRED_ERROR": "Insert App Id", diff --git a/demo-shell/src/app/components/process-service/process-service.component.ts b/demo-shell/src/app/components/process-service/process-service.component.ts index e1be2c175f..131369dbf5 100644 --- a/demo-shell/src/app/components/process-service/process-service.component.ts +++ b/demo-shell/src/app/components/process-service/process-service.component.ts @@ -140,7 +140,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit blobFile: any; flag = true; - presetColoum = 'default'; + presetColumn = 'default'; showTaskTab: boolean; showProcessTab: boolean; diff --git a/demo-shell/src/app/components/task-list-demo/task-list-demo.component.html b/demo-shell/src/app/components/task-list-demo/task-list-demo.component.html index eed24e6eb3..af880724ff 100644 --- a/demo-shell/src/app/components/task-list-demo/task-list-demo.component.html +++ b/demo-shell/src/app/components/task-list-demo/task-list-demo.component.html @@ -8,10 +8,10 @@ class="form-control" [formControl]="taskAppId"> - {{ 'TASK_LIST_DEMO.APP_ID_REQUIRED_ERROR' | translate }} + {{ 'TASK_LIST_DEMO.ERROR_MESSAGE.APP_ID_REQUIRED_ERROR' | translate }} - {{ 'TASK_LIST_DEMO.APP_ID_TYPE_ERROR' | translate }} + {{ 'TASK_LIST_DEMO.ERROR_MESSAGE.APP_ID_TYPE_ERROR' | translate }} @@ -23,13 +23,51 @@ [formControl]="taskName"> + + Task Id + + + + + Start + + + {{ 'TASK_LIST_DEMO.ERROR_MESSAGE.NUMBER_TYPE_ERROR' | translate }} + + + ProcessDefinitionId - SimpleProcess:1:2 + E.g. SimpleProcess:1:2 + + + + ProcessInstanceId + + E.g. 12345 + + + + Process Instance + + {{ includeProcessInstanceOption.title }} + @@ -55,25 +93,38 @@ - {{ sortOption.title }} + {{ sortOption.title }} - -
- -
+
+ +
+ + + + + + + + + { + this.resetTaskForm(); + }); } resetTaskForm() { @@ -125,10 +154,18 @@ export class TaskListDemoComponent implements OnInit { return this.taskListForm.get('taskAppId'); } + get taskId(): AbstractControl { + return this.taskListForm.get('taskId'); + } + get taskProcessDefinitionId(): AbstractControl { return this.taskListForm.get('taskProcessDefinitionId'); } + get taskProcessInstanceId(): AbstractControl { + return this.taskListForm.get('taskProcessInstanceId'); + } + get taskName(): AbstractControl { return this.taskListForm.get('taskName'); } @@ -144,4 +181,12 @@ export class TaskListDemoComponent implements OnInit { get taskSort(): AbstractControl { return this.taskListForm.get('taskSort'); } + + get taskIncludeProcessInstance(): AbstractControl { + return this.taskListForm.get('taskIncludeProcessInstance'); + } + + get taskStart(): AbstractControl { + return this.taskListForm.get('taskStart'); + } } diff --git a/docs/process-services/task-list.component.md b/docs/process-services/task-list.component.md index 15f0eeec91..83f9c43d80 100644 --- a/docs/process-services/task-list.component.md +++ b/docs/process-services/task-list.component.md @@ -51,10 +51,13 @@ Renders a list containing all the tasks matched by the parameters specified. | multiselect | `boolean` | false | Toggles multiple row selection, renders checkboxes at the beginning of each row | | name | `string` | | Name of the tasklist. | | page | `number` | 0 | The page number of the tasks to fetch. | +| start | `number` | 0 | Another approach to specify which page you want load. | | processDefinitionKey | `string` | | (**Deprecated:** 2.4.0) The Definition Key of the process. | | processDefinitionId | `string` | | The Definition Id of the process. | | processInstanceId | `string` | | The Instance Id of the process. | +| taskId | `string` | | The taskId you want to be fetched. | | selectFirstRow | `boolean` | true | Toggles default selection of the first row | +| includeProcessInstance | `boolean` | false | Include the process instance info | | selectionMode | `string` | "single" | Row selection mode. Can be none, `single` or `multiple`. For `multiple` mode, you can use Cmd (macOS) or Ctrl (Win) modifier key to toggle selection for multiple rows. | | size | `number` | [`PaginationComponent`](../core/pagination.component.md).DEFAULT_PAGINATION.maxItems | The number of tasks to fetch. Default value: 25. | | sort | `string` | | Define the sort order of the tasks. Possible values are : `created-desc`, `created-asc`, `due-desc`, `due-asc` | diff --git a/lib/process-services/task-list/components/task-list.component.ts b/lib/process-services/task-list/components/task-list.component.ts index 907ff5c95d..846460dff4 100644 --- a/lib/process-services/task-list/components/task-list.component.ts +++ b/lib/process-services/task-list/components/task-list.component.ts @@ -111,6 +111,18 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft @Input() selectFirstRow: boolean = true; + /** The id of a task */ + @Input() + taskId: string; + + /** Toggles inclusion of Process Instances */ + @Input() + includeProcessInstance: boolean; + + /** Starting point of the */ + @Input() + start: number = 0; + /** Emitted when a task in the list is clicked */ @Output() rowClick: EventEmitter = new EventEmitter(); @@ -321,7 +333,7 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft /** * Optimize name field - * @param istances + * @param instances */ private optimizeNames(instances: any[]): any[] { instances = instances.map(t => { @@ -344,10 +356,11 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft assignment: this.assignment, state: this.state, sort: this.sort, - landingTaskId: this.landingTaskId, page: this.page, size: this.size, - start: 0 + start: this.start, + taskId: this.taskId, + includeProcessInstance: this.includeProcessInstance }; return new TaskQueryRequestRepresentationModel(requestNode); } diff --git a/lib/process-services/task-list/models/filter.model.ts b/lib/process-services/task-list/models/filter.model.ts index 15ff038ed7..006ff9f59c 100644 --- a/lib/process-services/task-list/models/filter.model.ts +++ b/lib/process-services/task-list/models/filter.model.ts @@ -118,6 +118,8 @@ export class TaskQueryRequestRepresentationModel implements TaskQueryRequestRepr sort: string; page: number; size: number; + taskId: string; + includeProcessInstance: boolean; constructor(obj?: any) { if (obj) { @@ -131,6 +133,8 @@ export class TaskQueryRequestRepresentationModel implements TaskQueryRequestRepr this.sort = obj.sort || null; this.page = obj.page || 0; this.size = obj.size || 25; + this.taskId = obj.taskId || null; + this.includeProcessInstance = obj.includeProcessInstance; } } }