mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
[ACS-7420] cleanup process types (#9709)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. "$(dirname "$0")/_/husky.sh"
|
. "$(dirname "$0")/_/husky.sh"
|
||||||
|
|
||||||
|
export NODE_OPTIONS=--max_old_space_size=8192
|
||||||
npx lint-staged
|
npx lint-staged
|
||||||
|
@@ -16,12 +16,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, Input, OnChanges, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
import { Component, Input, OnChanges, OnDestroy, OnInit, ViewChild, ViewEncapsulation } from '@angular/core';
|
||||||
import { TaskAttachmentListComponent, TaskDetailsModel, TaskListService, TaskUploadService } from '@alfresco/adf-process-services';
|
import { TaskAttachmentListComponent, TaskListService, TaskUploadService } from '@alfresco/adf-process-services';
|
||||||
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
import { AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
|
||||||
import { DiscoveryApiService, UploadService } from '@alfresco/adf-content-services';
|
import { DiscoveryApiService, UploadService } from '@alfresco/adf-content-services';
|
||||||
import { PreviewService } from '../../services/preview.service';
|
import { PreviewService } from '../../services/preview.service';
|
||||||
import { Subject } from 'rxjs';
|
import { Subject } from 'rxjs';
|
||||||
import { takeUntil } from 'rxjs/operators';
|
import { takeUntil } from 'rxjs/operators';
|
||||||
|
import { TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide a task upload service factory
|
* Provide a task upload service factory
|
||||||
@@ -55,7 +56,7 @@ export class TaskAttachmentsComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
@Input()
|
@Input()
|
||||||
taskId: string;
|
taskId: string;
|
||||||
|
|
||||||
taskDetails: TaskDetailsModel;
|
taskDetails: TaskRepresentation;
|
||||||
|
|
||||||
private onDestroy$ = new Subject<boolean>();
|
private onDestroy$ = new Subject<boolean>();
|
||||||
|
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
Title: Checklist Component
|
Title: Checklist Component
|
||||||
Added: v2.0.0
|
Added: v2.0.0
|
||||||
Status: Active
|
Status: Active
|
||||||
Last reviewed: 2018-11-19
|
Last reviewed: 2024-05-21
|
||||||
---
|
---
|
||||||
|
|
||||||
# [Checklist Component](../../../lib/process-services/src/lib/task-list/components/checklist.component.ts "Defined in checklist.component.ts")
|
# Checklist Component
|
||||||
|
|
||||||
Shows the checklist task functionality.
|
Shows the checklist task functionality.
|
||||||
|
|
||||||
@@ -23,16 +23,16 @@ Shows the checklist task functionality.
|
|||||||
|
|
||||||
### Properties
|
### Properties
|
||||||
|
|
||||||
| Name | Type | Default value | Description |
|
| Name | Type | Default value | Description |
|
||||||
| ---- | ---- | ------------- | ----------- |
|
|----------|-----------|---------------|-----------------------------------------------------------------------------------------|
|
||||||
| assignee | `string` | | (required) The assignee id that the subtasks are assigned to. |
|
| assignee | `string` | | (required) The assignee id that the subtasks are assigned to. |
|
||||||
| readOnly | `boolean` | false | Toggle readonly state of the form. All form widgets will render as readonly if enabled. |
|
| readOnly | `boolean` | false | Toggle readonly state of the form. All form widgets will render as readonly if enabled. |
|
||||||
| taskId | `string` | | (required) The id of the parent task to which subtasks are attached. |
|
| taskId | `string` | | (required) The id of the parent task to which subtasks are attached. |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
| ---- | ---- | ----------- |
|
|----------------------|------------------------------------|-----------------------------------------------|
|
||||||
| checklistTaskCreated | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` | Emitted when a new checklist task is created. |
|
| checklistTaskCreated | `EventEmitter<TaskRepresentation>` | Emitted when a new checklist task is created. |
|
||||||
| checklistTaskDeleted | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when a checklist task is deleted. |
|
| checklistTaskDeleted | `EventEmitter<string>` | Emitted when a checklist task is deleted. |
|
||||||
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when an error occurs. |
|
| error | `EventEmitter<any>` | Emitted when an error occurs. |
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
Title: Task Details component
|
Title: Task Details component
|
||||||
Added: v2.0.0
|
Added: v2.0.0
|
||||||
Status: Active
|
Status: Active
|
||||||
Last reviewed: 2018-11-13
|
Last reviewed: 2024-05-21
|
||||||
---
|
---
|
||||||
|
|
||||||
# [Task Details component](../../../lib/process-services/src/lib/task-list/components/task-details.component.ts "Defined in task-details.component.ts")
|
# Task Details Component
|
||||||
|
|
||||||
Shows the details of the task ID passed in as input.
|
Shows the details of the task ID passed in as input.
|
||||||
|
|
||||||
@@ -21,45 +21,45 @@ Shows the details of the task ID passed in as input.
|
|||||||
|
|
||||||
### Properties
|
### Properties
|
||||||
|
|
||||||
| Name | Type | Default value | Description |
|
| Name | Type | Default value | Description |
|
||||||
| ---- | ---- | ------------- | ----------- |
|
|------------------------|------------------------|---------------|---------------------------------------------------------------------------------------|
|
||||||
| debugMode | `boolean` | false | Toggles debug mode. |
|
| debugMode | `boolean` | false | Toggles debug mode. |
|
||||||
| fieldValidators | [`FormFieldValidator`](../../../lib/core/src/lib/form/components/widgets/core/form-field-validator.ts)`[]` | \[] | Field validators for use with the form. |
|
| fieldValidators | `FormFieldValidator[]` | \[] | Field validators for use with the form. |
|
||||||
| readOnlyForm | `boolean` | false | Toggles read-only state of the form. All form widgets render as read-only if enabled. |
|
| readOnlyForm | `boolean` | false | Toggles read-only state of the form. All form widgets render as read-only if enabled. |
|
||||||
| showChecklist | `boolean` | true | Toggles `Checklist` feature for the Header component. |
|
| showChecklist | `boolean` | true | Toggles `Checklist` feature for the Header component. |
|
||||||
| showComments | `boolean` | true | Toggles `Comments` feature for the Header component. |
|
| showComments | `boolean` | true | Toggles `Comments` feature for the Header component. |
|
||||||
| showFormCompleteButton | `boolean` | true | Toggles rendering of the `Complete` outcome button. |
|
| showFormCompleteButton | `boolean` | true | Toggles rendering of the `Complete` outcome button. |
|
||||||
| showFormRefreshButton | `boolean` | true | Toggles rendering of the `Refresh` button. |
|
| showFormRefreshButton | `boolean` | true | Toggles rendering of the `Refresh` button. |
|
||||||
| showFormSaveButton | `boolean` | true | Toggles rendering of the `Save` outcome button. |
|
| showFormSaveButton | `boolean` | true | Toggles rendering of the `Save` outcome button. |
|
||||||
| showFormTitle | `boolean` | false | Toggles rendering of the form title. |
|
| showFormTitle | `boolean` | false | Toggles rendering of the form title. |
|
||||||
| showHeader | `boolean` | true | Toggles task details Header component. |
|
| showHeader | `boolean` | true | Toggles task details Header component. |
|
||||||
| showHeaderContent | `boolean` | true | Toggles collapsed/expanded state of the Header component. |
|
| showHeaderContent | `boolean` | true | Toggles collapsed/expanded state of the Header component. |
|
||||||
| showInvolvePeople | `boolean` | true | Toggles `Involve People` feature for the Header component. |
|
| showInvolvePeople | `boolean` | true | Toggles `Involve People` feature for the Header component. |
|
||||||
| showNextTask | `boolean` | true | Automatically renders the next task when the current one is completed. |
|
| showNextTask | `boolean` | true | Automatically renders the next task when the current one is completed. |
|
||||||
| taskId | `string` | | (**required**) The id of the task whose details we are asking for. |
|
| taskId | `string` | | (**required**) The id of the task whose details we are asking for. |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
| ---- | ---- | ----------- |
|
|--------------------|------------------------------------|--------------------------------------------------------------------------------------------------------|
|
||||||
| assignTask | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<void>` | Emitted when a task is assigned. |
|
| assignTask | `EventEmitter<void>` | Emitted when a task is assigned. |
|
||||||
| claimedTask | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when a task is claimed. |
|
| claimedTask | `EventEmitter<string>` | Emitted when a task is claimed. |
|
||||||
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when an error occurs. |
|
| error | `EventEmitter<any>` | Emitted when an error occurs. |
|
||||||
| executeOutcome | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormOutcomeEvent`](../../../lib/core/src/lib/form/components/widgets/core/form-outcome-event.model.ts)`>` | Emitted when any outcome is executed. Default behaviour can be prevented via `event.preventDefault()`. |
|
| executeOutcome | `EventEmitter<FormOutcomeEvent>` | Emitted when any outcome is executed. Default behaviour can be prevented via `event.preventDefault()`. |
|
||||||
| formCompleted | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../../lib/core/src/lib/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is submitted with the `Complete` outcome. |
|
| formCompleted | `EventEmitter<FormModel>` | Emitted when the form is submitted with the `Complete` outcome. |
|
||||||
| formContentClicked | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`ContentLinkModel`](../../../lib/core/src/lib/form/components/widgets/core/content-link.model.ts)`>` | Emitted when the form field content is clicked. |
|
| formContentClicked | `EventEmitter<ContentLinkModel>` | Emitted when the form field content is clicked. |
|
||||||
| formLoaded | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../../lib/core/src/lib/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is loaded or reloaded. |
|
| formLoaded | `EventEmitter<FormModel>` | Emitted when the form is loaded or reloaded. |
|
||||||
| formSaved | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormModel`](../../../lib/core/src/lib/form/components/widgets/core/form.model.ts)`>` | Emitted when the form is submitted with the `Save` or custom outcomes. |
|
| formSaved | `EventEmitter<FormModel>` | Emitted when the form is submitted with the `Save` or custom outcomes. |
|
||||||
| taskCreated | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` | Emitted when a checklist task is created. |
|
| taskCreated | `EventEmitter<TaskRepresentation>` | Emitted when a checklist task is created. |
|
||||||
| taskDeleted | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when a checklist task is deleted. |
|
| taskDeleted | `EventEmitter<string>` | Emitted when a checklist task is deleted. |
|
||||||
| unClaimedTask | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when a task is unclaimed. |
|
| unClaimedTask | `EventEmitter<string>` | Emitted when a task is unclaimed. |
|
||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
### Custom 'empty Task Details' template
|
### Custom 'empty Task Details' template
|
||||||
|
|
||||||
By default the [Task Details component](task-details.component.md) shows a simple "No Tasks" message when there are
|
By default, the [Task Details component](task-details.component.md) shows "No Tasks" message when there are
|
||||||
no details. You can change this by adding the a custom HTML template as in the following
|
no details. You can change this by adding a custom HTML template as in the following
|
||||||
example:
|
example:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
@@ -67,7 +67,7 @@ example:
|
|||||||
<adf-no-task-details-template>
|
<adf-no-task-details-template>
|
||||||
<ng-template>
|
<ng-template>
|
||||||
<h1>Sorry, no tasks here</h1>
|
<h1>Sorry, no tasks here</h1>
|
||||||
<img src="example.jpg">
|
<img src="example.jpg" alt="example">
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</adf-no-task-details-template>
|
</adf-no-task-details-template>
|
||||||
</adf-task-details>
|
</adf-task-details>
|
||||||
|
@@ -2,10 +2,10 @@
|
|||||||
Title: Task Header component
|
Title: Task Header component
|
||||||
Added: v2.0.0
|
Added: v2.0.0
|
||||||
Status: Active
|
Status: Active
|
||||||
Last reviewed: 2019-01-14
|
Last reviewed: 2024-05-21
|
||||||
---
|
---
|
||||||
|
|
||||||
# [Task Header component](../../../lib/process-services/src/lib/task-list/components/task-header.component.ts "Defined in task-header.component.ts")
|
# Task Header Component
|
||||||
|
|
||||||
Shows all the information related to a task.
|
Shows all the information related to a task.
|
||||||
|
|
||||||
@@ -23,18 +23,18 @@ Shows all the information related to a task.
|
|||||||
|
|
||||||
### Properties
|
### Properties
|
||||||
|
|
||||||
| Name | Type | Default value | Description |
|
| Name | Type | Default value | Description |
|
||||||
| ---- | ---- | ------------- | ----------- |
|
|------------------|----------------------|---------------|----------------------------------------------|
|
||||||
| formName | `string` | null | The name of the form. |
|
| formName | `string` | null | The name of the form. |
|
||||||
| showClaimRelease | `boolean` | true | Toggles display of the claim/release button. |
|
| showClaimRelease | `boolean` | true | Toggles display of the claim/release button. |
|
||||||
| taskDetails | [`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts) | | (required) Details related to the task. |
|
| taskDetails | `TaskRepresentation` | | Details related to the task. |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
| Name | Type | Description |
|
| Name | Type | Description |
|
||||||
| ---- | ---- | ----------- |
|
|---------|---------------------|---------------------------------------------------|
|
||||||
| claim | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the task is claimed. |
|
| claim | `EventEmitter<any>` | Emitted when the task is claimed. |
|
||||||
| unclaim | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the task is unclaimed (ie, requeue). |
|
| unclaim | `EventEmitter<any>` | Emitted when the task is unclaimed (ie, requeue). |
|
||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
@@ -43,16 +43,32 @@ The component populates an internal array of
|
|||||||
|
|
||||||
By default all properties are displayed:
|
By default all properties are displayed:
|
||||||
|
|
||||||
**_assignee_**, **_status_**, **_priority_**, **_dueDate_**, **_category_**, **_parentName_**, **_created_**, **_id_**, **_description_**, **_formName_**.
|
- **_assignee_**
|
||||||
|
- **_status_**
|
||||||
|
- **_priority_**
|
||||||
|
- **_dueDate_**
|
||||||
|
- **_category_**
|
||||||
|
- **_parentName_**
|
||||||
|
- **_created_**
|
||||||
|
- **_id_**
|
||||||
|
- **_description_**
|
||||||
|
- **_formName_**.
|
||||||
|
|
||||||
However, you can also choose which properties to show using a configuration in `app.config.json`:
|
However, you can also choose which properties to show using a configuration in `app.config.json`:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
{
|
||||||
"adf-task-header": {
|
"adf-task-header": {
|
||||||
"presets": {
|
"presets": {
|
||||||
"properties" : [ "assignee", "status", "priority", "parentName"]
|
"properties": [
|
||||||
}
|
"assignee",
|
||||||
},
|
"status",
|
||||||
|
"priority",
|
||||||
|
"parentName"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
With this configuration, only the four listed properties will be shown.
|
With this configuration, only the four listed properties will be shown.
|
||||||
|
@@ -5,7 +5,7 @@ Status: Active
|
|||||||
Last reviewed: 2019-02-08
|
Last reviewed: 2019-02-08
|
||||||
---
|
---
|
||||||
|
|
||||||
# [Task List component](../../../lib/process-services/src/lib/task-list/components/task-list.component.ts "Defined in task-list.component.ts")
|
# Task List Component
|
||||||
|
|
||||||
Renders a list containing all the tasks matched by the parameters specified.
|
Renders a list containing all the tasks matched by the parameters specified.
|
||||||
|
|
||||||
@@ -51,32 +51,32 @@ when the task list is empty:
|
|||||||
|
|
||||||
### Properties
|
### Properties
|
||||||
|
|
||||||
| Name | Type | Default value | Description |
|
| Name | Type | Default value | Description |
|
||||||
| ---- | ---- | ------------- | ----------- |
|
|------------------------|-------------------------------------------------------------------------------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| appId | `number` | | The id of the app. |
|
| appId | `number` | | The id of the app. |
|
||||||
| assignment | `string` | | The assignment of the process. Possible values are: "assignee" (the current user is the assignee), "candidate" (the current user is a task candidate, "group_x" (the task is assigned to a group where the current user is a member, no value (the current user is involved). |
|
| assignment | `string` | | The assignment of the process. Possible values are: "assignee" (the current user is the assignee), "candidate" (the current user is a task candidate, "group_x" (the task is assigned to a group where the current user is a member, no value (the current user is involved). |
|
||||||
| blurOnResize | `boolean` | true | Toggles blur when columns of the list are being resized. |
|
| blurOnResize | `boolean` | true | Toggles blur when columns of the list are being resized. |
|
||||||
| data | [`DataTableAdapter`](../../../lib/core/src/lib/datatable/data/datatable-adapter.ts) | | Data source object that represents the number and the type of the columns that you want to show. |
|
| data | [`DataTableAdapter`](../../../lib/core/src/lib/datatable/data/datatable-adapter.ts) | | Data source object that represents the number and the type of the columns that you want to show. |
|
||||||
| dueAfter | `string` | | Filter the tasks. Display only tasks with `created_date` after `dueAfter`. |
|
| dueAfter | `string` | | Filter the tasks. Display only tasks with `created_date` after `dueAfter`. |
|
||||||
| dueBefore | `string` | | Filter the tasks. Display only tasks with `created_date` before `dueBefore`. |
|
| dueBefore | `string` | | Filter the tasks. Display only tasks with `created_date` before `dueBefore`. |
|
||||||
| isResizingEnabled | `boolean` | false | Toggles column resizing for task list. |
|
| isResizingEnabled | `boolean` | false | Toggles column resizing for task list. |
|
||||||
| includeProcessInstance | `boolean` | | Toggles inclusion of Process Instances |
|
| includeProcessInstance | `boolean` | | Toggles inclusion of Process Instances |
|
||||||
| landingTaskId | `string` | | Define which task id should be selected after reloading. If the task id doesn't exist or nothing is passed then the first task will be selected. |
|
| landingTaskId | `string` | | Define which task id should be selected after reloading. If the task id doesn't exist or nothing is passed then the first task will be selected. |
|
||||||
| multiselect | `boolean` | false | Toggles multiple row selection, renders checkboxes at the beginning of each row |
|
| multiselect | `boolean` | false | Toggles multiple row selection, renders checkboxes at the beginning of each row |
|
||||||
| name | `string` | | Name of the tasklist. |
|
| name | `string` | | Name of the tasklist. |
|
||||||
| page | `number` | 0 | The page number of the tasks to fetch. |
|
| page | `number` | 0 | The page number of the tasks to fetch. |
|
||||||
| presetColumn | `string` | | Custom preset column schema in JSON format. |
|
| presetColumn | `string` | | Custom preset column schema in JSON format. |
|
||||||
| processDefinitionId | `string` | | The Definition Id of the process. |
|
| processDefinitionId | `string` | | The Definition Id of the process. |
|
||||||
| processInstanceId | `string` | | The Instance Id of the process. |
|
| processInstanceId | `string` | | The Instance Id of the process. |
|
||||||
| selectFirstRow | `boolean` | true | Toggles default selection of the first row |
|
| selectFirstRow | `boolean` | true | Toggles default selection of the first row |
|
||||||
| 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. |
|
| 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. |
|
||||||
| showContextMenu | `boolean` | false | Toggles custom context menu for the component. |
|
| showContextMenu | `boolean` | false | Toggles custom context menu for the component. |
|
||||||
| size | `number` | | The number of tasks to fetch. Default value: 25. |
|
| size | `number` | | 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` |
|
| sort | `string` | | Define the sort order of the tasks. Possible values are : `created-desc`, `created-asc`, `due-desc`, `due-asc` |
|
||||||
| start | `number` | | Starting point of the list within the full set of tasks. |
|
| start | `number` | | Starting point of the list within the full set of tasks. |
|
||||||
| state | `string` | | Current state of the process. Possible values are: `completed`, `active`. |
|
| state | `string` | | Current state of the process. Possible values are: `completed`, `active`. |
|
||||||
| stickyHeader | `boolean` | false | Toggles the sticky header mode. |
|
| stickyHeader | `boolean` | false | Toggles the sticky header mode. |
|
||||||
| taskId | `string` | | The id of a task |
|
| taskId | `string` | | The id of a task |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
@@ -95,12 +95,11 @@ renders details of any chosen instance.
|
|||||||
|
|
||||||
### Setting the column schema
|
### Setting the column schema
|
||||||
|
|
||||||
You can configure the list to show any of the properties of the
|
You can configure the list to show any of the properties of the `TaskRepresentation`
|
||||||
[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)
|
|
||||||
class. The example below shows how to set up the column schema from HTML:
|
class. The example below shows how to set up the column schema from HTML:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<adf-tasklist ...>
|
<adf-tasklist>
|
||||||
<data-columns>
|
<data-columns>
|
||||||
<data-column key="name" title="NAME" class="full-width name-column"></data-column>
|
<data-column key="name" title="NAME" class="full-width name-column"></data-column>
|
||||||
<data-column key="created" title="Created" class="hidden"></data-column>
|
<data-column key="created" title="Created" class="hidden"></data-column>
|
||||||
@@ -111,23 +110,27 @@ class. The example below shows how to set up the column schema from HTML:
|
|||||||
You can also set a static custom schema declaration in `app.config.json` as shown below:
|
You can also set a static custom schema declaration in `app.config.json` as shown below:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"adf-task-list": {
|
{
|
||||||
|
"adf-task-list": {
|
||||||
"presets": {
|
"presets": {
|
||||||
"customSchema": [
|
"customSchema": [
|
||||||
{
|
{
|
||||||
"key": "name",
|
"key": "name",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"title": "name",
|
"title": "name",
|
||||||
"sortable": true
|
"sortable": true
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
"default": [
|
"default": [
|
||||||
{
|
{
|
||||||
"key": "name",
|
"key": "name",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"title": "name",
|
"title": "name",
|
||||||
"sortable": true
|
"sortable": true
|
||||||
}],
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -141,23 +144,27 @@ You can also set a static custom schema declaration in `app.config.json` as show
|
|||||||
You can use an HTML-based schema and an `app.config.json` custom schema declaration at the same time:
|
You can use an HTML-based schema and an `app.config.json` custom schema declaration at the same time:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"adf-task-list": {
|
{
|
||||||
|
"adf-task-list": {
|
||||||
"presets": {
|
"presets": {
|
||||||
"customSchema": [
|
"customSchema": [
|
||||||
{
|
{
|
||||||
"key": "id",
|
"key": "id",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"title": "Id",
|
"title": "Id",
|
||||||
"sortable": true
|
"sortable": true
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
"default": [
|
"default": [
|
||||||
{
|
{
|
||||||
"key": "name",
|
"key": "name",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"title": "name",
|
"title": "name",
|
||||||
"sortable": true
|
"sortable": true
|
||||||
}],
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -197,7 +204,7 @@ let sortParam = 'created-desc';
|
|||||||
|
|
||||||
### Pagination strategy
|
### Pagination strategy
|
||||||
|
|
||||||
The Tasklist also supports pagination as shown in the example below:
|
The TaskList also supports pagination as shown in the example below:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<adf-tasklist
|
<adf-tasklist
|
||||||
@@ -218,7 +225,7 @@ The Tasklist also supports pagination as shown in the example below:
|
|||||||
|
|
||||||
See the [Data Table Adapter interface](../../core/interfaces/datatable-adapter.interface.md) page for full details of the interface and its standard
|
See the [Data Table Adapter interface](../../core/interfaces/datatable-adapter.interface.md) page for full details of the interface and its standard
|
||||||
implementation, [`ObjectDataTableAdapter`](../../../lib/core/src/lib/datatable/data/object-datatable-adapter.ts). Below is an example of how you can set up the adapter for a
|
implementation, [`ObjectDataTableAdapter`](../../../lib/core/src/lib/datatable/data/object-datatable-adapter.ts). Below is an example of how you can set up the adapter for a
|
||||||
typical tasklist:
|
typical TaskList:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
[
|
[
|
||||||
@@ -249,7 +256,7 @@ You can provide all necessary content via the handler.
|
|||||||
|
|
||||||
Event properties:
|
Event properties:
|
||||||
|
|
||||||
```ts
|
```text
|
||||||
value: {
|
value: {
|
||||||
row: DataRow,
|
row: DataRow,
|
||||||
col: DataColumn,
|
col: DataColumn,
|
||||||
@@ -259,7 +266,7 @@ value: {
|
|||||||
|
|
||||||
Handler example:
|
Handler example:
|
||||||
|
|
||||||
```ts
|
```text
|
||||||
onShowRowContextMenu(event: DataCellEvent) {
|
onShowRowContextMenu(event: DataCellEvent) {
|
||||||
event.value.actions = [
|
event.value.actions = [
|
||||||
{ title: 'Task List Context Menu' },
|
{ title: 'Task List Context Menu' },
|
||||||
|
@@ -52,12 +52,12 @@ Manages process instances, process variables, and process audit Log.
|
|||||||
- _requestNode:_ [`ProcessFilterParamRepresentationModel`](../../../lib/process-services/src/lib/process-list/models/filter-process.model.ts) - Filter for instances
|
- _requestNode:_ [`ProcessFilterParamRepresentationModel`](../../../lib/process-services/src/lib/process-list/models/filter-process.model.ts) - Filter for instances
|
||||||
- _processDefinitionKey:_ `string` - (Optional) Limits returned instances to a process definition
|
- _processDefinitionKey:_ `string` - (Optional) Limits returned instances to a process definition
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessListModel`](../../../lib/process-services/src/lib/process-list/models/process-list.model.ts)`>` - List of process instances
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessListModel`](../../../lib/process-services/src/lib/process-list/models/process-list.model.ts)`>` - List of process instances
|
||||||
- **getProcessTasks**(processInstanceId: `string`, state?: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`[]>`<br/>
|
- **getProcessTasks**(processInstanceId: `string`, state?: `string`): `Observable<TaskRepresentation[]>`<br/>
|
||||||
Gets task instances for a process instance.
|
Gets task instances for a process instance.
|
||||||
- _processInstanceId:_ `string` - ID of the process instance
|
- _processInstanceId:_ `string` - ID of the process instance
|
||||||
- _state:_ `string` - (Optional) Task state filter (can be "active" or "completed")
|
- _state:_ `string` - (Optional) Task state filter (can be "active" or "completed")
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`[]>` - Array of task instance details
|
- **Returns** `Observable<TaskRepresentation[]>` - Array of task instance details
|
||||||
- **getProcesses**(requestNode: [`ProcessFilterParamRepresentationModel`](../../../lib/process-services/src/lib/process-list/models/filter-process.model.ts), processDefinitionKey?: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessListModel`](../../../lib/process-services/src/lib/process-list/models/process-list.model.ts)`>`<br/>
|
- **getProcesses**(requestNode: `ProcessFilterParamRepresentationModel, processDefinitionKey?: `string`): `Observable<ProcessListModel>`<br/>
|
||||||
Gets processes for a filter and optionally a process definition.
|
Gets processes for a filter and optionally a process definition.
|
||||||
- _requestNode:_ [`ProcessFilterParamRepresentationModel`](../../../lib/process-services/src/lib/process-list/models/filter-process.model.ts) - Filter for instances
|
- _requestNode:_ [`ProcessFilterParamRepresentationModel`](../../../lib/process-services/src/lib/process-list/models/filter-process.model.ts) - Filter for instances
|
||||||
- _processDefinitionKey:_ `string` - (Optional) Limits returned instances to a process definition
|
- _processDefinitionKey:_ `string` - (Optional) Limits returned instances to a process definition
|
||||||
|
@@ -17,53 +17,53 @@ import { TaskListService } from '@alfresco/adf-process-services';
|
|||||||
|
|
||||||
### Methods
|
### Methods
|
||||||
|
|
||||||
- **addTask**(task: [`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
|
- **addTask**(task: `TaskRepresentation`): `Observable<TaskRepresentation>`<br/>
|
||||||
Adds a subtask (ie, a checklist task) to a parent task.
|
Adds a subtask (ie, a checklist task) to a parent task.
|
||||||
- _task:_ [`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts) - The task to add
|
- _task:_ `TaskRepresentation` - The task to add
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` - The subtask that was added
|
- **Returns** `Observable<TaskRepresentation>` - The subtask that was added
|
||||||
- **assignTask**(taskId: `string`, requestNode: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
|
- **assignTask**(taskId: `string`, requestNode: `any`): `Observable<TaskRepresentation>`<br/>
|
||||||
Assigns a task to a user or group.
|
Assigns a task to a user or group.
|
||||||
- _taskId:_ `string` - The task to assign
|
- _taskId:_ `string` - The task to assign
|
||||||
- _requestNode:_ `any` - User or group to assign the task to
|
- _requestNode:_ `any` - User or group to assign the task to
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` - Details of the assigned task
|
- **Returns** `Observable<TaskRepresentation>` - Details of the assigned task
|
||||||
- **assignTaskByUserId**(taskId: `string`, userId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
|
- **assignTaskByUserId**(taskId: `string`, userId: `string`): `Observable<TaskRepresentation>`<br/>
|
||||||
Assigns a task to a user.
|
Assigns a task to a user.
|
||||||
- _taskId:_ `string` - ID of the task to assign
|
- _taskId:_ `string` - ID of the task to assign
|
||||||
- _userId:_ `string` - ID of the user to assign the task to
|
- _userId:_ `string` - ID of the user to assign the task to
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` - Details of the assigned task
|
- **Returns** `ObservableTaskRepresentation>` - Details of the assigned task
|
||||||
- **attachFormToATask**(taskId: `string`, formId: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
- **attachFormToATask**(taskId: `string`, formId: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
||||||
Attaches a form to a task.
|
Attaches a form to a task.
|
||||||
- _taskId:_ `string` - ID of the target task
|
- _taskId:_ `string` - ID of the target task
|
||||||
- _formId:_ `number` - ID of the form to add
|
- _formId:_ `number` - ID of the form to add
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Null response notifying when the operation is complete
|
- **Returns** `Observable<any>` - Null response notifying when the operation is complete
|
||||||
- **claimTask**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
|
- **claimTask**(taskId: `string`): `Observable<TaskRepresentation>`<br/>
|
||||||
Claims a task for the current user.
|
Claims a task for the current user.
|
||||||
- _taskId:_ `string` - ID of the task to claim
|
- _taskId:_ `string` - ID of the task to claim
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` - Details of the claimed task
|
- **Returns** `Observable<TaskRepresentation>` - Details of the claimed task
|
||||||
- **completeTask**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
- **completeTask**(taskId: `string`): `Observable<any>`<br/>
|
||||||
Gives completed status to a task.
|
Gives completed status to a task.
|
||||||
- _taskId:_ `string` - ID of the target task
|
- _taskId:_ `string` - ID of the target task
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - Null response notifying when the operation is complete
|
- **Returns** `Observable<any>` - Null response notifying when the operation is complete
|
||||||
- **createNewTask**(task: [`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
|
- **createNewTask**(task: `TaskRepresentation`): `Observable<TaskRepresentation>`<br/>
|
||||||
Creates a new standalone task.
|
Creates a new standalone task.
|
||||||
- _task:_ [`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts) - Details of the new task
|
- _task:_ `TaskDetailsModel` - Details of the new task
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` - Details of the newly created task
|
- **Returns** `Observable<TaskRepresentation>` - Details of the newly created task
|
||||||
- **deleteForm**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
|
- **deleteForm**(taskId: `string`): `Observable<TaskRepresentation>`<br/>
|
||||||
Deletes a form from a task.
|
Deletes a form from a task.
|
||||||
- _taskId:_ `string` - Task id related to form
|
- _taskId:_ `string` - Task id related to form
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` - Null response notifying when the operation is complete
|
- **Returns** `Observable<TaskRepresentation>` - Null response notifying when the operation is complete
|
||||||
- **deleteTask**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
|
- **deleteTask**(taskId: `string`): `Observable<TaskRepresentation>`<br/>
|
||||||
Deletes a subtask (ie, a checklist task) from a parent task.
|
Deletes a subtask (ie, a checklist task) from a parent task.
|
||||||
- _taskId:_ `string` - The task to delete
|
- _taskId:_ `string` - The task to delete
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` - Null response notifying when the operation is complete
|
- **Returns** `Observable<TaskRepresentation>` - Null response notifying when the operation is complete
|
||||||
- **fetchTaskAuditJsonById**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
|
- **fetchTaskAuditJsonById**(taskId: `string`): `Observable<any>`<br/>
|
||||||
Fetch the Task Audit information in JSON format
|
Fetch the Task Audit information in JSON format
|
||||||
- _taskId:_ `string` - ID of the target task
|
- _taskId:_ `string` - ID of the target task
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<any>` - JSON data
|
- **Returns** `Observable<any>` - JSON data
|
||||||
- **fetchTaskAuditPdfById**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)`>`<br/>
|
- **fetchTaskAuditPdfById**(taskId: `string`): `Observable<Blob>`<br/>
|
||||||
Fetches the Task Audit information in PDF format.
|
Fetches the Task Audit information in PDF format.
|
||||||
- _taskId:_ `string` - ID of the target task
|
- _taskId:_ `string` - ID of the target task
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob)`>` - Binary PDF data
|
- **Returns** `Observable<Blob>` - Binary PDF data
|
||||||
- **findTasksByState**(requestNode: `TaskQueryRequestRepresentationModel`, state?: `string`): `Observable<ResultListDataRepresentationTaskRepresentation>`<br/>
|
- **findTasksByState**(requestNode: `TaskQueryRequestRepresentationModel`, state?: `string`): `Observable<ResultListDataRepresentationTaskRepresentation>`<br/>
|
||||||
Gets tasks matching a query and state value.
|
Gets tasks matching a query and state value.
|
||||||
- _requestNode:_ `TaskQueryRequestRepresentationModel` - Query to search for tasks
|
- _requestNode:_ `TaskQueryRequestRepresentationModel` - Query to search for tasks
|
||||||
@@ -76,12 +76,12 @@ import { TaskListService } from '@alfresco/adf-process-services';
|
|||||||
- **Returns** `Observable<UserTaskFilterRepresentation>` - Filters belonging to the task
|
- **Returns** `Observable<UserTaskFilterRepresentation>` - Filters belonging to the task
|
||||||
- **getFormList**(): `Observable<Form[]>`<br/>
|
- **getFormList**(): `Observable<Form[]>`<br/>
|
||||||
Gets all available reusable forms.
|
Gets all available reusable forms.
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Form`](../../../lib/process-services/src/lib/task-list/models/form.model.ts)`[]>` - Array of form details
|
- **Returns** `Observable<Form[]>` - Array of form details
|
||||||
- **getTaskChecklist**(id: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`[]>`<br/>
|
- **getTaskChecklist**(id: `string`): `Observable<TaskRepresentation[]>`<br/>
|
||||||
Gets the checklist for a task.
|
Gets the checklist for a task.
|
||||||
- _id:_ `string` - ID of the target task
|
- _id:_ `string` - ID of the target task
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`[]>` - Array of checklist task details
|
- **Returns** `Observable<TaskRepresentation[]>` - Array of checklist task details
|
||||||
- **getTaskDetails**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
|
- **getTaskDetails**(taskId: `string`): `Observable<TaskRepresentation>`<br/>
|
||||||
Gets details for a task.
|
Gets details for a task.
|
||||||
- _taskId:_ `string` - ID of the target task.
|
- _taskId:_ `string` - ID of the target task.
|
||||||
- **Returns** `Observable<TaskDetailsModel>` - Task details
|
- **Returns** `Observable<TaskDetailsModel>` - Task details
|
||||||
@@ -101,18 +101,18 @@ import { TaskListService } from '@alfresco/adf-process-services';
|
|||||||
- **unclaimTask**(taskId: `string`): `Observable<TaskDetailsModel>`<br/>
|
- **unclaimTask**(taskId: `string`): `Observable<TaskDetailsModel>`<br/>
|
||||||
Un-claims a task for the current user.
|
Un-claims a task for the current user.
|
||||||
- _taskId:_ `string` - ID of the task to unclaim
|
- _taskId:_ `string` - ID of the task to unclaim
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` - Null response notifying when the operation is complete
|
- **Returns** `Observable<TaskRepresentation>` - Null response notifying when the operation is complete
|
||||||
- **updateTask**(taskId: `string`, updated: [`TaskUpdateRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/TaskUpdateRepresentation.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
|
- **updateTask**(taskId: `string`, updated: `TaskUpdateRepresentation`): `Observable<TaskRepresentation>`<br/>
|
||||||
Updates the details (name, description, due date) for a task.
|
Updates the details (name, description, due date) for a task.
|
||||||
- _taskId:_ `string` - ID of the task to update
|
- _taskId:_ `string` - ID of the task to update
|
||||||
- _updated:_ [`TaskUpdateRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/TaskUpdateRepresentation.md) - Data to update the task (as a [`TaskUpdateRepresentation`](https://github.com/Alfresco/alfresco-js-api/blob/develop/src/api/activiti-rest-api/docs/TaskUpdateRepresentation.md) instance).
|
- _updated:_ `TaskUpdateRepresentation`) - Data to update the task (as a `TaskUpdateRepresentation`) instance).
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` - Updated task details
|
- **Returns** `Observable<TaskRepresentation>` - Updated task details
|
||||||
|
|
||||||
## Details
|
## Details
|
||||||
|
|
||||||
### Task details
|
### Task details
|
||||||
|
|
||||||
Several of the methods return one or more [`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts) instances corresponding
|
Several of the methods return one or more `TaskRepresentation` instances corresponding
|
||||||
to tasks or subtasks matched by a query of some kind. For example, `getTaskDetails`
|
to tasks or subtasks matched by a query of some kind. For example, `getTaskDetails`
|
||||||
could be used as shown below:
|
could be used as shown below:
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ this.tasklistService.getTaskDetails(taskInstanceId).subscribe( (taskInstance: Ta
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
The resulting [`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts) object contains information like the following:
|
The resulting `TaskRepresentation` object contains information like the following:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
adhocTaskCanBeReassigned: false
|
adhocTaskCanBeReassigned: false
|
||||||
|
@@ -30,6 +30,7 @@ export * from './services/identity-group.service';
|
|||||||
export * from './services/jwt-helper.service';
|
export * from './services/jwt-helper.service';
|
||||||
export * from './services/oauth2.service';
|
export * from './services/oauth2.service';
|
||||||
export * from './services/user-access.service';
|
export * from './services/user-access.service';
|
||||||
|
export * from './services/oidc-authentication.service';
|
||||||
|
|
||||||
export * from './basic-auth/basic-alfresco-auth.service';
|
export * from './basic-auth/basic-alfresco-auth.service';
|
||||||
export * from './basic-auth/process-auth';
|
export * from './basic-auth/process-auth';
|
||||||
|
@@ -20,6 +20,7 @@ import {
|
|||||||
LightUserRepresentation,
|
LightUserRepresentation,
|
||||||
ProcessInstanceRepresentation,
|
ProcessInstanceRepresentation,
|
||||||
RestVariable,
|
RestVariable,
|
||||||
|
TaskRepresentation,
|
||||||
UserRepresentation,
|
UserRepresentation,
|
||||||
UserTaskFilterRepresentation
|
UserTaskFilterRepresentation
|
||||||
} from '@alfresco/js-api';
|
} from '@alfresco/js-api';
|
||||||
@@ -45,4 +46,7 @@ export type UserProcessModel = LightUserRepresentation;
|
|||||||
/** @deprecated use js-api/RestVariable instead */
|
/** @deprecated use js-api/RestVariable instead */
|
||||||
export type ProcessInstanceVariable = RestVariable;
|
export type ProcessInstanceVariable = RestVariable;
|
||||||
|
|
||||||
|
/** @deprecated use js-api/TaskRepresentation instead */
|
||||||
|
export type TaskDetailsModel = TaskRepresentation;
|
||||||
|
|
||||||
export { ProcessDefinitionRepresentation } from '@alfresco/js-api';
|
export { ProcessDefinitionRepresentation } from '@alfresco/js-api';
|
||||||
|
@@ -15,10 +15,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { UserRepresentation } from '@alfresco/js-api';
|
import { TaskRepresentation, UserRepresentation } from '@alfresco/js-api';
|
||||||
import { TaskDetailsModel } from '../../task-list/models/task-details.model';
|
|
||||||
|
|
||||||
export const standaloneTaskWithoutForm = new TaskDetailsModel({
|
export const standaloneTaskWithoutForm = new TaskRepresentation({
|
||||||
id: '200',
|
id: '200',
|
||||||
name: 'Standalone Task Without Form',
|
name: 'Standalone Task Without Form',
|
||||||
description: null,
|
description: null,
|
||||||
@@ -29,7 +28,7 @@ export const standaloneTaskWithoutForm = new TaskDetailsModel({
|
|||||||
lastName: 'Adams',
|
lastName: 'Adams',
|
||||||
email: 'wilbur@app.activiti.com'
|
email: 'wilbur@app.activiti.com'
|
||||||
},
|
},
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: null,
|
endDate: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -58,7 +57,7 @@ export const standaloneTaskWithoutForm = new TaskDetailsModel({
|
|||||||
memberOfCandidateGroup: false
|
memberOfCandidateGroup: false
|
||||||
});
|
});
|
||||||
|
|
||||||
export const completedStandaloneTaskWithoutForm = new TaskDetailsModel({
|
export const completedStandaloneTaskWithoutForm = new TaskRepresentation({
|
||||||
id: '200',
|
id: '200',
|
||||||
name: 'Standalone Task Without Form',
|
name: 'Standalone Task Without Form',
|
||||||
description: null,
|
description: null,
|
||||||
@@ -69,7 +68,7 @@ export const completedStandaloneTaskWithoutForm = new TaskDetailsModel({
|
|||||||
lastName: 'Adams',
|
lastName: 'Adams',
|
||||||
email: 'wilbur@app.activiti.com'
|
email: 'wilbur@app.activiti.com'
|
||||||
},
|
},
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: new Date(),
|
endDate: new Date(),
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -98,7 +97,7 @@ export const completedStandaloneTaskWithoutForm = new TaskDetailsModel({
|
|||||||
memberOfCandidateGroup: false
|
memberOfCandidateGroup: false
|
||||||
});
|
});
|
||||||
|
|
||||||
export const taskDetailsMock = new TaskDetailsModel({
|
export const taskDetailsMock = new TaskRepresentation({
|
||||||
id: '91',
|
id: '91',
|
||||||
name: 'Request translation',
|
name: 'Request translation',
|
||||||
description: null,
|
description: null,
|
||||||
@@ -109,7 +108,7 @@ export const taskDetailsMock = new TaskDetailsModel({
|
|||||||
lastName: 'Adams',
|
lastName: 'Adams',
|
||||||
email: 'wilbur@app.activiti.com'
|
email: 'wilbur@app.activiti.com'
|
||||||
},
|
},
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: null,
|
endDate: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -138,13 +137,13 @@ export const taskDetailsMock = new TaskDetailsModel({
|
|||||||
memberOfCandidateGroup: false
|
memberOfCandidateGroup: false
|
||||||
});
|
});
|
||||||
|
|
||||||
export const initiatorCanCompleteTaskDetailsMock = new TaskDetailsModel({
|
export const initiatorCanCompleteTaskDetailsMock = new TaskRepresentation({
|
||||||
id: '91',
|
id: '91',
|
||||||
name: 'Request translation',
|
name: 'Request translation',
|
||||||
description: null,
|
description: null,
|
||||||
category: null,
|
category: null,
|
||||||
assignee: { email: 'mock-user-email' },
|
assignee: { email: 'mock-user-email' },
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: null,
|
endDate: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -173,13 +172,13 @@ export const initiatorCanCompleteTaskDetailsMock = new TaskDetailsModel({
|
|||||||
memberOfCandidateGroup: false
|
memberOfCandidateGroup: false
|
||||||
});
|
});
|
||||||
|
|
||||||
export const initiatorWithCandidatesTaskDetailsMock = new TaskDetailsModel({
|
export const initiatorWithCandidatesTaskDetailsMock = new TaskRepresentation({
|
||||||
id: '91',
|
id: '91',
|
||||||
name: 'Request translation',
|
name: 'Request translation',
|
||||||
description: null,
|
description: null,
|
||||||
category: null,
|
category: null,
|
||||||
assignee: null,
|
assignee: null,
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: null,
|
endDate: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -221,13 +220,13 @@ export const initiatorWithCandidatesTaskDetailsMock = new TaskDetailsModel({
|
|||||||
memberOfCandidateGroup: true
|
memberOfCandidateGroup: true
|
||||||
});
|
});
|
||||||
|
|
||||||
export const taskDetailsWithOutAssigneeMock = new TaskDetailsModel({
|
export const taskDetailsWithOutAssigneeMock = new TaskRepresentation({
|
||||||
id: '91',
|
id: '91',
|
||||||
name: 'Request translation',
|
name: 'Request translation',
|
||||||
description: null,
|
description: null,
|
||||||
category: null,
|
category: null,
|
||||||
assignee: undefined,
|
assignee: undefined,
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: null,
|
endDate: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -256,13 +255,13 @@ export const taskDetailsWithOutAssigneeMock = new TaskDetailsModel({
|
|||||||
memberOfCandidateGroup: false
|
memberOfCandidateGroup: false
|
||||||
});
|
});
|
||||||
|
|
||||||
export const claimableTaskDetailsMock = new TaskDetailsModel({
|
export const claimableTaskDetailsMock = new TaskRepresentation({
|
||||||
id: '91',
|
id: '91',
|
||||||
name: 'Request translation',
|
name: 'Request translation',
|
||||||
description: null,
|
description: null,
|
||||||
category: null,
|
category: null,
|
||||||
assignee: null,
|
assignee: null,
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: null,
|
endDate: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -296,7 +295,7 @@ export const claimableTaskDetailsMock = new TaskDetailsModel({
|
|||||||
memberOfCandidateUsers: false
|
memberOfCandidateUsers: false
|
||||||
});
|
});
|
||||||
|
|
||||||
export const claimedTaskDetailsMock = new TaskDetailsModel({
|
export const claimedTaskDetailsMock = new TaskRepresentation({
|
||||||
id: '91',
|
id: '91',
|
||||||
name: 'Request translation',
|
name: 'Request translation',
|
||||||
description: null,
|
description: null,
|
||||||
@@ -307,7 +306,7 @@ export const claimedTaskDetailsMock = new TaskDetailsModel({
|
|||||||
lastName: 'Adams',
|
lastName: 'Adams',
|
||||||
email: 'wilbur@app.activiti.com'
|
email: 'wilbur@app.activiti.com'
|
||||||
},
|
},
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: null,
|
endDate: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -349,7 +348,7 @@ export const claimedTaskDetailsMock = new TaskDetailsModel({
|
|||||||
memberOfCandidateUsers: true
|
memberOfCandidateUsers: true
|
||||||
});
|
});
|
||||||
|
|
||||||
export const claimedByGroupMemberMock = new TaskDetailsModel({
|
export const claimedByGroupMemberMock = new TaskRepresentation({
|
||||||
id: '91',
|
id: '91',
|
||||||
name: 'Request translation',
|
name: 'Request translation',
|
||||||
description: null,
|
description: null,
|
||||||
@@ -360,7 +359,7 @@ export const claimedByGroupMemberMock = new TaskDetailsModel({
|
|||||||
lastName: 'fake-last-name',
|
lastName: 'fake-last-name',
|
||||||
email: 'fake@app.activiti.com'
|
email: 'fake@app.activiti.com'
|
||||||
},
|
},
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: null,
|
endDate: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -399,7 +398,7 @@ export const claimedByGroupMemberMock = new TaskDetailsModel({
|
|||||||
memberOfCandidateUsers: true
|
memberOfCandidateUsers: true
|
||||||
});
|
});
|
||||||
|
|
||||||
export const taskDetailsWithOutCandidateGroup = new TaskDetailsModel({
|
export const taskDetailsWithOutCandidateGroup = new TaskRepresentation({
|
||||||
id: '91',
|
id: '91',
|
||||||
name: 'Request translation',
|
name: 'Request translation',
|
||||||
description: null,
|
description: null,
|
||||||
@@ -410,7 +409,7 @@ export const taskDetailsWithOutCandidateGroup = new TaskDetailsModel({
|
|||||||
lastName: 'Adams',
|
lastName: 'Adams',
|
||||||
email: 'wilbur@app.activiti.com'
|
email: 'wilbur@app.activiti.com'
|
||||||
},
|
},
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: null,
|
endDate: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -441,7 +440,7 @@ export const taskDetailsWithOutCandidateGroup = new TaskDetailsModel({
|
|||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
export const completedTaskWithFormMock = new TaskDetailsModel({
|
export const completedTaskWithFormMock = new TaskRepresentation({
|
||||||
id: '91',
|
id: '91',
|
||||||
name: 'Request translation',
|
name: 'Request translation',
|
||||||
description: null,
|
description: null,
|
||||||
@@ -452,7 +451,7 @@ export const completedTaskWithFormMock = new TaskDetailsModel({
|
|||||||
lastName: 'Adams',
|
lastName: 'Adams',
|
||||||
email: 'wilbur@app.activiti.com'
|
email: 'wilbur@app.activiti.com'
|
||||||
},
|
},
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: new Date(),
|
endDate: new Date(),
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -471,7 +470,7 @@ export const completedTaskWithFormMock = new TaskDetailsModel({
|
|||||||
memberOfCandidateUsers: false
|
memberOfCandidateUsers: false
|
||||||
});
|
});
|
||||||
|
|
||||||
export const completedTaskDetailsMock = new TaskDetailsModel({
|
export const completedTaskDetailsMock = new TaskRepresentation({
|
||||||
id: '91',
|
id: '91',
|
||||||
name: 'Request translation',
|
name: 'Request translation',
|
||||||
description: null,
|
description: null,
|
||||||
@@ -482,7 +481,7 @@ export const completedTaskDetailsMock = new TaskDetailsModel({
|
|||||||
lastName: 'Adams',
|
lastName: 'Adams',
|
||||||
email: 'wilbur@app.activiti.com'
|
email: 'wilbur@app.activiti.com'
|
||||||
},
|
},
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: new Date(),
|
endDate: new Date(),
|
||||||
duration: null,
|
duration: null,
|
||||||
@@ -501,14 +500,14 @@ export const completedTaskDetailsMock = new TaskDetailsModel({
|
|||||||
memberOfCandidateUsers: false
|
memberOfCandidateUsers: false
|
||||||
});
|
});
|
||||||
|
|
||||||
export const taskDetailsWithOutFormMock = new TaskDetailsModel({
|
export const taskDetailsWithOutFormMock = new TaskRepresentation({
|
||||||
id: '91',
|
id: '91',
|
||||||
name: 'Request translation',
|
name: 'Request translation',
|
||||||
description: 'fake description',
|
description: 'fake description',
|
||||||
category: null,
|
category: null,
|
||||||
assignee: { id: 1001, firstName: 'Admin', lastName: 'Paul', email: 'fake-email@gmail.com' },
|
assignee: { id: 1001, firstName: 'Admin', lastName: 'Paul', email: 'fake-email@gmail.com' },
|
||||||
created: '2016-11-03T15:25:42.749+0000',
|
created: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
dueDate: '2016-11-03T15:25:42.749+0000',
|
dueDate: new Date('2016-11-03T15:25:42.749+0000'),
|
||||||
endDate: null,
|
endDate: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
priority: 50,
|
priority: 50,
|
||||||
@@ -791,20 +790,20 @@ export const taskFormMock = {
|
|||||||
globalDateFormat: 'D-M-YYYY'
|
globalDateFormat: 'D-M-YYYY'
|
||||||
};
|
};
|
||||||
|
|
||||||
export const tasksMock = [new TaskDetailsModel(taskDetailsMock)];
|
export const tasksMock = [taskDetailsMock];
|
||||||
|
|
||||||
export const noDataMock = [
|
export const noDataMock: any[] = [
|
||||||
new TaskDetailsModel({
|
{
|
||||||
id: 1005,
|
id: '1005',
|
||||||
message: 'example-message',
|
message: 'example-message',
|
||||||
created: '2017-10-06T11:54:53.443+0000',
|
created: new Date('2017-10-06T11:54:53.443+0000'),
|
||||||
createdBy: {
|
createdBy: {
|
||||||
id: 4004,
|
id: 4004,
|
||||||
firstName: 'gadget',
|
firstName: 'gadget',
|
||||||
lastName: 'inspector',
|
lastName: 'inspector',
|
||||||
email: 'gadget@inspector.com'
|
email: 'gadget@inspector.com'
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
export const involvedUserTaskForm = {
|
export const involvedUserTaskForm = {
|
||||||
@@ -935,7 +934,7 @@ export const fakeUser = new UserRepresentation({
|
|||||||
tenantName: 'abc'
|
tenantName: 'abc'
|
||||||
});
|
});
|
||||||
|
|
||||||
export const completedProcessTaskWithoutForm = new TaskDetailsModel({
|
export const completedProcessTaskWithoutForm = new TaskRepresentation({
|
||||||
id: '49',
|
id: '49',
|
||||||
name: 'process task without form',
|
name: 'process task without form',
|
||||||
description: null,
|
description: null,
|
||||||
@@ -946,9 +945,9 @@ export const completedProcessTaskWithoutForm = new TaskDetailsModel({
|
|||||||
lastName: 'User',
|
lastName: 'User',
|
||||||
email: 'hruser@example.com'
|
email: 'hruser@example.com'
|
||||||
},
|
},
|
||||||
created: '2021-07-08T07:39:27.046+0000',
|
created: new Date('2021-07-08T07:39:27.046+0000'),
|
||||||
dueDate: null,
|
dueDate: null,
|
||||||
endDate: '2021-07-08T07:39:35.817+0000',
|
endDate: new Date('2021-07-08T07:39:35.817+0000'),
|
||||||
duration: 8771,
|
duration: 8771,
|
||||||
priority: 0,
|
priority: 0,
|
||||||
parentTaskId: null,
|
parentTaskId: null,
|
||||||
|
@@ -19,7 +19,6 @@ import { SimpleChange } from '@angular/core';
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
import { TaskDetailsModel } from '../../task-list';
|
|
||||||
import { taskDetailsMock } from '../../mock';
|
import { taskDetailsMock } from '../../mock';
|
||||||
import { ProcessService } from './../services/process.service';
|
import { ProcessService } from './../services/process.service';
|
||||||
import { ProcessInstanceTasksComponent } from './process-instance-tasks.component';
|
import { ProcessInstanceTasksComponent } from './process-instance-tasks.component';
|
||||||
@@ -27,7 +26,7 @@ import { ProcessTestingModule } from '../../testing/process.testing.module';
|
|||||||
import { HarnessLoader } from '@angular/cdk/testing';
|
import { HarnessLoader } from '@angular/cdk/testing';
|
||||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||||
import { MatListItemHarness } from '@angular/material/list/testing';
|
import { MatListItemHarness } from '@angular/material/list/testing';
|
||||||
import { ProcessInstanceRepresentation } from '@alfresco/js-api';
|
import { ProcessInstanceRepresentation, TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('ProcessInstanceTasksComponent', () => {
|
describe('ProcessInstanceTasksComponent', () => {
|
||||||
let component: ProcessInstanceTasksComponent;
|
let component: ProcessInstanceTasksComponent;
|
||||||
@@ -46,7 +45,7 @@ describe('ProcessInstanceTasksComponent', () => {
|
|||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
loader = TestbedHarnessEnvironment.loader(fixture);
|
loader = TestbedHarnessEnvironment.loader(fixture);
|
||||||
|
|
||||||
spyOn(processService, 'getProcessTasks').and.returnValue(of([new TaskDetailsModel(taskDetailsMock)]));
|
spyOn(processService, 'getProcessTasks').and.returnValue(of([new TaskRepresentation(taskDetailsMock)]));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should initially render message about no active tasks if no process instance ID provided', () => {
|
it('should initially render message about no active tasks if no process instance ID provided', () => {
|
||||||
|
@@ -19,10 +19,10 @@ import { DatePipe } from '@angular/common';
|
|||||||
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild, OnDestroy } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild, OnDestroy } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { Observable, Observer, Subject } from 'rxjs';
|
import { Observable, Observer, Subject } from 'rxjs';
|
||||||
import { TaskDetailsEvent, TaskDetailsModel } from '../../task-list';
|
import { TaskDetailsEvent } from '../../task-list';
|
||||||
import { ProcessService } from './../services/process.service';
|
import { ProcessService } from './../services/process.service';
|
||||||
import { share, takeUntil } from 'rxjs/operators';
|
import { share, takeUntil } from 'rxjs/operators';
|
||||||
import { ProcessInstanceRepresentation } from '@alfresco/js-api';
|
import { ProcessInstanceRepresentation, TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-process-instance-tasks',
|
selector: 'adf-process-instance-tasks',
|
||||||
@@ -55,20 +55,20 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges, OnDestr
|
|||||||
@Output()
|
@Output()
|
||||||
taskClick = new EventEmitter<TaskDetailsEvent>();
|
taskClick = new EventEmitter<TaskDetailsEvent>();
|
||||||
|
|
||||||
activeTasks: TaskDetailsModel[] = [];
|
activeTasks: TaskRepresentation[] = [];
|
||||||
completedTasks: TaskDetailsModel[] = [];
|
completedTasks: TaskRepresentation[] = [];
|
||||||
task$: Observable<TaskDetailsModel>;
|
task$: Observable<TaskRepresentation>;
|
||||||
completedTask$: Observable<TaskDetailsModel>;
|
completedTask$: Observable<TaskRepresentation>;
|
||||||
message: string;
|
message: string;
|
||||||
processId: string;
|
processId: string;
|
||||||
|
|
||||||
private taskObserver: Observer<TaskDetailsModel>;
|
private taskObserver: Observer<TaskRepresentation>;
|
||||||
private completedTaskObserver: Observer<TaskDetailsModel>;
|
private completedTaskObserver: Observer<TaskRepresentation>;
|
||||||
private onDestroy$ = new Subject<boolean>();
|
private onDestroy$ = new Subject<boolean>();
|
||||||
|
|
||||||
constructor(private processService: ProcessService, private dialog: MatDialog) {
|
constructor(private processService: ProcessService, private dialog: MatDialog) {
|
||||||
this.task$ = new Observable<TaskDetailsModel>((observer) => (this.taskObserver = observer)).pipe(share());
|
this.task$ = new Observable<TaskRepresentation>((observer) => (this.taskObserver = observer)).pipe(share());
|
||||||
this.completedTask$ = new Observable<TaskDetailsModel>((observer) => (this.completedTaskObserver = observer)).pipe(share());
|
this.completedTask$ = new Observable<TaskRepresentation>((observer) => (this.completedTaskObserver = observer)).pipe(share());
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -150,7 +150,7 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges, OnDestr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clickTask(task: TaskDetailsModel) {
|
clickTask(task: TaskRepresentation) {
|
||||||
const args = new TaskDetailsEvent(task);
|
const args = new TaskDetailsEvent(task);
|
||||||
this.taskClick.emit(args);
|
this.taskClick.emit(args);
|
||||||
}
|
}
|
||||||
|
@@ -20,22 +20,21 @@ import { exampleProcess } from '../../mock';
|
|||||||
import { ProcessService } from './process.service';
|
import { ProcessService } from './process.service';
|
||||||
import { CoreModule, DateFnsUtils } from '@alfresco/adf-core';
|
import { CoreModule, DateFnsUtils } from '@alfresco/adf-core';
|
||||||
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
||||||
import { ProcessInstanceQueryRepresentation, ProcessDefinitionRepresentation, RestVariable } from '@alfresco/js-api';
|
import { ProcessInstanceQueryRepresentation, ProcessDefinitionRepresentation, RestVariable, TaskRepresentation } from '@alfresco/js-api';
|
||||||
import { TaskDetailsModel } from '@alfresco/adf-process-services';
|
|
||||||
|
|
||||||
const fakeTasksList = {
|
const fakeTasksList = {
|
||||||
data: [
|
data: [
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 1,
|
id: '1',
|
||||||
name: 'Task 1',
|
name: 'Task 1',
|
||||||
processInstanceId: 1000,
|
processInstanceId: '1000',
|
||||||
created: '2016-11-10T03:37:30.010+0000'
|
created: new Date('2016-11-10T03:37:30.010+0000')
|
||||||
}),
|
}),
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 2,
|
id: '2',
|
||||||
name: 'Task 2',
|
name: 'Task 2',
|
||||||
processInstanceId: 1000,
|
processInstanceId: '1000',
|
||||||
created: '2016-11-10T03:37:30.010+0000'
|
created: new Date('2016-11-10T03:37:30.010+0000')
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { AlfrescoApiService, DateFnsUtils, FormValues } from '@alfresco/adf-core';
|
import { AlfrescoApiService, DateFnsUtils, FormValues } from '@alfresco/adf-core';
|
||||||
import { Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
FormDefinitionRepresentation,
|
FormDefinitionRepresentation,
|
||||||
ProcessDefinitionsApi,
|
ProcessDefinitionsApi,
|
||||||
@@ -28,10 +28,10 @@ import {
|
|||||||
RestVariable,
|
RestVariable,
|
||||||
ResultListDataRepresentationProcessInstanceRepresentation,
|
ResultListDataRepresentationProcessInstanceRepresentation,
|
||||||
TasksApi,
|
TasksApi,
|
||||||
ProcessDefinitionRepresentation
|
ProcessDefinitionRepresentation,
|
||||||
|
TaskRepresentation
|
||||||
} from '@alfresco/js-api';
|
} from '@alfresco/js-api';
|
||||||
import { from, Observable } from 'rxjs';
|
import { from, Observable } from 'rxjs';
|
||||||
import { TaskDetailsModel } from '../../task-list';
|
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
|
|
||||||
@@ -39,6 +39,8 @@ import { DatePipe } from '@angular/common';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class ProcessService {
|
export class ProcessService {
|
||||||
|
private alfrescoApiService = inject(AlfrescoApiService);
|
||||||
|
|
||||||
private _tasksApi: TasksApi;
|
private _tasksApi: TasksApi;
|
||||||
get tasksApi(): TasksApi {
|
get tasksApi(): TasksApi {
|
||||||
return (this._tasksApi ||= new TasksApi(this.alfrescoApiService.getInstance()));
|
return (this._tasksApi ||= new TasksApi(this.alfrescoApiService.getInstance()));
|
||||||
@@ -59,8 +61,6 @@ export class ProcessService {
|
|||||||
return (this._processInstanceVariablesApi ||= new ProcessInstanceVariablesApi(this.alfrescoApiService.getInstance()));
|
return (this._processInstanceVariablesApi ||= new ProcessInstanceVariablesApi(this.alfrescoApiService.getInstance()));
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private alfrescoApiService: AlfrescoApiService) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets process instances for a filter and optionally a process definition.
|
* Gets process instances for a filter and optionally a process definition.
|
||||||
*
|
*
|
||||||
@@ -174,7 +174,7 @@ export class ProcessService {
|
|||||||
* @param state Task state filter (can be "active" or "completed")
|
* @param state Task state filter (can be "active" or "completed")
|
||||||
* @returns Array of task instance details
|
* @returns Array of task instance details
|
||||||
*/
|
*/
|
||||||
getProcessTasks(processInstanceId: string, state?: string): Observable<TaskDetailsModel[]> {
|
getProcessTasks(processInstanceId: string, state?: string): Observable<TaskRepresentation[]> {
|
||||||
const taskOpts = state
|
const taskOpts = state
|
||||||
? {
|
? {
|
||||||
processInstanceId,
|
processInstanceId,
|
||||||
|
@@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
import { SimpleChange } from '@angular/core';
|
import { SimpleChange } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
|
||||||
import { ChecklistComponent } from './checklist.component';
|
import { ChecklistComponent } from './checklist.component';
|
||||||
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
||||||
import { TaskListService } from './../services/tasklist.service';
|
import { TaskListService } from './../services/tasklist.service';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
|
import { TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('ChecklistComponent', () => {
|
describe('ChecklistComponent', () => {
|
||||||
let checklistComponent: ChecklistComponent;
|
let checklistComponent: ChecklistComponent;
|
||||||
@@ -37,7 +37,7 @@ describe('ChecklistComponent', () => {
|
|||||||
service = TestBed.inject(TaskListService);
|
service = TestBed.inject(TaskListService);
|
||||||
spyOn(service, 'getTaskChecklist').and.returnValue(
|
spyOn(service, 'getTaskChecklist').and.returnValue(
|
||||||
of([
|
of([
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 'fake-check-changed-id',
|
id: 'fake-check-changed-id',
|
||||||
name: 'fake-check-changed-name'
|
name: 'fake-check-changed-name'
|
||||||
})
|
})
|
||||||
@@ -65,7 +65,7 @@ describe('ChecklistComponent', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
checklistComponent.taskId = 'fake-task-id';
|
checklistComponent.taskId = 'fake-task-id';
|
||||||
checklistComponent.checklist.push(
|
checklistComponent.checklist.push(
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 'fake-check-id',
|
id: 'fake-check-id',
|
||||||
name: 'fake-check-name'
|
name: 'fake-check-name'
|
||||||
})
|
})
|
||||||
@@ -90,7 +90,7 @@ describe('ChecklistComponent', () => {
|
|||||||
checklistComponent.taskId = 'fake-task-id';
|
checklistComponent.taskId = 'fake-task-id';
|
||||||
checklistComponent.readOnly = false;
|
checklistComponent.readOnly = false;
|
||||||
checklistComponent.checklist.push(
|
checklistComponent.checklist.push(
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 'fake-check-id',
|
id: 'fake-check-id',
|
||||||
name: 'fake-check-name'
|
name: 'fake-check-name'
|
||||||
})
|
})
|
||||||
@@ -148,7 +148,7 @@ describe('ChecklistComponent', () => {
|
|||||||
|
|
||||||
it('should show task checklist', () => {
|
it('should show task checklist', () => {
|
||||||
checklistComponent.checklist.push(
|
checklistComponent.checklist.push(
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 'fake-check-id',
|
id: 'fake-check-id',
|
||||||
name: 'fake-check-name'
|
name: 'fake-check-name'
|
||||||
})
|
})
|
||||||
@@ -160,16 +160,16 @@ describe('ChecklistComponent', () => {
|
|||||||
|
|
||||||
it('should not show delete icon when checklist task is completed', () => {
|
it('should not show delete icon when checklist task is completed', () => {
|
||||||
checklistComponent.checklist.push(
|
checklistComponent.checklist.push(
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 'fake-check-id',
|
id: 'fake-check-id',
|
||||||
name: 'fake-check-name'
|
name: 'fake-check-name'
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
checklistComponent.checklist.push(
|
checklistComponent.checklist.push(
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 'fake-completed-id',
|
id: 'fake-completed-id',
|
||||||
name: 'fake-completed-name',
|
name: 'fake-completed-name',
|
||||||
endDate: '2018-05-23T11:25:14.552+0000'
|
endDate: new Date('2018-05-23T11:25:14.552+0000')
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -182,7 +182,7 @@ describe('ChecklistComponent', () => {
|
|||||||
it('should add checklist', async () => {
|
it('should add checklist', async () => {
|
||||||
spyOn(service, 'addTask').and.returnValue(
|
spyOn(service, 'addTask').and.returnValue(
|
||||||
of(
|
of(
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 'fake-check-added-id',
|
id: 'fake-check-added-id',
|
||||||
name: 'fake-check-added-name'
|
name: 'fake-check-added-name'
|
||||||
})
|
})
|
||||||
@@ -205,7 +205,7 @@ describe('ChecklistComponent', () => {
|
|||||||
|
|
||||||
checklistComponent.taskId = 'new-fake-task-id';
|
checklistComponent.taskId = 'new-fake-task-id';
|
||||||
checklistComponent.checklist.push(
|
checklistComponent.checklist.push(
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 'fake-check-id',
|
id: 'fake-check-id',
|
||||||
name: 'fake-check-name'
|
name: 'fake-check-name'
|
||||||
})
|
})
|
||||||
@@ -229,7 +229,7 @@ describe('ChecklistComponent', () => {
|
|||||||
spyOn(service, 'deleteTask').and.returnValue(of(null));
|
spyOn(service, 'deleteTask').and.returnValue(of(null));
|
||||||
checklistComponent.taskId = 'new-fake-task-id';
|
checklistComponent.taskId = 'new-fake-task-id';
|
||||||
checklistComponent.checklist.push(
|
checklistComponent.checklist.push(
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 'fake-check-id',
|
id: 'fake-check-id',
|
||||||
name: 'fake-check-name'
|
name: 'fake-check-name'
|
||||||
})
|
})
|
||||||
@@ -250,7 +250,7 @@ describe('ChecklistComponent', () => {
|
|||||||
it('should show load task checklist on change', async () => {
|
it('should show load task checklist on change', async () => {
|
||||||
checklistComponent.taskId = 'new-fake-task-id';
|
checklistComponent.taskId = 'new-fake-task-id';
|
||||||
checklistComponent.checklist.push(
|
checklistComponent.checklist.push(
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 'fake-check-id',
|
id: 'fake-check-id',
|
||||||
name: 'fake-check-name'
|
name: 'fake-check-name'
|
||||||
})
|
})
|
||||||
@@ -271,7 +271,7 @@ describe('ChecklistComponent', () => {
|
|||||||
it('should show empty checklist when task id is null', async () => {
|
it('should show empty checklist when task id is null', async () => {
|
||||||
checklistComponent.taskId = 'new-fake-task-id';
|
checklistComponent.taskId = 'new-fake-task-id';
|
||||||
checklistComponent.checklist.push(
|
checklistComponent.checklist.push(
|
||||||
new TaskDetailsModel({
|
new TaskRepresentation({
|
||||||
id: 'fake-check-id',
|
id: 'fake-check-id',
|
||||||
name: 'fake-check-name'
|
name: 'fake-check-name'
|
||||||
})
|
})
|
||||||
@@ -294,9 +294,9 @@ describe('ChecklistComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should emit checklist task created event when the checklist is successfully added', (done) => {
|
it('should emit checklist task created event when the checklist is successfully added', (done) => {
|
||||||
spyOn(service, 'addTask').and.returnValue(of(new TaskDetailsModel({ id: 'fake-check-added-id', name: 'fake-check-added-name' })));
|
spyOn(service, 'addTask').and.returnValue(of(new TaskRepresentation({ id: 'fake-check-added-id', name: 'fake-check-added-name' })));
|
||||||
|
|
||||||
const disposableCreated = checklistComponent.checklistTaskCreated.subscribe((taskAdded: TaskDetailsModel) => {
|
const disposableCreated = checklistComponent.checklistTaskCreated.subscribe((taskAdded) => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(taskAdded.id).toEqual('fake-check-added-id');
|
expect(taskAdded.id).toEqual('fake-check-added-id');
|
||||||
expect(taskAdded.name).toEqual('fake-check-added-name');
|
expect(taskAdded.name).toEqual('fake-check-added-name');
|
||||||
|
@@ -17,8 +17,8 @@
|
|||||||
|
|
||||||
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild } from '@angular/core';
|
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild } from '@angular/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
|
||||||
import { TaskListService } from './../services/tasklist.service';
|
import { TaskListService } from './../services/tasklist.service';
|
||||||
|
import { TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-checklist',
|
selector: 'adf-checklist',
|
||||||
@@ -41,11 +41,11 @@ export class ChecklistComponent implements OnChanges {
|
|||||||
|
|
||||||
/** (required) The assignee id that the subtasks are assigned to. */
|
/** (required) The assignee id that the subtasks are assigned to. */
|
||||||
@Input()
|
@Input()
|
||||||
assignee: string;
|
assignee: number;
|
||||||
|
|
||||||
/** Emitted when a new checklist task is created. */
|
/** Emitted when a new checklist task is created. */
|
||||||
@Output()
|
@Output()
|
||||||
checklistTaskCreated = new EventEmitter<TaskDetailsModel>();
|
checklistTaskCreated = new EventEmitter<TaskRepresentation>();
|
||||||
|
|
||||||
/** Emitted when a checklist task is deleted. */
|
/** Emitted when a checklist task is deleted. */
|
||||||
@Output()
|
@Output()
|
||||||
@@ -60,7 +60,7 @@ export class ChecklistComponent implements OnChanges {
|
|||||||
|
|
||||||
taskName: string;
|
taskName: string;
|
||||||
|
|
||||||
checklist: TaskDetailsModel[] = [];
|
checklist: TaskRepresentation[] = [];
|
||||||
|
|
||||||
constructor(private taskListService: TaskListService, private dialog: MatDialog) {}
|
constructor(private taskListService: TaskListService, private dialog: MatDialog) {}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ export class ChecklistComponent implements OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public add() {
|
public add() {
|
||||||
const newTask = new TaskDetailsModel({
|
const newTask = new TaskRepresentation({
|
||||||
name: this.taskName,
|
name: this.taskName,
|
||||||
parentTaskId: this.taskId,
|
parentTaskId: this.taskId,
|
||||||
assignee: { id: this.assignee }
|
assignee: { id: this.assignee }
|
||||||
|
@@ -21,10 +21,10 @@ import { TaskListService } from '../services/tasklist.service';
|
|||||||
import { StartTaskComponent } from './start-task.component';
|
import { StartTaskComponent } from './start-task.component';
|
||||||
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
||||||
import { taskDetailsMock } from '../../mock/task/task-details.mock';
|
import { taskDetailsMock } from '../../mock/task/task-details.mock';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
|
||||||
import { HarnessLoader } from '@angular/cdk/testing';
|
import { HarnessLoader } from '@angular/cdk/testing';
|
||||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||||
import { MatButtonHarness } from '@angular/material/button/testing';
|
import { MatButtonHarness } from '@angular/material/button/testing';
|
||||||
|
import { TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('StartTaskComponent', () => {
|
describe('StartTaskComponent', () => {
|
||||||
let component: StartTaskComponent;
|
let component: StartTaskComponent;
|
||||||
@@ -99,7 +99,7 @@ describe('StartTaskComponent', () => {
|
|||||||
|
|
||||||
it('should send on success event when the task is started', () => {
|
it('should send on success event when the task is started', () => {
|
||||||
const successSpy = spyOn(component.success, 'emit');
|
const successSpy = spyOn(component.success, 'emit');
|
||||||
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
|
||||||
component.taskForm.controls['name'].setValue('fakeName');
|
component.taskForm.controls['name'].setValue('fakeName');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
||||||
@@ -124,7 +124,7 @@ describe('StartTaskComponent', () => {
|
|||||||
|
|
||||||
it('should not emit success event when data not present', () => {
|
it('should not emit success event when data not present', () => {
|
||||||
const successSpy = spyOn(component.success, 'emit');
|
const successSpy = spyOn(component.success, 'emit');
|
||||||
component.taskDetailsModel = new TaskDetailsModel(null);
|
component.taskDetailsModel = new TaskRepresentation(null);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
||||||
createTaskButton.click();
|
createTaskButton.click();
|
||||||
@@ -158,7 +158,7 @@ describe('StartTaskComponent', () => {
|
|||||||
component.taskForm.controls['name'].setValue('fakeName');
|
component.taskForm.controls['name'].setValue('fakeName');
|
||||||
component.taskForm.controls['formKey'].setValue(1204);
|
component.taskForm.controls['formKey'].setValue(1204);
|
||||||
component.appId = 42;
|
component.appId = 42;
|
||||||
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
||||||
createTaskButton.click();
|
createTaskButton.click();
|
||||||
@@ -183,7 +183,7 @@ describe('StartTaskComponent', () => {
|
|||||||
component.taskForm.controls['name'].setValue('fakeName');
|
component.taskForm.controls['name'].setValue('fakeName');
|
||||||
component.taskForm.controls['formKey'].setValue(null);
|
component.taskForm.controls['formKey'].setValue(null);
|
||||||
component.appId = 42;
|
component.appId = 42;
|
||||||
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
||||||
createTaskButton.click();
|
createTaskButton.click();
|
||||||
@@ -243,7 +243,7 @@ describe('StartTaskComponent', () => {
|
|||||||
|
|
||||||
it('should assign task with id of selected user assigned', () => {
|
it('should assign task with id of selected user assigned', () => {
|
||||||
const successSpy = spyOn(component.success, 'emit');
|
const successSpy = spyOn(component.success, 'emit');
|
||||||
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
|
||||||
component.taskForm.controls['name'].setValue('fakeName');
|
component.taskForm.controls['name'].setValue('fakeName');
|
||||||
component.taskForm.controls['formKey'].setValue(1204);
|
component.taskForm.controls['formKey'].setValue(1204);
|
||||||
component.appId = 42;
|
component.appId = 42;
|
||||||
@@ -265,7 +265,7 @@ describe('StartTaskComponent', () => {
|
|||||||
component.taskForm.controls['formKey'].setValue(1204);
|
component.taskForm.controls['formKey'].setValue(1204);
|
||||||
component.appId = 42;
|
component.appId = 42;
|
||||||
component.assigneeId = null;
|
component.assigneeId = null;
|
||||||
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
||||||
createTaskButton.click();
|
createTaskButton.click();
|
||||||
@@ -280,7 +280,7 @@ describe('StartTaskComponent', () => {
|
|||||||
|
|
||||||
it('should not attach a form when a form id is not selected', () => {
|
it('should not attach a form when a form id is not selected', () => {
|
||||||
const attachFormToATask = spyOn(service, 'attachFormToATask').and.returnValue(of([]));
|
const attachFormToATask = spyOn(service, 'attachFormToATask').and.returnValue(of([]));
|
||||||
spyOn(service, 'createNewTask').and.returnValue(of(new TaskDetailsModel({ id: 'task-id' })));
|
spyOn(service, 'createNewTask').and.returnValue(of(new TaskRepresentation({ id: 'task-id' })));
|
||||||
component.taskForm.controls['name'].setValue('fakeName');
|
component.taskForm.controls['name'].setValue('fakeName');
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
|
||||||
|
@@ -20,11 +20,11 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDe
|
|||||||
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
||||||
import { EMPTY, Observable, Subject } from 'rxjs';
|
import { EMPTY, Observable, Subject } from 'rxjs';
|
||||||
import { Form } from '../models/form.model';
|
import { Form } from '../models/form.model';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
|
||||||
import { TaskListService } from './../services/tasklist.service';
|
import { TaskListService } from './../services/tasklist.service';
|
||||||
import { switchMap, defaultIfEmpty, takeUntil } from 'rxjs/operators';
|
import { switchMap, defaultIfEmpty, takeUntil } from 'rxjs/operators';
|
||||||
import { UntypedFormBuilder, AbstractControl, Validators, UntypedFormGroup, UntypedFormControl } from '@angular/forms';
|
import { UntypedFormBuilder, AbstractControl, Validators, UntypedFormGroup, UntypedFormControl } from '@angular/forms';
|
||||||
import { isValid } from 'date-fns';
|
import { isValid } from 'date-fns';
|
||||||
|
import { TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
const FORMAT_DATE = 'DD/MM/YYYY';
|
const FORMAT_DATE = 'DD/MM/YYYY';
|
||||||
const MAX_LENGTH = 255;
|
const MAX_LENGTH = 255;
|
||||||
@@ -60,7 +60,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
|
|||||||
@Output()
|
@Output()
|
||||||
error = new EventEmitter<any>();
|
error = new EventEmitter<any>();
|
||||||
|
|
||||||
taskDetailsModel: TaskDetailsModel = new TaskDetailsModel();
|
taskDetailsModel = new TaskRepresentation();
|
||||||
forms$: Observable<Form[]>;
|
forms$: Observable<Form[]>;
|
||||||
assigneeId: number;
|
assigneeId: number;
|
||||||
field: FormFieldModel;
|
field: FormFieldModel;
|
||||||
@@ -213,7 +213,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
|
|||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
private assignTaskByUserId(taskId: string, userId: string): Observable<TaskDetailsModel> {
|
private assignTaskByUserId(taskId: string, userId: string): Observable<TaskRepresentation> {
|
||||||
if (taskId && userId) {
|
if (taskId && userId) {
|
||||||
return this.taskService.assignTaskByUserId(taskId, userId);
|
return this.taskService.assignTaskByUserId(taskId, userId);
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,7 @@
|
|||||||
<adf-checklist
|
<adf-checklist
|
||||||
[readOnly]="internalReadOnlyForm"
|
[readOnly]="internalReadOnlyForm"
|
||||||
[taskId]="taskDetails.id"
|
[taskId]="taskDetails.id"
|
||||||
[assignee]="$any(taskDetails)?.assignee?.id"
|
[assignee]="taskDetails.assignee?.id"
|
||||||
(checklistTaskCreated)="onChecklistTaskCreated($event)"
|
(checklistTaskCreated)="onChecklistTaskCreated($event)"
|
||||||
(checklistTaskDeleted)="onChecklistTaskDeleted($event)">
|
(checklistTaskDeleted)="onChecklistTaskDeleted($event)">
|
||||||
</adf-checklist>
|
</adf-checklist>
|
||||||
|
@@ -20,7 +20,6 @@ import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { of, throwError } from 'rxjs';
|
import { of, throwError } from 'rxjs';
|
||||||
import { FormModel, FormOutcomeEvent, FormOutcomeModel, CommentModel, User } from '@alfresco/adf-core';
|
import { FormModel, FormOutcomeEvent, FormOutcomeModel, CommentModel, User } from '@alfresco/adf-core';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
|
||||||
import { noDataMock, taskDetailsMock, taskFormMock, tasksMock, taskDetailsWithOutAssigneeMock } from '../../mock';
|
import { noDataMock, taskDetailsMock, taskFormMock, tasksMock, taskDetailsWithOutAssigneeMock } from '../../mock';
|
||||||
import { TaskListService } from './../services/tasklist.service';
|
import { TaskListService } from './../services/tasklist.service';
|
||||||
import { TaskDetailsComponent } from './task-details.component';
|
import { TaskDetailsComponent } from './task-details.component';
|
||||||
@@ -32,7 +31,7 @@ import { PeopleProcessService } from '../../common/services/people-process.servi
|
|||||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||||
import { HarnessLoader } from '@angular/cdk/testing';
|
import { HarnessLoader } from '@angular/cdk/testing';
|
||||||
import { MatDialogHarness } from '@angular/material/dialog/testing';
|
import { MatDialogHarness } from '@angular/material/dialog/testing';
|
||||||
import { LightUserRepresentation } from '@alfresco/js-api';
|
import { LightUserRepresentation, TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
const fakeUser: LightUserRepresentation = {
|
const fakeUser: LightUserRepresentation = {
|
||||||
id: 0,
|
id: 0,
|
||||||
@@ -41,12 +40,12 @@ const fakeUser: LightUserRepresentation = {
|
|||||||
email: 'fake@mail.com'
|
email: 'fake@mail.com'
|
||||||
};
|
};
|
||||||
|
|
||||||
const fakeTaskAssignResponse = new TaskDetailsModel({
|
const fakeTaskAssignResponse: any = {
|
||||||
id: 'fake-id',
|
id: 'fake-id',
|
||||||
firstName: 'fake-name',
|
firstName: 'fake-name',
|
||||||
lastName: 'fake-last',
|
lastName: 'fake-last',
|
||||||
email: 'fake@mail.com'
|
email: 'fake@mail.com'
|
||||||
});
|
};
|
||||||
|
|
||||||
describe('TaskDetailsComponent', () => {
|
describe('TaskDetailsComponent', () => {
|
||||||
let taskListService: TaskListService;
|
let taskListService: TaskListService;
|
||||||
@@ -295,7 +294,7 @@ describe('TaskDetailsComponent', () => {
|
|||||||
|
|
||||||
it('should emit a task created event when checklist task is created', () => {
|
it('should emit a task created event when checklist task is created', () => {
|
||||||
const emitSpy: jasmine.Spy = spyOn(component.taskCreated, 'emit');
|
const emitSpy: jasmine.Spy = spyOn(component.taskCreated, 'emit');
|
||||||
const mockTask = new TaskDetailsModel(taskDetailsMock);
|
const mockTask = new TaskRepresentation(taskDetailsMock);
|
||||||
component.onChecklistTaskCreated(mockTask);
|
component.onChecklistTaskCreated(mockTask);
|
||||||
expect(emitSpy).toHaveBeenCalled();
|
expect(emitSpy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
@@ -307,7 +306,7 @@ describe('TaskDetailsComponent', () => {
|
|||||||
component.showHeaderContent = true;
|
component.showHeaderContent = true;
|
||||||
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
||||||
component.taskPeople = [];
|
component.taskPeople = [];
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsMock);
|
||||||
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -319,7 +318,7 @@ describe('TaskDetailsComponent', () => {
|
|||||||
component.showHeaderContent = true;
|
component.showHeaderContent = true;
|
||||||
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
||||||
component.taskPeople = [];
|
component.taskPeople = [];
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsMock);
|
||||||
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -331,7 +330,7 @@ describe('TaskDetailsComponent', () => {
|
|||||||
component.showHeaderContent = true;
|
component.showHeaderContent = true;
|
||||||
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
||||||
component.taskPeople = [fakeUser];
|
component.taskPeople = [fakeUser];
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsMock);
|
||||||
component.taskDetails.endDate = null;
|
component.taskDetails.endDate = null;
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -343,7 +342,7 @@ describe('TaskDetailsComponent', () => {
|
|||||||
component.showHeaderContent = true;
|
component.showHeaderContent = true;
|
||||||
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
||||||
component.taskPeople = [fakeUser];
|
component.taskPeople = [fakeUser];
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsMock);
|
||||||
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -355,7 +354,7 @@ describe('TaskDetailsComponent', () => {
|
|||||||
component.showHeaderContent = true;
|
component.showHeaderContent = true;
|
||||||
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
||||||
component.taskPeople = [];
|
component.taskPeople = [];
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsMock);
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(component.showComments).toBe(true);
|
expect(component.showComments).toBe(true);
|
||||||
@@ -365,7 +364,7 @@ describe('TaskDetailsComponent', () => {
|
|||||||
component.showComments = false;
|
component.showComments = false;
|
||||||
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
|
||||||
component.taskPeople = [];
|
component.taskPeople = [];
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsMock);
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(component.showComments).toBeFalse();
|
expect(component.showComments).toBeFalse();
|
||||||
|
@@ -39,12 +39,11 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
||||||
import { Observable, Observer, of, Subject } from 'rxjs';
|
import { Observable, Observer, of, Subject } from 'rxjs';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
|
||||||
import { TaskListService } from './../services/tasklist.service';
|
import { TaskListService } from './../services/tasklist.service';
|
||||||
import { catchError, share, takeUntil } from 'rxjs/operators';
|
import { catchError, share, takeUntil } from 'rxjs/operators';
|
||||||
import { TaskFormComponent } from './task-form/task-form.component';
|
import { TaskFormComponent } from './task-form/task-form.component';
|
||||||
import { PeopleProcessService } from '../../common/services/people-process.service';
|
import { PeopleProcessService } from '../../common/services/people-process.service';
|
||||||
import { LightUserRepresentation, TaskQueryRepresentation } from '@alfresco/js-api';
|
import { LightUserRepresentation, TaskQueryRepresentation, TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-task-details',
|
selector: 'adf-task-details',
|
||||||
@@ -132,7 +131,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
|
|
||||||
/** Emitted when a checklist task is created. */
|
/** Emitted when a checklist task is created. */
|
||||||
@Output()
|
@Output()
|
||||||
taskCreated = new EventEmitter<TaskDetailsModel>();
|
taskCreated = new EventEmitter<TaskRepresentation>();
|
||||||
|
|
||||||
/** Emitted when a checklist task is deleted. */
|
/** Emitted when a checklist task is deleted. */
|
||||||
@Output()
|
@Output()
|
||||||
@@ -161,7 +160,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
@Output()
|
@Output()
|
||||||
unClaimedTask = new EventEmitter<string>();
|
unClaimedTask = new EventEmitter<string>();
|
||||||
|
|
||||||
taskDetails: TaskDetailsModel;
|
taskDetails: TaskRepresentation;
|
||||||
taskFormName: string = null;
|
taskFormName: string = null;
|
||||||
taskPeople: LightUserRepresentation[] = [];
|
taskPeople: LightUserRepresentation[] = [];
|
||||||
noTaskDetailsTemplateComponent: TemplateRef<any>;
|
noTaskDetailsTemplateComponent: TemplateRef<any>;
|
||||||
@@ -256,7 +255,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.formLoaded.emit(form);
|
this.formLoaded.emit(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
onChecklistTaskCreated(task: TaskDetailsModel): void {
|
onChecklistTaskCreated(task: TaskRepresentation): void {
|
||||||
this.taskCreated.emit(task);
|
this.taskCreated.emit(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +375,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.taskListService.getTasks(requestNode).subscribe(
|
this.taskListService.getTasks(requestNode).subscribe(
|
||||||
(response) => {
|
(response) => {
|
||||||
if (response && response.length > 0) {
|
if (response && response.length > 0) {
|
||||||
this.taskDetails = new TaskDetailsModel(response[0]);
|
this.taskDetails = new TaskRepresentation(response[0]);
|
||||||
} else {
|
} else {
|
||||||
this.reset();
|
this.reset();
|
||||||
}
|
}
|
||||||
|
@@ -41,12 +41,12 @@ import {
|
|||||||
taskDetailsWithOutFormMock,
|
taskDetailsWithOutFormMock,
|
||||||
taskFormMock
|
taskFormMock
|
||||||
} from '../../../mock/task/task-details.mock';
|
} from '../../../mock/task/task-details.mock';
|
||||||
import { TaskDetailsModel } from '../../models/task-details.model';
|
|
||||||
import { ProcessTestingModule } from '../../../testing/process.testing.module';
|
import { ProcessTestingModule } from '../../../testing/process.testing.module';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { TaskFormService } from '../../../form/services/task-form.service';
|
import { TaskFormService } from '../../../form/services/task-form.service';
|
||||||
import { TaskService } from '../../../form/services/task.service';
|
import { TaskService } from '../../../form/services/task.service';
|
||||||
import { PeopleProcessService } from '../../../common/services/people-process.service';
|
import { PeopleProcessService } from '../../../common/services/people-process.service';
|
||||||
|
import { TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('TaskFormComponent', () => {
|
describe('TaskFormComponent', () => {
|
||||||
let component: TaskFormComponent;
|
let component: TaskFormComponent;
|
||||||
@@ -282,7 +282,7 @@ describe('TaskFormComponent', () => {
|
|||||||
|
|
||||||
it('Should be able to show completed message and cancel button for the completed task without form', async () => {
|
it('Should be able to show completed message and cancel button for the completed task without form', async () => {
|
||||||
completedTaskDetailsMock.formKey = null;
|
completedTaskDetailsMock.formKey = null;
|
||||||
component.taskDetails = new TaskDetailsModel(completedTaskDetailsMock);
|
component.taskDetails = new TaskRepresentation(completedTaskDetailsMock);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
const completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
||||||
@@ -297,7 +297,7 @@ describe('TaskFormComponent', () => {
|
|||||||
|
|
||||||
it('Should not display complete button to the completed task without form', async () => {
|
it('Should not display complete button to the completed task without form', async () => {
|
||||||
completedTaskDetailsMock.formKey = null;
|
completedTaskDetailsMock.formKey = null;
|
||||||
component.taskDetails = new TaskDetailsModel(completedTaskDetailsMock);
|
component.taskDetails = new TaskRepresentation(completedTaskDetailsMock);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
const completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
||||||
@@ -312,7 +312,7 @@ describe('TaskFormComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able to show no form message if the task does not attached a form', async () => {
|
it('Should be able to show no form message if the task does not attached a form', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
const completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
||||||
@@ -326,7 +326,7 @@ describe('TaskFormComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Should be able display complete button to a task without form', async () => {
|
it('Should be able display complete button to a task without form', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
const completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
||||||
@@ -336,7 +336,7 @@ describe('TaskFormComponent', () => {
|
|||||||
|
|
||||||
it('Should be able to complete a task with no form when complete button is clicked', async () => {
|
it('Should be able to complete a task with no form when complete button is clicked', async () => {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
const completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
||||||
@@ -347,7 +347,7 @@ describe('TaskFormComponent', () => {
|
|||||||
it('Should emit error event in case complete task service fails', async () => {
|
it('Should emit error event in case complete task service fails', async () => {
|
||||||
const errorSpy: jasmine.Spy = spyOn(component.error, 'emit');
|
const errorSpy: jasmine.Spy = spyOn(component.error, 'emit');
|
||||||
completeTaskSpy.and.returnValue(throwError({ message: 'servce failed' }));
|
completeTaskSpy.and.returnValue(throwError({ message: 'servce failed' }));
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const formSelector = element.querySelector('adf-form');
|
const formSelector = element.querySelector('adf-form');
|
||||||
@@ -361,7 +361,7 @@ describe('TaskFormComponent', () => {
|
|||||||
it('Should be able to emit cancel event on task with no-form when cancel button is clicked', async () => {
|
it('Should be able to emit cancel event on task with no-form when cancel button is clicked', async () => {
|
||||||
const cancelSpy = spyOn(component.cancel, 'emit');
|
const cancelSpy = spyOn(component.cancel, 'emit');
|
||||||
getTaskDetailsSpy.and.returnValue(of(taskDetailsWithOutFormMock));
|
getTaskDetailsSpy.and.returnValue(of(taskDetailsWithOutFormMock));
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const cancelButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-cancel-button');
|
const cancelButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-cancel-button');
|
||||||
@@ -370,7 +370,7 @@ describe('TaskFormComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Should display the template in a process task with no Form', async () => {
|
it('Should display the template in a process task with no Form', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
let formMessage = fixture.debugElement.nativeElement.querySelector('.adf-empty-content__title');
|
let formMessage = fixture.debugElement.nativeElement.querySelector('.adf-empty-content__title');
|
||||||
@@ -383,7 +383,7 @@ describe('TaskFormComponent', () => {
|
|||||||
expect(subMessage.innerText).toContain('ADF_TASK_FORM.EMPTY_FORM.SUBTITLE');
|
expect(subMessage.innerText).toContain('ADF_TASK_FORM.EMPTY_FORM.SUBTITLE');
|
||||||
|
|
||||||
completeButtonElement.click();
|
completeButtonElement.click();
|
||||||
component.taskDetails = new TaskDetailsModel(completedProcessTaskWithoutForm);
|
component.taskDetails = new TaskRepresentation(completedProcessTaskWithoutForm);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
@@ -394,8 +394,8 @@ describe('TaskFormComponent', () => {
|
|||||||
expect(formMessage.innerText).toContain('ADF_TASK_FORM.COMPLETED_TASK.TITLE');
|
expect(formMessage.innerText).toContain('ADF_TASK_FORM.COMPLETED_TASK.TITLE');
|
||||||
expect(subMessage.innerText).toContain('ADF_TASK_FORM.COMPLETED_TASK.SUBTITLE');
|
expect(subMessage.innerText).toContain('ADF_TASK_FORM.COMPLETED_TASK.SUBTITLE');
|
||||||
expect(cancelButton).not.toBeNull();
|
expect(cancelButton).not.toBeNull();
|
||||||
expect(cancelButton['disabled']).toEqual(false, 'cancel button not visible for completed task');
|
expect(cancelButton['disabled']).toEqual(false);
|
||||||
expect(completeButtonElement).toBeNull('complete button shown for completed task');
|
expect(completeButtonElement).toBeNull();
|
||||||
expect(taskListService.completeTask).toHaveBeenCalled();
|
expect(taskListService.completeTask).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -407,7 +407,7 @@ describe('TaskFormComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Should display empty template in case standalone task does not attached a form', async () => {
|
it('Should display empty template in case standalone task does not attached a form', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(standaloneTaskWithoutForm);
|
component.taskDetails = new TaskRepresentation(standaloneTaskWithoutForm);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const taskStandAlone = element.querySelector('adf-task-standalone');
|
const taskStandAlone = element.querySelector('adf-task-standalone');
|
||||||
@@ -418,7 +418,7 @@ describe('TaskFormComponent', () => {
|
|||||||
|
|
||||||
it('Should be able display attach form button for a standalone task without form', async () => {
|
it('Should be able display attach form button for a standalone task without form', async () => {
|
||||||
const showAttachFormSpy = spyOn(component.showAttachForm, 'emit');
|
const showAttachFormSpy = spyOn(component.showAttachForm, 'emit');
|
||||||
component.taskDetails = new TaskDetailsModel(standaloneTaskWithoutForm);
|
component.taskDetails = new TaskRepresentation(standaloneTaskWithoutForm);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
const attacheFormButton = fixture.debugElement.nativeElement.querySelector('#adf-no-form-attach-form-button');
|
const attacheFormButton = fixture.debugElement.nativeElement.querySelector('#adf-no-form-attach-form-button');
|
||||||
@@ -452,7 +452,7 @@ describe('TaskFormComponent', () => {
|
|||||||
expect(formMessage.innerText).toContain('ADF_TASK_LIST.STANDALONE_TASK.NO_FORM_MESSAGE');
|
expect(formMessage.innerText).toContain('ADF_TASK_LIST.STANDALONE_TASK.NO_FORM_MESSAGE');
|
||||||
|
|
||||||
completeButtonElement.click();
|
completeButtonElement.click();
|
||||||
component.taskDetails = new TaskDetailsModel(completedStandaloneTaskWithoutForm);
|
component.taskDetails = new TaskRepresentation(completedStandaloneTaskWithoutForm);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
@@ -460,8 +460,8 @@ describe('TaskFormComponent', () => {
|
|||||||
completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-button');
|
||||||
attacheFormButton = fixture.debugElement.nativeElement.querySelector('#adf-no-form-attach-form-button');
|
attacheFormButton = fixture.debugElement.nativeElement.querySelector('#adf-no-form-attach-form-button');
|
||||||
expect(formMessage.innerText).toContain('ADF_TASK_LIST.STANDALONE_TASK.COMPLETE_TASK_MESSAGE');
|
expect(formMessage.innerText).toContain('ADF_TASK_LIST.STANDALONE_TASK.COMPLETE_TASK_MESSAGE');
|
||||||
expect(attacheFormButton).toBeNull('attach form button shown for completed task');
|
expect(attacheFormButton).toBeNull();
|
||||||
expect(completeButtonElement).toBeNull('complete button shown for completed task');
|
expect(completeButtonElement).toBeNull();
|
||||||
expect(taskListService.completeTask).toHaveBeenCalled();
|
expect(taskListService.completeTask).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -17,9 +17,8 @@
|
|||||||
|
|
||||||
import { Component, OnInit, Input, Output, EventEmitter, SimpleChanges, ViewEncapsulation, OnChanges } from '@angular/core';
|
import { Component, OnInit, Input, Output, EventEmitter, SimpleChanges, ViewEncapsulation, OnChanges } from '@angular/core';
|
||||||
import { FormModel, ContentLinkModel, FormFieldValidator, FormOutcomeEvent, TranslationService, FormFieldModel } from '@alfresco/adf-core';
|
import { FormModel, ContentLinkModel, FormFieldValidator, FormOutcomeEvent, TranslationService, FormFieldModel } from '@alfresco/adf-core';
|
||||||
import { TaskDetailsModel } from '../../models/task-details.model';
|
|
||||||
import { TaskListService } from '../../services/tasklist.service';
|
import { TaskListService } from '../../services/tasklist.service';
|
||||||
import { UserRepresentation } from '@alfresco/js-api';
|
import { TaskRepresentation, UserRepresentation } from '@alfresco/js-api';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { PeopleProcessService } from '../../../common';
|
import { PeopleProcessService } from '../../../common';
|
||||||
|
|
||||||
@@ -119,7 +118,7 @@ export class TaskFormComponent implements OnInit, OnChanges {
|
|||||||
@Output()
|
@Output()
|
||||||
taskUnclaimed = new EventEmitter<string>();
|
taskUnclaimed = new EventEmitter<string>();
|
||||||
|
|
||||||
taskDetails: TaskDetailsModel;
|
taskDetails: TaskRepresentation;
|
||||||
currentLoggedUser: UserRepresentation;
|
currentLoggedUser: UserRepresentation;
|
||||||
loading: boolean = false;
|
loading: boolean = false;
|
||||||
internalReadOnlyForm: boolean = false;
|
internalReadOnlyForm: boolean = false;
|
||||||
|
@@ -27,12 +27,11 @@ import {
|
|||||||
claimedByGroupMemberMock,
|
claimedByGroupMemberMock,
|
||||||
taskDetailsWithOutCandidateGroup
|
taskDetailsWithOutCandidateGroup
|
||||||
} from '../../mock';
|
} from '../../mock';
|
||||||
|
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
|
||||||
import { TaskListService } from './../services/tasklist.service';
|
import { TaskListService } from './../services/tasklist.service';
|
||||||
import { TaskHeaderComponent } from './task-header.component';
|
import { TaskHeaderComponent } from './task-header.component';
|
||||||
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
||||||
import { PeopleProcessService } from '../../common/services/people-process.service';
|
import { PeopleProcessService } from '../../common/services/people-process.service';
|
||||||
|
import { TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
describe('TaskHeaderComponent', () => {
|
describe('TaskHeaderComponent', () => {
|
||||||
let service: TaskListService;
|
let service: TaskListService;
|
||||||
@@ -64,7 +63,7 @@ describe('TaskHeaderComponent', () => {
|
|||||||
service = TestBed.inject(TaskListService);
|
service = TestBed.inject(TaskListService);
|
||||||
peopleProcessService = TestBed.inject(PeopleProcessService);
|
peopleProcessService = TestBed.inject(PeopleProcessService);
|
||||||
spyOn(peopleProcessService, 'getCurrentUserInfo').and.returnValue(of(fakeBpmAssignedUser));
|
spyOn(peopleProcessService, 'getCurrentUserInfo').and.returnValue(of(fakeBpmAssignedUser));
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
|
component.taskDetails = new TaskRepresentation(taskDetailsMock);
|
||||||
appConfigService = TestBed.inject(AppConfigService);
|
appConfigService = TestBed.inject(AppConfigService);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -133,12 +132,12 @@ describe('TaskHeaderComponent', () => {
|
|||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
const datePicker = fixture.debugElement.query(By.css(`[data-automation-id="datepicker-dueDate"]`));
|
const datePicker = fixture.debugElement.query(By.css(`[data-automation-id="datepicker-dueDate"]`));
|
||||||
expect(datePicker).not.toBeNull('Datepicker should be in DOM');
|
expect(datePicker).not.toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Claiming', () => {
|
describe('Claiming', () => {
|
||||||
it('should be able display the claim/release button if showClaimRelease set to true', async () => {
|
it('should be able display the claim/release button if showClaimRelease set to true', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(claimableTaskDetailsMock);
|
component.taskDetails = new TaskRepresentation(claimableTaskDetailsMock);
|
||||||
component.showClaimRelease = true;
|
component.showClaimRelease = true;
|
||||||
component.refreshData();
|
component.refreshData();
|
||||||
|
|
||||||
@@ -150,7 +149,7 @@ describe('TaskHeaderComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not be able display the claim/release button if showClaimRelease set to false', async () => {
|
it('should not be able display the claim/release button if showClaimRelease set to false', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(claimableTaskDetailsMock);
|
component.taskDetails = new TaskRepresentation(claimableTaskDetailsMock);
|
||||||
component.showClaimRelease = false;
|
component.showClaimRelease = false;
|
||||||
component.refreshData();
|
component.refreshData();
|
||||||
|
|
||||||
@@ -162,7 +161,7 @@ describe('TaskHeaderComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should display the claim button if no assignee', async () => {
|
it('should display the claim button if no assignee', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(claimableTaskDetailsMock);
|
component.taskDetails = new TaskRepresentation(claimableTaskDetailsMock);
|
||||||
|
|
||||||
component.refreshData();
|
component.refreshData();
|
||||||
|
|
||||||
@@ -174,7 +173,7 @@ describe('TaskHeaderComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should display the claim button if the task is claimable', async () => {
|
it('should display the claim button if the task is claimable', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(claimableTaskDetailsMock);
|
component.taskDetails = new TaskRepresentation(claimableTaskDetailsMock);
|
||||||
component.refreshData();
|
component.refreshData();
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -186,7 +185,7 @@ describe('TaskHeaderComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not display the claim/requeue button if the task is not claimable ', async () => {
|
it('should not display the claim/requeue button if the task is not claimable ', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutCandidateGroup);
|
component.taskDetails = new TaskRepresentation(taskDetailsWithOutCandidateGroup);
|
||||||
component.refreshData();
|
component.refreshData();
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -202,7 +201,7 @@ describe('TaskHeaderComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should display the requeue button if task is claimed by the current logged-in user', async () => {
|
it('should display the requeue button if task is claimed by the current logged-in user', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(claimedTaskDetailsMock);
|
component.taskDetails = new TaskRepresentation(claimedTaskDetailsMock);
|
||||||
component.refreshData();
|
component.refreshData();
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -214,7 +213,7 @@ describe('TaskHeaderComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not display the requeue button to logged in user if task is claimed by other candidate member', async () => {
|
it('should not display the requeue button to logged in user if task is claimed by other candidate member', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(claimedByGroupMemberMock);
|
component.taskDetails = new TaskRepresentation(claimedByGroupMemberMock);
|
||||||
component.refreshData();
|
component.refreshData();
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -226,7 +225,7 @@ describe('TaskHeaderComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should display the claim button if the task is claimable by candidates members', async () => {
|
it('should display the claim button if the task is claimable by candidates members', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(claimableTaskDetailsMock);
|
component.taskDetails = new TaskRepresentation(claimableTaskDetailsMock);
|
||||||
component.refreshData();
|
component.refreshData();
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
@@ -239,7 +238,7 @@ describe('TaskHeaderComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should not display the requeue button if the task is completed', async () => {
|
it('should not display the requeue button if the task is completed', async () => {
|
||||||
component.taskDetails = new TaskDetailsModel(completedTaskDetailsMock);
|
component.taskDetails = new TaskRepresentation(completedTaskDetailsMock);
|
||||||
component.refreshData();
|
component.refreshData();
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@@ -26,9 +26,9 @@ import {
|
|||||||
CardViewIntItemModel,
|
CardViewIntItemModel,
|
||||||
CardViewItemLengthValidator
|
CardViewItemLengthValidator
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
|
||||||
import { PeopleProcessService } from '../../common/services/people-process.service';
|
import { PeopleProcessService } from '../../common/services/people-process.service';
|
||||||
import { TaskDescriptionValidator } from '../validators/task-description.validator';
|
import { TaskDescriptionValidator } from '../validators/task-description.validator';
|
||||||
|
import { TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'adf-task-header',
|
selector: 'adf-task-header',
|
||||||
@@ -43,7 +43,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
|
|||||||
|
|
||||||
/** (required) Details related to the task. */
|
/** (required) Details related to the task. */
|
||||||
@Input()
|
@Input()
|
||||||
taskDetails: TaskDetailsModel;
|
taskDetails: TaskRepresentation;
|
||||||
|
|
||||||
/** Toggles display of the claim/release button. */
|
/** Toggles display of the claim/release button. */
|
||||||
@Input()
|
@Input()
|
||||||
|
@@ -15,14 +15,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { TaskDetailsModel } from './task-details.model';
|
import { TaskRepresentation } from '@alfresco/js-api';
|
||||||
|
|
||||||
export class TaskDetailsEvent {
|
export class TaskDetailsEvent {
|
||||||
|
private _value: TaskRepresentation;
|
||||||
private _value: TaskDetailsModel;
|
|
||||||
private _defaultPrevented: boolean = false;
|
private _defaultPrevented: boolean = false;
|
||||||
|
|
||||||
get value(): TaskDetailsModel {
|
get value(): TaskRepresentation {
|
||||||
return this._value;
|
return this._value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ export class TaskDetailsEvent {
|
|||||||
return this._defaultPrevented;
|
return this._defaultPrevented;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(value: TaskDetailsModel) {
|
constructor(value: TaskRepresentation) {
|
||||||
this._value = value;
|
this._value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,111 +0,0 @@
|
|||||||
/*!
|
|
||||||
* @license
|
|
||||||
* Copyright © 2005-2024 Hyland Software, Inc. and its affiliates. All rights reserved.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This object represent the details of a task.
|
|
||||||
*/
|
|
||||||
import { LightUserRepresentation, TaskRepresentation } from '@alfresco/js-api';
|
|
||||||
import { UserGroupModel } from './user-group.model';
|
|
||||||
|
|
||||||
export class TaskDetailsModel implements TaskRepresentation {
|
|
||||||
id?: string;
|
|
||||||
name?: string;
|
|
||||||
assignee?: LightUserRepresentation;
|
|
||||||
priority?: number;
|
|
||||||
adhocTaskCanBeReassigned?: boolean;
|
|
||||||
category?: string;
|
|
||||||
created?: Date;
|
|
||||||
description?: string;
|
|
||||||
parentName?: string;
|
|
||||||
dueDate?: Date;
|
|
||||||
duration?: number;
|
|
||||||
endDate?: Date;
|
|
||||||
executionId?: string;
|
|
||||||
formKey?: string;
|
|
||||||
initiatorCanCompleteTask?: boolean;
|
|
||||||
managerOfCandidateGroup?: boolean;
|
|
||||||
memberOfCandidateGroup?: boolean;
|
|
||||||
memberOfCandidateUsers?: boolean;
|
|
||||||
involvedGroups?: UserGroupModel[];
|
|
||||||
involvedPeople?: LightUserRepresentation[];
|
|
||||||
parentTaskId?: string;
|
|
||||||
parentTaskName?: string;
|
|
||||||
processDefinitionCategory?: string;
|
|
||||||
processDefinitionDeploymentId?: string;
|
|
||||||
processDefinitionDescription?: string;
|
|
||||||
processDefinitionId?: string;
|
|
||||||
processDefinitionKey?: string;
|
|
||||||
processDefinitionName?: string;
|
|
||||||
processDefinitionVersion?: number = 0;
|
|
||||||
processInstanceId?: string;
|
|
||||||
processInstanceName?: string;
|
|
||||||
processInstanceStartUserId?: string;
|
|
||||||
taskDefinitionKey?: string;
|
|
||||||
|
|
||||||
constructor(obj?: any) {
|
|
||||||
if (obj) {
|
|
||||||
this.id = obj.id || null;
|
|
||||||
this.name = obj.name || null;
|
|
||||||
this.priority = obj.priority;
|
|
||||||
this.assignee = obj.assignee;
|
|
||||||
this.adhocTaskCanBeReassigned = obj.adhocTaskCanBeReassigned;
|
|
||||||
this.category = obj.category || null;
|
|
||||||
this.created = obj.created || null;
|
|
||||||
this.description = obj.description || null;
|
|
||||||
this.dueDate = obj.dueDate || null;
|
|
||||||
this.duration = obj.duration || null;
|
|
||||||
this.endDate = obj.endDate || null;
|
|
||||||
this.executionId = obj.executionId || null;
|
|
||||||
this.formKey = obj.formKey || null;
|
|
||||||
this.initiatorCanCompleteTask = !!obj.initiatorCanCompleteTask;
|
|
||||||
this.managerOfCandidateGroup = !!obj.managerOfCandidateGroup;
|
|
||||||
this.memberOfCandidateGroup = !!obj.memberOfCandidateGroup;
|
|
||||||
this.memberOfCandidateUsers = !!obj.memberOfCandidateUsers;
|
|
||||||
this.involvedGroups = obj.involvedGroups;
|
|
||||||
this.involvedPeople = obj.involvedPeople;
|
|
||||||
this.parentTaskId = obj.parentTaskId || null;
|
|
||||||
this.parentTaskName = obj.parentTaskName || null;
|
|
||||||
this.processDefinitionCategory = obj.processDefinitionCategory || null;
|
|
||||||
this.processDefinitionDeploymentId = obj.processDefinitionDeploymentId || null;
|
|
||||||
this.processDefinitionDescription = obj.processDefinitionDescription || null;
|
|
||||||
this.processDefinitionId = obj.processDefinitionId || null;
|
|
||||||
this.processDefinitionKey = obj.processDefinitionKey || null;
|
|
||||||
this.processDefinitionName = obj.processDefinitionName || null;
|
|
||||||
this.processDefinitionVersion = obj.processDefinitionVersion || 0;
|
|
||||||
this.processInstanceId = obj.processInstanceId || null;
|
|
||||||
this.processInstanceName = obj.processInstanceName || null;
|
|
||||||
this.processInstanceStartUserId = obj.processInstanceStartUserId || null;
|
|
||||||
this.taskDefinitionKey = obj.taskDefinitionKey || null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getFullName(): string {
|
|
||||||
let fullName: string = '';
|
|
||||||
|
|
||||||
if (this.assignee) {
|
|
||||||
const firstName: string = this.assignee.firstName ? this.assignee.firstName : '';
|
|
||||||
const lastName: string = this.assignee.lastName ? this.assignee.lastName : '';
|
|
||||||
fullName = `${firstName} ${lastName}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fullName.trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
isCompleted(): boolean {
|
|
||||||
return !!this.endDate;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -36,7 +36,6 @@ export * from './services/task-filter.service';
|
|||||||
|
|
||||||
export * from './models/form.model';
|
export * from './models/form.model';
|
||||||
export * from './models/task-details.event';
|
export * from './models/task-details.event';
|
||||||
export * from './models/task-details.model';
|
|
||||||
export * from './models/user-event.model';
|
export * from './models/user-event.model';
|
||||||
export * from './models/user-group.model';
|
export * from './models/user-group.model';
|
||||||
|
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||||
import { Injectable } from '@angular/core';
|
import { inject, Injectable } from '@angular/core';
|
||||||
import { Observable, forkJoin, from } from 'rxjs';
|
import { Observable, forkJoin, from } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { UserFiltersApi, UserTaskFilterRepresentation } from '@alfresco/js-api';
|
import { UserFiltersApi, UserTaskFilterRepresentation } from '@alfresco/js-api';
|
||||||
@@ -25,14 +25,14 @@ import { UserFiltersApi, UserTaskFilterRepresentation } from '@alfresco/js-api';
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class TaskFilterService {
|
export class TaskFilterService {
|
||||||
|
private apiService = inject(AlfrescoApiService);
|
||||||
|
|
||||||
private _userFiltersApi: UserFiltersApi;
|
private _userFiltersApi: UserFiltersApi;
|
||||||
get userFiltersApi(): UserFiltersApi {
|
get userFiltersApi(): UserFiltersApi {
|
||||||
this._userFiltersApi = this._userFiltersApi ?? new UserFiltersApi(this.apiService.getInstance());
|
this._userFiltersApi = this._userFiltersApi ?? new UserFiltersApi(this.apiService.getInstance());
|
||||||
return this._userFiltersApi;
|
return this._userFiltersApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and returns the default filters for a process app.
|
* Creates and returns the default filters for a process app.
|
||||||
*
|
*
|
||||||
|
@@ -20,7 +20,6 @@ import { Injectable } from '@angular/core';
|
|||||||
import { Observable, from, of } from 'rxjs';
|
import { Observable, from, of } from 'rxjs';
|
||||||
import { map, catchError, flatMap, filter } from 'rxjs/operators';
|
import { map, catchError, flatMap, filter } from 'rxjs/operators';
|
||||||
import { Form } from '../models/form.model';
|
import { Form } from '../models/form.model';
|
||||||
import { TaskDetailsModel } from '../models/task-details.model';
|
|
||||||
import {
|
import {
|
||||||
TaskUpdateRepresentation,
|
TaskUpdateRepresentation,
|
||||||
ModelsApi,
|
ModelsApi,
|
||||||
@@ -29,7 +28,8 @@ import {
|
|||||||
ChecklistsApi,
|
ChecklistsApi,
|
||||||
ResultListDataRepresentationTaskRepresentation,
|
ResultListDataRepresentationTaskRepresentation,
|
||||||
TaskQueryRepresentation,
|
TaskQueryRepresentation,
|
||||||
UserTaskFilterRepresentation
|
UserTaskFilterRepresentation,
|
||||||
|
TaskRepresentation
|
||||||
} from '@alfresco/js-api';
|
} from '@alfresco/js-api';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
@@ -121,8 +121,8 @@ export class TaskListService {
|
|||||||
* @param taskId ID of the target task.
|
* @param taskId ID of the target task.
|
||||||
* @returns Task details
|
* @returns Task details
|
||||||
*/
|
*/
|
||||||
getTaskDetails(taskId: string): Observable<TaskDetailsModel> {
|
getTaskDetails(taskId: string): Observable<TaskRepresentation> {
|
||||||
return from(this.tasksApi.getTask(taskId)).pipe(map((details) => new TaskDetailsModel(details)));
|
return from(this.tasksApi.getTask(taskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,8 +131,8 @@ export class TaskListService {
|
|||||||
* @param id ID of the target task
|
* @param id ID of the target task
|
||||||
* @returns Array of checklist task details
|
* @returns Array of checklist task details
|
||||||
*/
|
*/
|
||||||
getTaskChecklist(id: string): Observable<TaskDetailsModel[]> {
|
getTaskChecklist(id: string): Observable<TaskRepresentation[]> {
|
||||||
return from(this.checklistsApi.getChecklist(id)).pipe(map((response) => response.data.map((checklist) => new TaskDetailsModel(checklist))));
|
return from(this.checklistsApi.getChecklist(id)).pipe(map((response) => response.data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,8 +167,8 @@ export class TaskListService {
|
|||||||
* @param task The task to add
|
* @param task The task to add
|
||||||
* @returns The subtask that was added
|
* @returns The subtask that was added
|
||||||
*/
|
*/
|
||||||
addTask(task: TaskDetailsModel): Observable<TaskDetailsModel> {
|
addTask(task: TaskRepresentation): Observable<TaskRepresentation> {
|
||||||
return from(this.checklistsApi.addSubtask(task.parentTaskId, task)).pipe(map((response) => new TaskDetailsModel(response)));
|
return from(this.checklistsApi.addSubtask(task.parentTaskId, task));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -207,8 +207,8 @@ export class TaskListService {
|
|||||||
* @param task Details of the new task
|
* @param task Details of the new task
|
||||||
* @returns Details of the newly created task
|
* @returns Details of the newly created task
|
||||||
*/
|
*/
|
||||||
createNewTask(task: TaskDetailsModel): Observable<TaskDetailsModel> {
|
createNewTask(task: TaskRepresentation): Observable<TaskRepresentation> {
|
||||||
return from(this.tasksApi.createNewTask(task)).pipe(map((response) => new TaskDetailsModel(response)));
|
return from(this.tasksApi.createNewTask(task));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,9 +218,9 @@ export class TaskListService {
|
|||||||
* @param requestNode User or group to assign the task to
|
* @param requestNode User or group to assign the task to
|
||||||
* @returns Details of the assigned task
|
* @returns Details of the assigned task
|
||||||
*/
|
*/
|
||||||
assignTask(taskId: string, requestNode: any): Observable<TaskDetailsModel> {
|
assignTask(taskId: string, requestNode: any): Observable<TaskRepresentation> {
|
||||||
const assignee = { assignee: requestNode.id };
|
const assignee = { assignee: requestNode.id };
|
||||||
return from(this.taskActionsApi.assignTask(taskId, assignee)).pipe(map((response) => new TaskDetailsModel(response)));
|
return from(this.taskActionsApi.assignTask(taskId, assignee));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -230,10 +230,10 @@ export class TaskListService {
|
|||||||
* @param userId ID of the user to assign the task to
|
* @param userId ID of the user to assign the task to
|
||||||
* @returns Details of the assigned task
|
* @returns Details of the assigned task
|
||||||
*/
|
*/
|
||||||
assignTaskByUserId(taskId: string, userId: string): Observable<TaskDetailsModel> {
|
assignTaskByUserId(taskId: string, userId: string): Observable<TaskRepresentation> {
|
||||||
const assignee = { assignee: userId };
|
const assignee = { assignee: userId };
|
||||||
|
|
||||||
return from(this.taskActionsApi.assignTask(taskId, assignee)).pipe(map((response) => new TaskDetailsModel(response)));
|
return from(this.taskActionsApi.assignTask(taskId, assignee));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -242,7 +242,7 @@ export class TaskListService {
|
|||||||
* @param taskId ID of the task to claim
|
* @param taskId ID of the task to claim
|
||||||
* @returns Details of the claimed task
|
* @returns Details of the claimed task
|
||||||
*/
|
*/
|
||||||
claimTask(taskId: string): Observable<TaskDetailsModel> {
|
claimTask(taskId: string): Observable<TaskRepresentation> {
|
||||||
return from(this.taskActionsApi.claimTask(taskId));
|
return from(this.taskActionsApi.claimTask(taskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ export class TaskListService {
|
|||||||
* @param taskId ID of the task to unclaim
|
* @param taskId ID of the task to unclaim
|
||||||
* @returns Null response notifying when the operation is complete
|
* @returns Null response notifying when the operation is complete
|
||||||
*/
|
*/
|
||||||
unclaimTask(taskId: string): Observable<TaskDetailsModel> {
|
unclaimTask(taskId: string): Observable<TaskRepresentation> {
|
||||||
return from(this.taskActionsApi.unclaimTask(taskId));
|
return from(this.taskActionsApi.unclaimTask(taskId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,8 +263,8 @@ export class TaskListService {
|
|||||||
* @param updated Data to update the task (as a `TaskUpdateRepresentation` instance).
|
* @param updated Data to update the task (as a `TaskUpdateRepresentation` instance).
|
||||||
* @returns Updated task details
|
* @returns Updated task details
|
||||||
*/
|
*/
|
||||||
updateTask(taskId: string, updated: TaskUpdateRepresentation): Observable<TaskDetailsModel> {
|
updateTask(taskId: string, updated: TaskUpdateRepresentation): Observable<TaskRepresentation> {
|
||||||
return from(this.tasksApi.updateTask(taskId, updated)).pipe(map((result) => result as TaskDetailsModel));
|
return from(this.tasksApi.updateTask(taskId, updated));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user