[ACS-7420] cleanup process types (#9709)

This commit is contained in:
Denys Vuika 2024-05-21 12:03:57 -04:00 committed by GitHub
parent 07370d963f
commit ff6a92a471
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
31 changed files with 344 additions and 434 deletions

View File

@ -1,4 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
export NODE_OPTIONS=--max_old_space_size=8192
npx lint-staged

View File

@ -16,12 +16,13 @@
*/
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 { DiscoveryApiService, UploadService } from '@alfresco/adf-content-services';
import { PreviewService } from '../../services/preview.service';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { TaskRepresentation } from '@alfresco/js-api';
/**
* Provide a task upload service factory
@ -55,7 +56,7 @@ export class TaskAttachmentsComponent implements OnInit, OnChanges, OnDestroy {
@Input()
taskId: string;
taskDetails: TaskDetailsModel;
taskDetails: TaskRepresentation;
private onDestroy$ = new Subject<boolean>();

View File

@ -2,10 +2,10 @@
Title: Checklist Component
Added: v2.0.0
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.
@ -23,16 +23,16 @@ Shows the checklist task functionality.
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| 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. |
| taskId | `string` | | (required) The id of the parent task to which subtasks are attached. |
| Name | Type | Default value | Description |
|----------|-----------|---------------|-----------------------------------------------------------------------------------------|
| 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. |
| taskId | `string` | | (required) The id of the parent task to which subtasks are attached. |
### Events
| 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. |
| checklistTaskDeleted | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when a checklist task is deleted. |
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when an error occurs. |
| Name | Type | Description |
|----------------------|------------------------------------|-----------------------------------------------|
| checklistTaskCreated | `EventEmitter<TaskRepresentation>` | Emitted when a new checklist task is created. |
| checklistTaskDeleted | `EventEmitter<string>` | Emitted when a checklist task is deleted. |
| error | `EventEmitter<any>` | Emitted when an error occurs. |

View File

@ -2,10 +2,10 @@
Title: Task Details component
Added: v2.0.0
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.
@ -21,45 +21,45 @@ Shows the details of the task ID passed in as input.
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| 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. |
| 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. |
| showComments | `boolean` | true | Toggles `Comments` feature for the Header component. |
| showFormCompleteButton | `boolean` | true | Toggles rendering of the `Complete` outcome button. |
| showFormRefreshButton | `boolean` | true | Toggles rendering of the `Refresh` button. |
| showFormSaveButton | `boolean` | true | Toggles rendering of the `Save` outcome button. |
| showFormTitle | `boolean` | false | Toggles rendering of the form title. |
| showHeader | `boolean` | true | Toggles task details Header component. |
| showHeaderContent | `boolean` | true | Toggles collapsed/expanded state of 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. |
| taskId | `string` | | (**required**) The id of the task whose details we are asking for. |
| Name | Type | Default value | Description |
|------------------------|------------------------|---------------|---------------------------------------------------------------------------------------|
| debugMode | `boolean` | false | Toggles debug mode. |
| 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. |
| showChecklist | `boolean` | true | Toggles `Checklist` 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. |
| showFormRefreshButton | `boolean` | true | Toggles rendering of the `Refresh` button. |
| showFormSaveButton | `boolean` | true | Toggles rendering of the `Save` outcome button. |
| showFormTitle | `boolean` | false | Toggles rendering of the form title. |
| showHeader | `boolean` | true | Toggles task details Header component. |
| showHeaderContent | `boolean` | true | Toggles collapsed/expanded state of 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. |
| taskId | `string` | | (**required**) The id of the task whose details we are asking for. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| assignTask | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<void>` | Emitted when a task is assigned. |
| claimedTask | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when a task is claimed. |
| error | [`EventEmitter`](https://angular.io/api/core/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()`. |
| 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. |
| 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. |
| 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. |
| 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. |
| 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. |
| taskDeleted | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when a checklist task is deleted. |
| unClaimedTask | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<string>` | Emitted when a task is unclaimed. |
| Name | Type | Description |
|--------------------|------------------------------------|--------------------------------------------------------------------------------------------------------|
| assignTask | `EventEmitter<void>` | Emitted when a task is assigned. |
| claimedTask | `EventEmitter<string>` | Emitted when a task is claimed. |
| error | `EventEmitter<any>` | Emitted when an error occurs. |
| executeOutcome | `EventEmitter<FormOutcomeEvent>` | Emitted when any outcome is executed. Default behaviour can be prevented via `event.preventDefault()`. |
| formCompleted | `EventEmitter<FormModel>` | Emitted when the form is submitted with the `Complete` outcome. |
| formContentClicked | `EventEmitter<ContentLinkModel>` | Emitted when the form field content is clicked. |
| formLoaded | `EventEmitter<FormModel>` | Emitted when the form is loaded or reloaded. |
| formSaved | `EventEmitter<FormModel>` | Emitted when the form is submitted with the `Save` or custom outcomes. |
| taskCreated | `EventEmitter<TaskRepresentation>` | Emitted when a checklist task is created. |
| taskDeleted | `EventEmitter<string>` | Emitted when a checklist task is deleted. |
| unClaimedTask | `EventEmitter<string>` | Emitted when a task is unclaimed. |
## Details
### Custom 'empty Task Details' template
By default the [Task Details component](task-details.component.md) shows a simple "No Tasks" message when there are
no details. You can change this by adding the a custom HTML template as in the following
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 a custom HTML template as in the following
example:
```html
@ -67,7 +67,7 @@ example:
<adf-no-task-details-template>
<ng-template>
<h1>Sorry, no tasks here</h1>
<img src="example.jpg">
<img src="example.jpg" alt="example">
</ng-template>
</adf-no-task-details-template>
</adf-task-details>

View File

@ -2,10 +2,10 @@
Title: Task Header component
Added: v2.0.0
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.
@ -23,18 +23,18 @@ Shows all the information related to a task.
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| formName | `string` | null | The name of the form. |
| 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. |
| Name | Type | Default value | Description |
|------------------|----------------------|---------------|----------------------------------------------|
| formName | `string` | null | The name of the form. |
| showClaimRelease | `boolean` | true | Toggles display of the claim/release button. |
| taskDetails | `TaskRepresentation` | | Details related to the task. |
### Events
| Name | Type | Description |
| ---- | ---- | ----------- |
| claim | [`EventEmitter`](https://angular.io/api/core/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). |
| Name | Type | Description |
|---------|---------------------|---------------------------------------------------|
| claim | `EventEmitter<any>` | Emitted when the task is claimed. |
| unclaim | `EventEmitter<any>` | Emitted when the task is unclaimed (ie, requeue). |
## Details
@ -43,16 +43,32 @@ The component populates an internal array of
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`:
```json
{
"adf-task-header": {
"presets": {
"properties" : [ "assignee", "status", "priority", "parentName"]
}
},
"presets": {
"properties": [
"assignee",
"status",
"priority",
"parentName"
]
}
}
}
```
With this configuration, only the four listed properties will be shown.

View File

@ -5,7 +5,7 @@ Status: Active
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.
@ -51,32 +51,32 @@ when the task list is empty:
### Properties
| Name | Type | Default value | Description |
| ---- | ---- | ------------- | ----------- |
| 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). |
| 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. |
| 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`. |
| isResizingEnabled | `boolean` | false | Toggles column resizing for task list. |
| 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. |
| multiselect | `boolean` | false | Toggles multiple row selection, renders checkboxes at the beginning of each row |
| name | `string` | | Name of the tasklist. |
| page | `number` | 0 | The page number of the tasks to fetch. |
| presetColumn | `string` | | Custom preset column schema in JSON format. |
| processDefinitionId | `string` | | The Definition Id of the process. |
| processInstanceId | `string` | | The Instance Id of the process. |
| 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. |
| showContextMenu | `boolean` | false | Toggles custom context menu for the component. |
| 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` |
| 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`. |
| stickyHeader | `boolean` | false | Toggles the sticky header mode. |
| taskId | `string` | | The id of a task |
| Name | Type | Default value | Description |
|------------------------|-------------------------------------------------------------------------------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 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). |
| 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. |
| 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`. |
| isResizingEnabled | `boolean` | false | Toggles column resizing for task list. |
| 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. |
| multiselect | `boolean` | false | Toggles multiple row selection, renders checkboxes at the beginning of each row |
| name | `string` | | Name of the tasklist. |
| page | `number` | 0 | The page number of the tasks to fetch. |
| presetColumn | `string` | | Custom preset column schema in JSON format. |
| processDefinitionId | `string` | | The Definition Id of the process. |
| processInstanceId | `string` | | The Instance Id of the process. |
| 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. |
| showContextMenu | `boolean` | false | Toggles custom context menu for the component. |
| 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` |
| 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`. |
| stickyHeader | `boolean` | false | Toggles the sticky header mode. |
| taskId | `string` | | The id of a task |
### Events
@ -95,12 +95,11 @@ renders details of any chosen instance.
### Setting the column schema
You can configure the list to show any of the properties of the
[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)
You can configure the list to show any of the properties of the `TaskRepresentation`
class. The example below shows how to set up the column schema from HTML:
```html
<adf-tasklist ...>
<adf-tasklist>
<data-columns>
<data-column key="name" title="NAME" class="full-width name-column"></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:
```json
"adf-task-list": {
{
"adf-task-list": {
"presets": {
"customSchema": [
{
{
"key": "name",
"type": "text",
"title": "name",
"sortable": true
}],
"sortable": true
}
],
"default": [
{
"key": "name",
"type": "text",
"title": "name",
"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:
```json
"adf-task-list": {
{
"adf-task-list": {
"presets": {
"customSchema": [
{
{
"key": "id",
"type": "text",
"title": "Id",
"sortable": true
}],
"sortable": true
}
],
"default": [
{
"key": "name",
"type": "text",
"title": "name",
"sortable": true
}],
}
]
}
}
}
```
@ -197,7 +204,7 @@ let sortParam = 'created-desc';
### 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
<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
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
[
@ -249,7 +256,7 @@ You can provide all necessary content via the handler.
Event properties:
```ts
```text
value: {
row: DataRow,
col: DataColumn,
@ -259,7 +266,7 @@ value: {
Handler example:
```ts
```text
onShowRowContextMenu(event: DataCellEvent) {
event.value.actions = [
{ title: 'Task List Context Menu' },

View File

@ -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
- _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
- **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.
- _processInstanceId:_ `string` - ID of the process instance
- _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
- **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/>
- **Returns** `Observable<TaskRepresentation[]>` - Array of task instance details
- **getProcesses**(requestNode: `ProcessFilterParamRepresentationModel, processDefinitionKey?: `string`): `Observable<ProcessListModel>`<br/>
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
- _processDefinitionKey:_ `string` - (Optional) Limits returned instances to a process definition

View File

@ -17,53 +17,53 @@ import { TaskListService } from '@alfresco/adf-process-services';
### 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.
- _task:_ [`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts) - 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
- **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/>
- _task:_ `TaskRepresentation` - The task to add
- **Returns** `Observable<TaskRepresentation>` - The subtask that was added
- **assignTask**(taskId: `string`, requestNode: `any`): `Observable<TaskRepresentation>`<br/>
Assigns a task to a user or group.
- _taskId:_ `string` - The task to assign
- _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
- **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/>
- **Returns** `Observable<TaskRepresentation>` - Details of the assigned task
- **assignTaskByUserId**(taskId: `string`, userId: `string`): `Observable<TaskRepresentation>`<br/>
Assigns a task to a user.
- _taskId:_ `string` - ID of the task to assign
- _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/>
Attaches a form to a task.
- _taskId:_ `string` - ID of the target task
- _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
- **claimTask**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
- **Returns** `Observable<any>` - Null response notifying when the operation is complete
- **claimTask**(taskId: `string`): `Observable<TaskRepresentation>`<br/>
Claims a task for the current user.
- _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
- **completeTask**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
- **Returns** `Observable<TaskRepresentation>` - Details of the claimed task
- **completeTask**(taskId: `string`): `Observable<any>`<br/>
Gives completed status to a 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
- **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/>
- **Returns** `Observable<any>` - Null response notifying when the operation is complete
- **createNewTask**(task: `TaskRepresentation`): `Observable<TaskRepresentation>`<br/>
Creates a new standalone task.
- _task:_ [`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts) - 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
- **deleteForm**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
- _task:_ `TaskDetailsModel` - Details of the new task
- **Returns** `Observable<TaskRepresentation>` - Details of the newly created task
- **deleteForm**(taskId: `string`): `Observable<TaskRepresentation>`<br/>
Deletes a form from a task.
- _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
- **deleteTask**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
- **Returns** `Observable<TaskRepresentation>` - Null response notifying when the operation is complete
- **deleteTask**(taskId: `string`): `Observable<TaskRepresentation>`<br/>
Deletes a subtask (ie, a checklist task) from a parent task.
- _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
- **fetchTaskAuditJsonById**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<any>`<br/>
- **Returns** `Observable<TaskRepresentation>` - Null response notifying when the operation is complete
- **fetchTaskAuditJsonById**(taskId: `string`): `Observable<any>`<br/>
Fetch the Task Audit information in JSON format
- _taskId:_ `string` - ID of the target task
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<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/>
- **Returns** `Observable<any>` - JSON data
- **fetchTaskAuditPdfById**(taskId: `string`): `Observable<Blob>`<br/>
Fetches the Task Audit information in PDF format.
- _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/>
Gets tasks matching a query and state value.
- _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
- **getFormList**(): `Observable<Form[]>`<br/>
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
- **getTaskChecklist**(id: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`[]>`<br/>
- **Returns** `Observable<Form[]>` - Array of form details
- **getTaskChecklist**(id: `string`): `Observable<TaskRepresentation[]>`<br/>
Gets the checklist for a 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
- **getTaskDetails**(taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>`<br/>
- **Returns** `Observable<TaskRepresentation[]>` - Array of checklist task details
- **getTaskDetails**(taskId: `string`): `Observable<TaskRepresentation>`<br/>
Gets details for a task.
- _taskId:_ `string` - ID of the target task.
- **Returns** `Observable<TaskDetailsModel>` - Task details
@ -101,18 +101,18 @@ import { TaskListService } from '@alfresco/adf-process-services';
- **unclaimTask**(taskId: `string`): `Observable<TaskDetailsModel>`<br/>
Un-claims a task for the current user.
- _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
- **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/>
- **Returns** `Observable<TaskRepresentation>` - Null response notifying when the operation is complete
- **updateTask**(taskId: `string`, updated: `TaskUpdateRepresentation`): `Observable<TaskRepresentation>`<br/>
Updates the details (name, description, due date) for a task.
- _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).
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsModel`](../../../lib/process-services/src/lib/task-list/models/task-details.model.ts)`>` - Updated task details
- _updated:_ `TaskUpdateRepresentation`) - Data to update the task (as a `TaskUpdateRepresentation`) instance).
- **Returns** `Observable<TaskRepresentation>` - Updated task details
## 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`
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
adhocTaskCanBeReassigned: false

View File

@ -30,6 +30,7 @@ export * from './services/identity-group.service';
export * from './services/jwt-helper.service';
export * from './services/oauth2.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/process-auth';

View File

@ -20,6 +20,7 @@ import {
LightUserRepresentation,
ProcessInstanceRepresentation,
RestVariable,
TaskRepresentation,
UserRepresentation,
UserTaskFilterRepresentation
} from '@alfresco/js-api';
@ -45,4 +46,7 @@ export type UserProcessModel = LightUserRepresentation;
/** @deprecated use js-api/RestVariable instead */
export type ProcessInstanceVariable = RestVariable;
/** @deprecated use js-api/TaskRepresentation instead */
export type TaskDetailsModel = TaskRepresentation;
export { ProcessDefinitionRepresentation } from '@alfresco/js-api';

View File

@ -15,10 +15,9 @@
* limitations under the License.
*/
import { UserRepresentation } from '@alfresco/js-api';
import { TaskDetailsModel } from '../../task-list/models/task-details.model';
import { TaskRepresentation, UserRepresentation } from '@alfresco/js-api';
export const standaloneTaskWithoutForm = new TaskDetailsModel({
export const standaloneTaskWithoutForm = new TaskRepresentation({
id: '200',
name: 'Standalone Task Without Form',
description: null,
@ -29,7 +28,7 @@ export const standaloneTaskWithoutForm = new TaskDetailsModel({
lastName: 'Adams',
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,
endDate: null,
duration: null,
@ -58,7 +57,7 @@ export const standaloneTaskWithoutForm = new TaskDetailsModel({
memberOfCandidateGroup: false
});
export const completedStandaloneTaskWithoutForm = new TaskDetailsModel({
export const completedStandaloneTaskWithoutForm = new TaskRepresentation({
id: '200',
name: 'Standalone Task Without Form',
description: null,
@ -69,7 +68,7 @@ export const completedStandaloneTaskWithoutForm = new TaskDetailsModel({
lastName: 'Adams',
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,
endDate: new Date(),
duration: null,
@ -98,7 +97,7 @@ export const completedStandaloneTaskWithoutForm = new TaskDetailsModel({
memberOfCandidateGroup: false
});
export const taskDetailsMock = new TaskDetailsModel({
export const taskDetailsMock = new TaskRepresentation({
id: '91',
name: 'Request translation',
description: null,
@ -109,7 +108,7 @@ export const taskDetailsMock = new TaskDetailsModel({
lastName: 'Adams',
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,
endDate: null,
duration: null,
@ -138,13 +137,13 @@ export const taskDetailsMock = new TaskDetailsModel({
memberOfCandidateGroup: false
});
export const initiatorCanCompleteTaskDetailsMock = new TaskDetailsModel({
export const initiatorCanCompleteTaskDetailsMock = new TaskRepresentation({
id: '91',
name: 'Request translation',
description: null,
category: null,
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,
endDate: null,
duration: null,
@ -173,13 +172,13 @@ export const initiatorCanCompleteTaskDetailsMock = new TaskDetailsModel({
memberOfCandidateGroup: false
});
export const initiatorWithCandidatesTaskDetailsMock = new TaskDetailsModel({
export const initiatorWithCandidatesTaskDetailsMock = new TaskRepresentation({
id: '91',
name: 'Request translation',
description: null,
category: null,
assignee: null,
created: '2016-11-03T15:25:42.749+0000',
created: new Date('2016-11-03T15:25:42.749+0000'),
dueDate: null,
endDate: null,
duration: null,
@ -221,13 +220,13 @@ export const initiatorWithCandidatesTaskDetailsMock = new TaskDetailsModel({
memberOfCandidateGroup: true
});
export const taskDetailsWithOutAssigneeMock = new TaskDetailsModel({
export const taskDetailsWithOutAssigneeMock = new TaskRepresentation({
id: '91',
name: 'Request translation',
description: null,
category: null,
assignee: undefined,
created: '2016-11-03T15:25:42.749+0000',
created: new Date('2016-11-03T15:25:42.749+0000'),
dueDate: null,
endDate: null,
duration: null,
@ -256,13 +255,13 @@ export const taskDetailsWithOutAssigneeMock = new TaskDetailsModel({
memberOfCandidateGroup: false
});
export const claimableTaskDetailsMock = new TaskDetailsModel({
export const claimableTaskDetailsMock = new TaskRepresentation({
id: '91',
name: 'Request translation',
description: null,
category: null,
assignee: null,
created: '2016-11-03T15:25:42.749+0000',
created: new Date('2016-11-03T15:25:42.749+0000'),
dueDate: null,
endDate: null,
duration: null,
@ -296,7 +295,7 @@ export const claimableTaskDetailsMock = new TaskDetailsModel({
memberOfCandidateUsers: false
});
export const claimedTaskDetailsMock = new TaskDetailsModel({
export const claimedTaskDetailsMock = new TaskRepresentation({
id: '91',
name: 'Request translation',
description: null,
@ -307,7 +306,7 @@ export const claimedTaskDetailsMock = new TaskDetailsModel({
lastName: 'Adams',
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,
endDate: null,
duration: null,
@ -349,7 +348,7 @@ export const claimedTaskDetailsMock = new TaskDetailsModel({
memberOfCandidateUsers: true
});
export const claimedByGroupMemberMock = new TaskDetailsModel({
export const claimedByGroupMemberMock = new TaskRepresentation({
id: '91',
name: 'Request translation',
description: null,
@ -360,7 +359,7 @@ export const claimedByGroupMemberMock = new TaskDetailsModel({
lastName: 'fake-last-name',
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,
endDate: null,
duration: null,
@ -399,7 +398,7 @@ export const claimedByGroupMemberMock = new TaskDetailsModel({
memberOfCandidateUsers: true
});
export const taskDetailsWithOutCandidateGroup = new TaskDetailsModel({
export const taskDetailsWithOutCandidateGroup = new TaskRepresentation({
id: '91',
name: 'Request translation',
description: null,
@ -410,7 +409,7 @@ export const taskDetailsWithOutCandidateGroup = new TaskDetailsModel({
lastName: 'Adams',
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,
endDate: null,
duration: null,
@ -441,7 +440,7 @@ export const taskDetailsWithOutCandidateGroup = new TaskDetailsModel({
]
});
export const completedTaskWithFormMock = new TaskDetailsModel({
export const completedTaskWithFormMock = new TaskRepresentation({
id: '91',
name: 'Request translation',
description: null,
@ -452,7 +451,7 @@ export const completedTaskWithFormMock = new TaskDetailsModel({
lastName: 'Adams',
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,
endDate: new Date(),
duration: null,
@ -471,7 +470,7 @@ export const completedTaskWithFormMock = new TaskDetailsModel({
memberOfCandidateUsers: false
});
export const completedTaskDetailsMock = new TaskDetailsModel({
export const completedTaskDetailsMock = new TaskRepresentation({
id: '91',
name: 'Request translation',
description: null,
@ -482,7 +481,7 @@ export const completedTaskDetailsMock = new TaskDetailsModel({
lastName: 'Adams',
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,
endDate: new Date(),
duration: null,
@ -501,14 +500,14 @@ export const completedTaskDetailsMock = new TaskDetailsModel({
memberOfCandidateUsers: false
});
export const taskDetailsWithOutFormMock = new TaskDetailsModel({
export const taskDetailsWithOutFormMock = new TaskRepresentation({
id: '91',
name: 'Request translation',
description: 'fake description',
category: null,
assignee: { id: 1001, firstName: 'Admin', lastName: 'Paul', email: 'fake-email@gmail.com' },
created: '2016-11-03T15:25:42.749+0000',
dueDate: '2016-11-03T15:25:42.749+0000',
created: new Date('2016-11-03T15:25:42.749+0000'),
dueDate: new Date('2016-11-03T15:25:42.749+0000'),
endDate: null,
duration: null,
priority: 50,
@ -791,20 +790,20 @@ export const taskFormMock = {
globalDateFormat: 'D-M-YYYY'
};
export const tasksMock = [new TaskDetailsModel(taskDetailsMock)];
export const tasksMock = [taskDetailsMock];
export const noDataMock = [
new TaskDetailsModel({
id: 1005,
export const noDataMock: any[] = [
{
id: '1005',
message: 'example-message',
created: '2017-10-06T11:54:53.443+0000',
created: new Date('2017-10-06T11:54:53.443+0000'),
createdBy: {
id: 4004,
firstName: 'gadget',
lastName: 'inspector',
email: 'gadget@inspector.com'
}
})
}
];
export const involvedUserTaskForm = {
@ -935,7 +934,7 @@ export const fakeUser = new UserRepresentation({
tenantName: 'abc'
});
export const completedProcessTaskWithoutForm = new TaskDetailsModel({
export const completedProcessTaskWithoutForm = new TaskRepresentation({
id: '49',
name: 'process task without form',
description: null,
@ -946,9 +945,9 @@ export const completedProcessTaskWithoutForm = new TaskDetailsModel({
lastName: 'User',
email: 'hruser@example.com'
},
created: '2021-07-08T07:39:27.046+0000',
created: new Date('2021-07-08T07:39:27.046+0000'),
dueDate: null,
endDate: '2021-07-08T07:39:35.817+0000',
endDate: new Date('2021-07-08T07:39:35.817+0000'),
duration: 8771,
priority: 0,
parentTaskId: null,

View File

@ -19,7 +19,6 @@ import { SimpleChange } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { of } from 'rxjs';
import { TaskDetailsModel } from '../../task-list';
import { taskDetailsMock } from '../../mock';
import { ProcessService } from './../services/process.service';
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 { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { MatListItemHarness } from '@angular/material/list/testing';
import { ProcessInstanceRepresentation } from '@alfresco/js-api';
import { ProcessInstanceRepresentation, TaskRepresentation } from '@alfresco/js-api';
describe('ProcessInstanceTasksComponent', () => {
let component: ProcessInstanceTasksComponent;
@ -46,7 +45,7 @@ describe('ProcessInstanceTasksComponent', () => {
component = fixture.componentInstance;
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', () => {

View File

@ -19,10 +19,10 @@ import { DatePipe } from '@angular/common';
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild, OnDestroy } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { Observable, Observer, Subject } from 'rxjs';
import { TaskDetailsEvent, TaskDetailsModel } from '../../task-list';
import { TaskDetailsEvent } from '../../task-list';
import { ProcessService } from './../services/process.service';
import { share, takeUntil } from 'rxjs/operators';
import { ProcessInstanceRepresentation } from '@alfresco/js-api';
import { ProcessInstanceRepresentation, TaskRepresentation } from '@alfresco/js-api';
@Component({
selector: 'adf-process-instance-tasks',
@ -55,20 +55,20 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges, OnDestr
@Output()
taskClick = new EventEmitter<TaskDetailsEvent>();
activeTasks: TaskDetailsModel[] = [];
completedTasks: TaskDetailsModel[] = [];
task$: Observable<TaskDetailsModel>;
completedTask$: Observable<TaskDetailsModel>;
activeTasks: TaskRepresentation[] = [];
completedTasks: TaskRepresentation[] = [];
task$: Observable<TaskRepresentation>;
completedTask$: Observable<TaskRepresentation>;
message: string;
processId: string;
private taskObserver: Observer<TaskDetailsModel>;
private completedTaskObserver: Observer<TaskDetailsModel>;
private taskObserver: Observer<TaskRepresentation>;
private completedTaskObserver: Observer<TaskRepresentation>;
private onDestroy$ = new Subject<boolean>();
constructor(private processService: ProcessService, private dialog: MatDialog) {
this.task$ = new Observable<TaskDetailsModel>((observer) => (this.taskObserver = observer)).pipe(share());
this.completedTask$ = new Observable<TaskDetailsModel>((observer) => (this.completedTaskObserver = observer)).pipe(share());
this.task$ = new Observable<TaskRepresentation>((observer) => (this.taskObserver = observer)).pipe(share());
this.completedTask$ = new Observable<TaskRepresentation>((observer) => (this.completedTaskObserver = observer)).pipe(share());
}
ngOnInit() {
@ -150,7 +150,7 @@ export class ProcessInstanceTasksComponent implements OnInit, OnChanges, OnDestr
}
}
clickTask(task: TaskDetailsModel) {
clickTask(task: TaskRepresentation) {
const args = new TaskDetailsEvent(task);
this.taskClick.emit(args);
}

View File

@ -20,22 +20,21 @@ import { exampleProcess } from '../../mock';
import { ProcessService } from './process.service';
import { CoreModule, DateFnsUtils } from '@alfresco/adf-core';
import { ProcessTestingModule } from '../../testing/process.testing.module';
import { ProcessInstanceQueryRepresentation, ProcessDefinitionRepresentation, RestVariable } from '@alfresco/js-api';
import { TaskDetailsModel } from '@alfresco/adf-process-services';
import { ProcessInstanceQueryRepresentation, ProcessDefinitionRepresentation, RestVariable, TaskRepresentation } from '@alfresco/js-api';
const fakeTasksList = {
data: [
new TaskDetailsModel({
id: 1,
new TaskRepresentation({
id: '1',
name: 'Task 1',
processInstanceId: 1000,
created: '2016-11-10T03:37:30.010+0000'
processInstanceId: '1000',
created: new Date('2016-11-10T03:37:30.010+0000')
}),
new TaskDetailsModel({
id: 2,
new TaskRepresentation({
id: '2',
name: 'Task 2',
processInstanceId: 1000,
created: '2016-11-10T03:37:30.010+0000'
processInstanceId: '1000',
created: new Date('2016-11-10T03:37:30.010+0000')
})
]
};

View File

@ -16,7 +16,7 @@
*/
import { AlfrescoApiService, DateFnsUtils, FormValues } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { inject, Injectable } from '@angular/core';
import {
FormDefinitionRepresentation,
ProcessDefinitionsApi,
@ -28,10 +28,10 @@ import {
RestVariable,
ResultListDataRepresentationProcessInstanceRepresentation,
TasksApi,
ProcessDefinitionRepresentation
ProcessDefinitionRepresentation,
TaskRepresentation
} from '@alfresco/js-api';
import { from, Observable } from 'rxjs';
import { TaskDetailsModel } from '../../task-list';
import { map } from 'rxjs/operators';
import { DatePipe } from '@angular/common';
@ -39,6 +39,8 @@ import { DatePipe } from '@angular/common';
providedIn: 'root'
})
export class ProcessService {
private alfrescoApiService = inject(AlfrescoApiService);
private _tasksApi: TasksApi;
get tasksApi(): TasksApi {
return (this._tasksApi ||= new TasksApi(this.alfrescoApiService.getInstance()));
@ -59,8 +61,6 @@ export class ProcessService {
return (this._processInstanceVariablesApi ||= new ProcessInstanceVariablesApi(this.alfrescoApiService.getInstance()));
}
constructor(private alfrescoApiService: AlfrescoApiService) {}
/**
* 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")
* @returns Array of task instance details
*/
getProcessTasks(processInstanceId: string, state?: string): Observable<TaskDetailsModel[]> {
getProcessTasks(processInstanceId: string, state?: string): Observable<TaskRepresentation[]> {
const taskOpts = state
? {
processInstanceId,

View File

@ -17,11 +17,11 @@
import { SimpleChange } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TaskDetailsModel } from '../models/task-details.model';
import { ChecklistComponent } from './checklist.component';
import { ProcessTestingModule } from '../../testing/process.testing.module';
import { TaskListService } from './../services/tasklist.service';
import { of } from 'rxjs';
import { TaskRepresentation } from '@alfresco/js-api';
describe('ChecklistComponent', () => {
let checklistComponent: ChecklistComponent;
@ -37,7 +37,7 @@ describe('ChecklistComponent', () => {
service = TestBed.inject(TaskListService);
spyOn(service, 'getTaskChecklist').and.returnValue(
of([
new TaskDetailsModel({
new TaskRepresentation({
id: 'fake-check-changed-id',
name: 'fake-check-changed-name'
})
@ -65,7 +65,7 @@ describe('ChecklistComponent', () => {
beforeEach(() => {
checklistComponent.taskId = 'fake-task-id';
checklistComponent.checklist.push(
new TaskDetailsModel({
new TaskRepresentation({
id: 'fake-check-id',
name: 'fake-check-name'
})
@ -90,7 +90,7 @@ describe('ChecklistComponent', () => {
checklistComponent.taskId = 'fake-task-id';
checklistComponent.readOnly = false;
checklistComponent.checklist.push(
new TaskDetailsModel({
new TaskRepresentation({
id: 'fake-check-id',
name: 'fake-check-name'
})
@ -148,7 +148,7 @@ describe('ChecklistComponent', () => {
it('should show task checklist', () => {
checklistComponent.checklist.push(
new TaskDetailsModel({
new TaskRepresentation({
id: 'fake-check-id',
name: 'fake-check-name'
})
@ -160,16 +160,16 @@ describe('ChecklistComponent', () => {
it('should not show delete icon when checklist task is completed', () => {
checklistComponent.checklist.push(
new TaskDetailsModel({
new TaskRepresentation({
id: 'fake-check-id',
name: 'fake-check-name'
})
);
checklistComponent.checklist.push(
new TaskDetailsModel({
new TaskRepresentation({
id: 'fake-completed-id',
name: 'fake-completed-name',
endDate: '2018-05-23T11:25:14.552+0000'
endDate: new Date('2018-05-23T11:25:14.552+0000')
})
);
fixture.detectChanges();
@ -182,7 +182,7 @@ describe('ChecklistComponent', () => {
it('should add checklist', async () => {
spyOn(service, 'addTask').and.returnValue(
of(
new TaskDetailsModel({
new TaskRepresentation({
id: 'fake-check-added-id',
name: 'fake-check-added-name'
})
@ -205,7 +205,7 @@ describe('ChecklistComponent', () => {
checklistComponent.taskId = 'new-fake-task-id';
checklistComponent.checklist.push(
new TaskDetailsModel({
new TaskRepresentation({
id: 'fake-check-id',
name: 'fake-check-name'
})
@ -229,7 +229,7 @@ describe('ChecklistComponent', () => {
spyOn(service, 'deleteTask').and.returnValue(of(null));
checklistComponent.taskId = 'new-fake-task-id';
checklistComponent.checklist.push(
new TaskDetailsModel({
new TaskRepresentation({
id: 'fake-check-id',
name: 'fake-check-name'
})
@ -250,7 +250,7 @@ describe('ChecklistComponent', () => {
it('should show load task checklist on change', async () => {
checklistComponent.taskId = 'new-fake-task-id';
checklistComponent.checklist.push(
new TaskDetailsModel({
new TaskRepresentation({
id: 'fake-check-id',
name: 'fake-check-name'
})
@ -271,7 +271,7 @@ describe('ChecklistComponent', () => {
it('should show empty checklist when task id is null', async () => {
checklistComponent.taskId = 'new-fake-task-id';
checklistComponent.checklist.push(
new TaskDetailsModel({
new TaskRepresentation({
id: 'fake-check-id',
name: 'fake-check-name'
})
@ -294,9 +294,9 @@ describe('ChecklistComponent', () => {
});
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();
expect(taskAdded.id).toEqual('fake-check-added-id');
expect(taskAdded.name).toEqual('fake-check-added-name');

View File

@ -17,8 +17,8 @@
import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { TaskDetailsModel } from '../models/task-details.model';
import { TaskListService } from './../services/tasklist.service';
import { TaskRepresentation } from '@alfresco/js-api';
@Component({
selector: 'adf-checklist',
@ -41,11 +41,11 @@ export class ChecklistComponent implements OnChanges {
/** (required) The assignee id that the subtasks are assigned to. */
@Input()
assignee: string;
assignee: number;
/** Emitted when a new checklist task is created. */
@Output()
checklistTaskCreated = new EventEmitter<TaskDetailsModel>();
checklistTaskCreated = new EventEmitter<TaskRepresentation>();
/** Emitted when a checklist task is deleted. */
@Output()
@ -60,7 +60,7 @@ export class ChecklistComponent implements OnChanges {
taskName: string;
checklist: TaskDetailsModel[] = [];
checklist: TaskRepresentation[] = [];
constructor(private taskListService: TaskListService, private dialog: MatDialog) {}
@ -95,7 +95,7 @@ export class ChecklistComponent implements OnChanges {
}
public add() {
const newTask = new TaskDetailsModel({
const newTask = new TaskRepresentation({
name: this.taskName,
parentTaskId: this.taskId,
assignee: { id: this.assignee }

View File

@ -21,10 +21,10 @@ import { TaskListService } from '../services/tasklist.service';
import { StartTaskComponent } from './start-task.component';
import { ProcessTestingModule } from '../../testing/process.testing.module';
import { taskDetailsMock } from '../../mock/task/task-details.mock';
import { TaskDetailsModel } from '../models/task-details.model';
import { HarnessLoader } from '@angular/cdk/testing';
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { MatButtonHarness } from '@angular/material/button/testing';
import { TaskRepresentation } from '@alfresco/js-api';
describe('StartTaskComponent', () => {
let component: StartTaskComponent;
@ -99,7 +99,7 @@ describe('StartTaskComponent', () => {
it('should send on success event when the task is started', () => {
const successSpy = spyOn(component.success, 'emit');
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
component.taskForm.controls['name'].setValue('fakeName');
fixture.detectChanges();
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
@ -124,7 +124,7 @@ describe('StartTaskComponent', () => {
it('should not emit success event when data not present', () => {
const successSpy = spyOn(component.success, 'emit');
component.taskDetailsModel = new TaskDetailsModel(null);
component.taskDetailsModel = new TaskRepresentation(null);
fixture.detectChanges();
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
createTaskButton.click();
@ -158,7 +158,7 @@ describe('StartTaskComponent', () => {
component.taskForm.controls['name'].setValue('fakeName');
component.taskForm.controls['formKey'].setValue(1204);
component.appId = 42;
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
fixture.detectChanges();
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
createTaskButton.click();
@ -183,7 +183,7 @@ describe('StartTaskComponent', () => {
component.taskForm.controls['name'].setValue('fakeName');
component.taskForm.controls['formKey'].setValue(null);
component.appId = 42;
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
fixture.detectChanges();
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
createTaskButton.click();
@ -243,7 +243,7 @@ describe('StartTaskComponent', () => {
it('should assign task with id of selected user assigned', () => {
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['formKey'].setValue(1204);
component.appId = 42;
@ -265,7 +265,7 @@ describe('StartTaskComponent', () => {
component.taskForm.controls['formKey'].setValue(1204);
component.appId = 42;
component.assigneeId = null;
component.taskDetailsModel = new TaskDetailsModel(taskDetailsMock);
component.taskDetailsModel = new TaskRepresentation(taskDetailsMock);
fixture.detectChanges();
const createTaskButton = element.querySelector<HTMLElement>('#button-start');
createTaskButton.click();
@ -280,7 +280,7 @@ describe('StartTaskComponent', () => {
it('should not attach a form when a form id is not selected', () => {
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');
fixture.detectChanges();
const createTaskButton = element.querySelector<HTMLElement>('#button-start');

View File

@ -20,11 +20,11 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewEncapsulation, OnDe
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
import { EMPTY, Observable, Subject } from 'rxjs';
import { Form } from '../models/form.model';
import { TaskDetailsModel } from '../models/task-details.model';
import { TaskListService } from './../services/tasklist.service';
import { switchMap, defaultIfEmpty, takeUntil } from 'rxjs/operators';
import { UntypedFormBuilder, AbstractControl, Validators, UntypedFormGroup, UntypedFormControl } from '@angular/forms';
import { isValid } from 'date-fns';
import { TaskRepresentation } from '@alfresco/js-api';
const FORMAT_DATE = 'DD/MM/YYYY';
const MAX_LENGTH = 255;
@ -60,7 +60,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
@Output()
error = new EventEmitter<any>();
taskDetailsModel: TaskDetailsModel = new TaskDetailsModel();
taskDetailsModel = new TaskRepresentation();
forms$: Observable<Form[]>;
assigneeId: number;
field: FormFieldModel;
@ -213,7 +213,7 @@ export class StartTaskComponent implements OnInit, OnDestroy {
return response;
}
private assignTaskByUserId(taskId: string, userId: string): Observable<TaskDetailsModel> {
private assignTaskByUserId(taskId: string, userId: string): Observable<TaskRepresentation> {
if (taskId && userId) {
return this.taskService.assignTaskByUserId(taskId, userId);
}

View File

@ -92,7 +92,7 @@
<adf-checklist
[readOnly]="internalReadOnlyForm"
[taskId]="taskDetails.id"
[assignee]="$any(taskDetails)?.assignee?.id"
[assignee]="taskDetails.assignee?.id"
(checklistTaskCreated)="onChecklistTaskCreated($event)"
(checklistTaskDeleted)="onChecklistTaskDeleted($event)">
</adf-checklist>

View File

@ -20,7 +20,6 @@ import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { of, throwError } from 'rxjs';
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 { TaskListService } from './../services/tasklist.service';
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 { HarnessLoader } from '@angular/cdk/testing';
import { MatDialogHarness } from '@angular/material/dialog/testing';
import { LightUserRepresentation } from '@alfresco/js-api';
import { LightUserRepresentation, TaskRepresentation } from '@alfresco/js-api';
const fakeUser: LightUserRepresentation = {
id: 0,
@ -41,12 +40,12 @@ const fakeUser: LightUserRepresentation = {
email: 'fake@mail.com'
};
const fakeTaskAssignResponse = new TaskDetailsModel({
const fakeTaskAssignResponse: any = {
id: 'fake-id',
firstName: 'fake-name',
lastName: 'fake-last',
email: 'fake@mail.com'
});
};
describe('TaskDetailsComponent', () => {
let taskListService: TaskListService;
@ -295,7 +294,7 @@ describe('TaskDetailsComponent', () => {
it('should emit a task created event when checklist task is created', () => {
const emitSpy: jasmine.Spy = spyOn(component.taskCreated, 'emit');
const mockTask = new TaskDetailsModel(taskDetailsMock);
const mockTask = new TaskRepresentation(taskDetailsMock);
component.onChecklistTaskCreated(mockTask);
expect(emitSpy).toHaveBeenCalled();
});
@ -307,7 +306,7 @@ describe('TaskDetailsComponent', () => {
component.showHeaderContent = true;
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
component.taskPeople = [];
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
component.taskDetails = new TaskRepresentation(taskDetailsMock);
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
fixture.detectChanges();
@ -319,7 +318,7 @@ describe('TaskDetailsComponent', () => {
component.showHeaderContent = true;
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
component.taskPeople = [];
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
component.taskDetails = new TaskRepresentation(taskDetailsMock);
component.taskDetails.endDate = new Date('2017-10-03T17:03:57.311+0000');
fixture.detectChanges();
@ -331,7 +330,7 @@ describe('TaskDetailsComponent', () => {
component.showHeaderContent = true;
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
component.taskPeople = [fakeUser];
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
component.taskDetails = new TaskRepresentation(taskDetailsMock);
component.taskDetails.endDate = null;
fixture.detectChanges();
@ -343,7 +342,7 @@ describe('TaskDetailsComponent', () => {
component.showHeaderContent = true;
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
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');
fixture.detectChanges();
@ -355,7 +354,7 @@ describe('TaskDetailsComponent', () => {
component.showHeaderContent = true;
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
component.taskPeople = [];
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
component.taskDetails = new TaskRepresentation(taskDetailsMock);
fixture.detectChanges();
expect(component.showComments).toBe(true);
@ -365,7 +364,7 @@ describe('TaskDetailsComponent', () => {
component.showComments = false;
component.ngOnChanges({ taskId: new SimpleChange('123', '456', true) });
component.taskPeople = [];
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
component.taskDetails = new TaskRepresentation(taskDetailsMock);
fixture.detectChanges();
expect(component.showComments).toBeFalse();

View File

@ -39,12 +39,11 @@ import {
} from '@angular/core';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { Observable, Observer, of, Subject } from 'rxjs';
import { TaskDetailsModel } from '../models/task-details.model';
import { TaskListService } from './../services/tasklist.service';
import { catchError, share, takeUntil } from 'rxjs/operators';
import { TaskFormComponent } from './task-form/task-form.component';
import { PeopleProcessService } from '../../common/services/people-process.service';
import { LightUserRepresentation, TaskQueryRepresentation } from '@alfresco/js-api';
import { LightUserRepresentation, TaskQueryRepresentation, TaskRepresentation } from '@alfresco/js-api';
@Component({
selector: 'adf-task-details',
@ -132,7 +131,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
/** Emitted when a checklist task is created. */
@Output()
taskCreated = new EventEmitter<TaskDetailsModel>();
taskCreated = new EventEmitter<TaskRepresentation>();
/** Emitted when a checklist task is deleted. */
@Output()
@ -161,7 +160,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
@Output()
unClaimedTask = new EventEmitter<string>();
taskDetails: TaskDetailsModel;
taskDetails: TaskRepresentation;
taskFormName: string = null;
taskPeople: LightUserRepresentation[] = [];
noTaskDetailsTemplateComponent: TemplateRef<any>;
@ -256,7 +255,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
this.formLoaded.emit(form);
}
onChecklistTaskCreated(task: TaskDetailsModel): void {
onChecklistTaskCreated(task: TaskRepresentation): void {
this.taskCreated.emit(task);
}
@ -376,7 +375,7 @@ export class TaskDetailsComponent implements OnInit, OnChanges, OnDestroy {
this.taskListService.getTasks(requestNode).subscribe(
(response) => {
if (response && response.length > 0) {
this.taskDetails = new TaskDetailsModel(response[0]);
this.taskDetails = new TaskRepresentation(response[0]);
} else {
this.reset();
}

View File

@ -41,12 +41,12 @@ import {
taskDetailsWithOutFormMock,
taskFormMock
} from '../../../mock/task/task-details.mock';
import { TaskDetailsModel } from '../../models/task-details.model';
import { ProcessTestingModule } from '../../../testing/process.testing.module';
import { By } from '@angular/platform-browser';
import { TaskFormService } from '../../../form/services/task-form.service';
import { TaskService } from '../../../form/services/task.service';
import { PeopleProcessService } from '../../../common/services/people-process.service';
import { TaskRepresentation } from '@alfresco/js-api';
describe('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 () => {
completedTaskDetailsMock.formKey = null;
component.taskDetails = new TaskDetailsModel(completedTaskDetailsMock);
component.taskDetails = new TaskRepresentation(completedTaskDetailsMock);
fixture.detectChanges();
await fixture.whenStable();
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 () => {
completedTaskDetailsMock.formKey = null;
component.taskDetails = new TaskDetailsModel(completedTaskDetailsMock);
component.taskDetails = new TaskRepresentation(completedTaskDetailsMock);
fixture.detectChanges();
await fixture.whenStable();
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 () => {
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
fixture.detectChanges();
await fixture.whenStable();
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 () => {
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
fixture.detectChanges();
await fixture.whenStable();
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 () => {
fixture.detectChanges();
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
fixture.detectChanges();
await fixture.whenStable();
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 () => {
const errorSpy: jasmine.Spy = spyOn(component.error, 'emit');
completeTaskSpy.and.returnValue(throwError({ message: 'servce failed' }));
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
fixture.detectChanges();
await fixture.whenStable();
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 () => {
const cancelSpy = spyOn(component.cancel, 'emit');
getTaskDetailsSpy.and.returnValue(of(taskDetailsWithOutFormMock));
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
fixture.detectChanges();
await fixture.whenStable();
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 () => {
component.taskDetails = new TaskDetailsModel(taskDetailsWithOutFormMock);
component.taskDetails = new TaskRepresentation(taskDetailsWithOutFormMock);
fixture.detectChanges();
await fixture.whenStable();
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');
completeButtonElement.click();
component.taskDetails = new TaskDetailsModel(completedProcessTaskWithoutForm);
component.taskDetails = new TaskRepresentation(completedProcessTaskWithoutForm);
fixture.detectChanges();
await fixture.whenStable();
@ -394,8 +394,8 @@ describe('TaskFormComponent', () => {
expect(formMessage.innerText).toContain('ADF_TASK_FORM.COMPLETED_TASK.TITLE');
expect(subMessage.innerText).toContain('ADF_TASK_FORM.COMPLETED_TASK.SUBTITLE');
expect(cancelButton).not.toBeNull();
expect(cancelButton['disabled']).toEqual(false, 'cancel button not visible for completed task');
expect(completeButtonElement).toBeNull('complete button shown for completed task');
expect(cancelButton['disabled']).toEqual(false);
expect(completeButtonElement).toBeNull();
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 () => {
component.taskDetails = new TaskDetailsModel(standaloneTaskWithoutForm);
component.taskDetails = new TaskRepresentation(standaloneTaskWithoutForm);
fixture.detectChanges();
await fixture.whenStable();
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 () => {
const showAttachFormSpy = spyOn(component.showAttachForm, 'emit');
component.taskDetails = new TaskDetailsModel(standaloneTaskWithoutForm);
component.taskDetails = new TaskRepresentation(standaloneTaskWithoutForm);
fixture.detectChanges();
await fixture.whenStable();
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');
completeButtonElement.click();
component.taskDetails = new TaskDetailsModel(completedStandaloneTaskWithoutForm);
component.taskDetails = new TaskRepresentation(completedStandaloneTaskWithoutForm);
fixture.detectChanges();
await fixture.whenStable();
@ -460,8 +460,8 @@ describe('TaskFormComponent', () => {
completeButtonElement = fixture.debugElement.nativeElement.querySelector('#adf-no-form-complete-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(attacheFormButton).toBeNull('attach form button shown for completed task');
expect(completeButtonElement).toBeNull('complete button shown for completed task');
expect(attacheFormButton).toBeNull();
expect(completeButtonElement).toBeNull();
expect(taskListService.completeTask).toHaveBeenCalled();
});
});

View File

@ -17,9 +17,8 @@
import { Component, OnInit, Input, Output, EventEmitter, SimpleChanges, ViewEncapsulation, OnChanges } from '@angular/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 { UserRepresentation } from '@alfresco/js-api';
import { TaskRepresentation, UserRepresentation } from '@alfresco/js-api';
import { Observable } from 'rxjs';
import { PeopleProcessService } from '../../../common';
@ -119,7 +118,7 @@ export class TaskFormComponent implements OnInit, OnChanges {
@Output()
taskUnclaimed = new EventEmitter<string>();
taskDetails: TaskDetailsModel;
taskDetails: TaskRepresentation;
currentLoggedUser: UserRepresentation;
loading: boolean = false;
internalReadOnlyForm: boolean = false;

View File

@ -27,12 +27,11 @@ import {
claimedByGroupMemberMock,
taskDetailsWithOutCandidateGroup
} from '../../mock';
import { TaskDetailsModel } from '../models/task-details.model';
import { TaskListService } from './../services/tasklist.service';
import { TaskHeaderComponent } from './task-header.component';
import { ProcessTestingModule } from '../../testing/process.testing.module';
import { PeopleProcessService } from '../../common/services/people-process.service';
import { TaskRepresentation } from '@alfresco/js-api';
describe('TaskHeaderComponent', () => {
let service: TaskListService;
@ -64,7 +63,7 @@ describe('TaskHeaderComponent', () => {
service = TestBed.inject(TaskListService);
peopleProcessService = TestBed.inject(PeopleProcessService);
spyOn(peopleProcessService, 'getCurrentUserInfo').and.returnValue(of(fakeBpmAssignedUser));
component.taskDetails = new TaskDetailsModel(taskDetailsMock);
component.taskDetails = new TaskRepresentation(taskDetailsMock);
appConfigService = TestBed.inject(AppConfigService);
});
@ -133,12 +132,12 @@ describe('TaskHeaderComponent', () => {
await fixture.whenStable();
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', () => {
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.refreshData();
@ -150,7 +149,7 @@ describe('TaskHeaderComponent', () => {
});
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.refreshData();
@ -162,7 +161,7 @@ describe('TaskHeaderComponent', () => {
});
it('should display the claim button if no assignee', async () => {
component.taskDetails = new TaskDetailsModel(claimableTaskDetailsMock);
component.taskDetails = new TaskRepresentation(claimableTaskDetailsMock);
component.refreshData();
@ -174,7 +173,7 @@ describe('TaskHeaderComponent', () => {
});
it('should display the claim button if the task is claimable', async () => {
component.taskDetails = new TaskDetailsModel(claimableTaskDetailsMock);
component.taskDetails = new TaskRepresentation(claimableTaskDetailsMock);
component.refreshData();
fixture.detectChanges();
@ -186,7 +185,7 @@ describe('TaskHeaderComponent', () => {
});
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();
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 () => {
component.taskDetails = new TaskDetailsModel(claimedTaskDetailsMock);
component.taskDetails = new TaskRepresentation(claimedTaskDetailsMock);
component.refreshData();
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 () => {
component.taskDetails = new TaskDetailsModel(claimedByGroupMemberMock);
component.taskDetails = new TaskRepresentation(claimedByGroupMemberMock);
component.refreshData();
fixture.detectChanges();
@ -226,7 +225,7 @@ describe('TaskHeaderComponent', () => {
});
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();
fixture.detectChanges();
@ -239,7 +238,7 @@ describe('TaskHeaderComponent', () => {
});
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();
fixture.detectChanges();

View File

@ -26,9 +26,9 @@ import {
CardViewIntItemModel,
CardViewItemLengthValidator
} from '@alfresco/adf-core';
import { TaskDetailsModel } from '../models/task-details.model';
import { PeopleProcessService } from '../../common/services/people-process.service';
import { TaskDescriptionValidator } from '../validators/task-description.validator';
import { TaskRepresentation } from '@alfresco/js-api';
@Component({
selector: 'adf-task-header',
@ -43,7 +43,7 @@ export class TaskHeaderComponent implements OnChanges, OnInit {
/** (required) Details related to the task. */
@Input()
taskDetails: TaskDetailsModel;
taskDetails: TaskRepresentation;
/** Toggles display of the claim/release button. */
@Input()

View File

@ -15,14 +15,13 @@
* limitations under the License.
*/
import { TaskDetailsModel } from './task-details.model';
import { TaskRepresentation } from '@alfresco/js-api';
export class TaskDetailsEvent {
private _value: TaskDetailsModel;
private _value: TaskRepresentation;
private _defaultPrevented: boolean = false;
get value(): TaskDetailsModel {
get value(): TaskRepresentation {
return this._value;
}
@ -30,7 +29,7 @@ export class TaskDetailsEvent {
return this._defaultPrevented;
}
constructor(value: TaskDetailsModel) {
constructor(value: TaskRepresentation) {
this._value = value;
}

View File

@ -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;
}
}

View File

@ -36,7 +36,6 @@ export * from './services/task-filter.service';
export * from './models/form.model';
export * from './models/task-details.event';
export * from './models/task-details.model';
export * from './models/user-event.model';
export * from './models/user-group.model';

View File

@ -16,7 +16,7 @@
*/
import { AlfrescoApiService } from '@alfresco/adf-core';
import { Injectable } from '@angular/core';
import { inject, Injectable } from '@angular/core';
import { Observable, forkJoin, from } from 'rxjs';
import { map } from 'rxjs/operators';
import { UserFiltersApi, UserTaskFilterRepresentation } from '@alfresco/js-api';
@ -25,14 +25,14 @@ import { UserFiltersApi, UserTaskFilterRepresentation } from '@alfresco/js-api';
providedIn: 'root'
})
export class TaskFilterService {
private apiService = inject(AlfrescoApiService);
private _userFiltersApi: UserFiltersApi;
get userFiltersApi(): UserFiltersApi {
this._userFiltersApi = this._userFiltersApi ?? new UserFiltersApi(this.apiService.getInstance());
return this._userFiltersApi;
}
constructor(private apiService: AlfrescoApiService) {}
/**
* Creates and returns the default filters for a process app.
*

View File

@ -20,7 +20,6 @@ import { Injectable } from '@angular/core';
import { Observable, from, of } from 'rxjs';
import { map, catchError, flatMap, filter } from 'rxjs/operators';
import { Form } from '../models/form.model';
import { TaskDetailsModel } from '../models/task-details.model';
import {
TaskUpdateRepresentation,
ModelsApi,
@ -29,7 +28,8 @@ import {
ChecklistsApi,
ResultListDataRepresentationTaskRepresentation,
TaskQueryRepresentation,
UserTaskFilterRepresentation
UserTaskFilterRepresentation,
TaskRepresentation
} from '@alfresco/js-api';
@Injectable({
@ -121,8 +121,8 @@ export class TaskListService {
* @param taskId ID of the target task.
* @returns Task details
*/
getTaskDetails(taskId: string): Observable<TaskDetailsModel> {
return from(this.tasksApi.getTask(taskId)).pipe(map((details) => new TaskDetailsModel(details)));
getTaskDetails(taskId: string): Observable<TaskRepresentation> {
return from(this.tasksApi.getTask(taskId));
}
/**
@ -131,8 +131,8 @@ export class TaskListService {
* @param id ID of the target task
* @returns Array of checklist task details
*/
getTaskChecklist(id: string): Observable<TaskDetailsModel[]> {
return from(this.checklistsApi.getChecklist(id)).pipe(map((response) => response.data.map((checklist) => new TaskDetailsModel(checklist))));
getTaskChecklist(id: string): Observable<TaskRepresentation[]> {
return from(this.checklistsApi.getChecklist(id)).pipe(map((response) => response.data));
}
/**
@ -167,8 +167,8 @@ export class TaskListService {
* @param task The task to add
* @returns The subtask that was added
*/
addTask(task: TaskDetailsModel): Observable<TaskDetailsModel> {
return from(this.checklistsApi.addSubtask(task.parentTaskId, task)).pipe(map((response) => new TaskDetailsModel(response)));
addTask(task: TaskRepresentation): Observable<TaskRepresentation> {
return from(this.checklistsApi.addSubtask(task.parentTaskId, task));
}
/**
@ -207,8 +207,8 @@ export class TaskListService {
* @param task Details of the new task
* @returns Details of the newly created task
*/
createNewTask(task: TaskDetailsModel): Observable<TaskDetailsModel> {
return from(this.tasksApi.createNewTask(task)).pipe(map((response) => new TaskDetailsModel(response)));
createNewTask(task: TaskRepresentation): Observable<TaskRepresentation> {
return from(this.tasksApi.createNewTask(task));
}
/**
@ -218,9 +218,9 @@ export class TaskListService {
* @param requestNode User or group to assign the task to
* @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 };
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
* @returns Details of the assigned task
*/
assignTaskByUserId(taskId: string, userId: string): Observable<TaskDetailsModel> {
assignTaskByUserId(taskId: string, userId: string): Observable<TaskRepresentation> {
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
* @returns Details of the claimed task
*/
claimTask(taskId: string): Observable<TaskDetailsModel> {
claimTask(taskId: string): Observable<TaskRepresentation> {
return from(this.taskActionsApi.claimTask(taskId));
}
@ -252,7 +252,7 @@ export class TaskListService {
* @param taskId ID of the task to unclaim
* @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));
}
@ -263,8 +263,8 @@ export class TaskListService {
* @param updated Data to update the task (as a `TaskUpdateRepresentation` instance).
* @returns Updated task details
*/
updateTask(taskId: string, updated: TaskUpdateRepresentation): Observable<TaskDetailsModel> {
return from(this.tasksApi.updateTask(taskId, updated)).pipe(map((result) => result as TaskDetailsModel));
updateTask(taskId: string, updated: TaskUpdateRepresentation): Observable<TaskRepresentation> {
return from(this.tasksApi.updateTask(taskId, updated));
}
/**