From 7246bb0495abd77adeeffa32c2b1101cd51b5f74 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 08:25:06 -0500 Subject: [PATCH 01/30] consolidate shared model classes --- .../components/task-form-cloud.component.md | 54 ++++++------ .../services/form-cloud.service.md | 12 +-- .../services/task-cloud.service.md | 50 +++++------ .../form/components/form-cloud.component.ts | 2 +- .../services/form-cloud.service.interface.ts | 13 ++- .../lib/form/services/form-cloud.service.ts | 82 +++++++++---------- .../lib/models/engine-event-cloud.model.ts | 2 +- .../lib/task/mock/task-cloud.service.mock.ts | 4 +- .../models/start-task-cloud-request.model.ts | 1 - .../models/task-details-cloud.model.ts | 13 +-- .../src/lib/task/public-api.ts | 3 +- .../services/task-cloud.service.interface.ts | 11 ++- .../lib/task/services/task-cloud.service.ts | 4 +- .../src/lib/task/start-task/public-api.ts | 18 ---- .../task-filters-cloud.component.ts | 14 +--- .../mock/task-filters-cloud.mock.ts | 2 +- .../task-form-cloud.component.spec.ts | 2 +- .../task-form-cloud.component.ts | 2 +- .../user-task-cloud.component.ts | 2 +- .../components/task-header-cloud.component.ts | 2 +- .../mocks/task-details-cloud.mock.ts | 2 +- 21 files changed, 131 insertions(+), 164 deletions(-) rename lib/process-services-cloud/src/lib/task/{start-task => }/models/start-task-cloud-request.model.ts (99%) rename lib/process-services-cloud/src/lib/task/{start-task => }/models/task-details-cloud.model.ts (91%) delete mode 100644 lib/process-services-cloud/src/lib/task/start-task/public-api.ts diff --git a/docs/process-services-cloud/components/task-form-cloud.component.md b/docs/process-services-cloud/components/task-form-cloud.component.md index ac023098b81..e8e4776256d 100644 --- a/docs/process-services-cloud/components/task-form-cloud.component.md +++ b/docs/process-services-cloud/components/task-form-cloud.component.md @@ -5,9 +5,9 @@ Status: Active Last reviewed: 2019-04-17 --- -# [Task form cloud component](../../../lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud.component.ts "Defined in task-form-cloud.component.ts") +# Task Form Component -Shows a [`form`](../../../lib/process-services-cloud/src/lib/form/models/form-cloud.model.ts) for a task. +Shows a form for a task. Shows Cancel, Save, Complete, Claim and Release buttons. Cancel, Save and Complete buttons are always present. Claim and Release buttons are present according to user's permissions and task's condition (Claimed, Completed etc). @@ -33,34 +33,34 @@ Save and Complete buttons get disabled when at least one of the form's inputs ar ### Properties -| Name | Type | Default value | Description | -| ---- | ---- | ------------- | ----------- | -| appName | `string` | "" | App id to fetch corresponding form and values. | -| readOnly | `boolean` | false | Toggle readonly state of the task. | -| showCancelButton | `boolean` | true | Toggle rendering of the `Cancel` button. | -| showCompleteButton | `boolean` | true | Toggle rendering of the `Complete` button. | -| showRefreshButton | `boolean` | false | Toggle rendering of the `Refresh` button. | -| showTitle | `boolean` | true | Toggle rendering of the form title. | -| showValidationIcon | `boolean` | true | Toggle rendering of the `Validation` icon. | -| taskId | `string` | | Task id to fetch corresponding form and values. | -| displayModeConfigurations | [`FormCloudDisplayModeConfiguration`](../../../lib/process-services-cloud/src/lib/services/form-fields.interfaces.ts)`[]` | | The available display configurations for the form | +| Name | Type | Default value | Description | +|---------------------------|---------------------------------------|---------------|---------------------------------------------------| +| appName | `string` | "" | App id to fetch corresponding form and values. | +| readOnly | `boolean` | false | Toggle readonly state of the task. | +| showCancelButton | `boolean` | true | Toggle rendering of the `Cancel` button. | +| showCompleteButton | `boolean` | true | Toggle rendering of the `Complete` button. | +| showRefreshButton | `boolean` | false | Toggle rendering of the `Refresh` button. | +| showTitle | `boolean` | true | Toggle rendering of the form title. | +| showValidationIcon | `boolean` | true | Toggle rendering of the `Validation` icon. | +| taskId | `string` | | Task id to fetch corresponding form and values. | +| displayModeConfigurations | `FormCloudDisplayModeConfiguration[]` | | The available display configurations for the form | ### Events -| Name | Type | Description | -| ---- | ---- | ----------- | -| cancelClick | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the cancel button is clicked. | -| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when any 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 form content is clicked. | -| 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 saved. | -| onTaskLoaded | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>` | Emitted when a task is loaded\`. | -| taskClaimed | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the task is claimed. | -| taskCompleted | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the task is completed. | -| taskUnclaimed | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the task is unclaimed. | -| displayModeOn | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormCloudDisplayModeConfiguration`](../../../lib/process-services-cloud/src/lib/services/form-fields.interfaces.ts)`>` | Emitted when a display mode configuration is turned on. | -| displayModeOff | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`FormCloudDisplayModeConfiguration`](../../../lib/process-services-cloud/src/lib/services/form-fields.interfaces.ts)`>` | Emitted when a display mode configuration is turned off. | +| Name | Type | Description | +|--------------------|---------------------------------------------------|--------------------------------------------------------------------------------------------------------| +| cancelClick | `EventEmitter` | Emitted when the cancel button is clicked. | +| error | `EventEmitter` | Emitted when any error occurs. | +| executeOutcome | `EventEmitter` | Emitted when any outcome is executed. Default behaviour can be prevented via `event.preventDefault()`. | +| formCompleted | `EventEmitter` | Emitted when the form is submitted with the `Complete` outcome. | +| formContentClicked | `EventEmitter` | Emitted when form content is clicked. | +| formSaved | `EventEmitter` | Emitted when the form is saved. | +| onTaskLoaded | `EventEmitter` | Emitted when a task is loaded. | +| taskClaimed | `EventEmitter` | Emitted when the task is claimed. | +| taskCompleted | `EventEmitter` | Emitted when the task is completed. | +| taskUnclaimed | `EventEmitter` | Emitted when the task is unclaimed. | +| displayModeOn | `EventEmitter` | Emitted when a display mode configuration is turned on. | +| displayModeOff | `EventEmitter` | Emitted when a display mode configuration is turned off. | #### Enabling fullscreen display for the form of the task diff --git a/docs/process-services-cloud/services/form-cloud.service.md b/docs/process-services-cloud/services/form-cloud.service.md index 3e7777659b5..c36a9c1556c 100644 --- a/docs/process-services-cloud/services/form-cloud.service.md +++ b/docs/process-services-cloud/services/form-cloud.service.md @@ -26,7 +26,7 @@ class MyComponent { ### Methods -- **completeTaskForm**(appName: `string`, taskId: `string`, processInstanceId: `string`, formId: `string`, formValues: [`FormValues`](../../../lib/core/src/lib/form/components/widgets/core/form-values.ts), outcome: `string`, version: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`
+- **completeTaskForm**(appName: `string`, taskId: `string`, processInstanceId: `string`, formId: `string`, formValues: [`FormValues`](../../../lib/core/src/lib/form/components/widgets/core/form-values.ts), outcome: `string`, version: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>`
Completes a task form. - _appName:_ `string` - Name of the app - _taskId:_ `string` - ID of the target task @@ -35,7 +35,7 @@ class MyComponent { - _formValues:_ [`FormValues`](../../../lib/core/src/lib/form/components/widgets/core/form-values.ts) - [Form](../../../lib/process-services/src/lib/task-list/models/form.model.ts) values object - _outcome:_ `string` - [Form](../../../lib/process-services/src/lib/task-list/models/form.model.ts) outcome - _version:_ `number` - of the form - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>` - Updated task details + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>` - Updated task details - **createTemporaryRawRelatedContent**(file: `any`, nodeId: `string`, contentHost: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)``
- _file:_ `any` - @@ -61,11 +61,11 @@ class MyComponent { - _body:_ `any` - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`FormFieldOption`](../../../lib/core/src/lib/form/components/widgets/core/form-field-option.ts)`[]>` - -- **getTask**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`
+- **getTask**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>`
Gets details of a task - _appName:_ `string` - Name of the app - _taskId:_ `string` - ID of the target task - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>` - Details of the task + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>` - Details of the task - **getTaskForm**(appName: `string`, taskId: `string`, version?: `number`): [`Observable`](http://reactivex.io/documentation/observable.html)``
Gets the form definition of a task. - _appName:_ `string` - Name of the app @@ -83,14 +83,14 @@ class MyComponent { - _data:_ [`TaskVariableCloud`](../../../lib/process-services-cloud/src/lib/form/models/task-variable-cloud.model.ts)`[]` - (Optional) Values for the form's fields - _readOnly:_ `boolean` - Toggles whether or not the form should be read-only - **Returns** [`FormModel`](../../../lib/core/src/lib/form/components/widgets/core/form.model.ts) - [Form](../../../lib/process-services/src/lib/task-list/models/form.model.ts) created from the JSON specification -- **saveTaskForm**(appName: `string`, taskId: `string`, processInstanceId: `string`, formId: `string`, values: [`FormValues`](../../../lib/core/src/lib/form/components/widgets/core/form-values.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`
+- **saveTaskForm**(appName: `string`, taskId: `string`, processInstanceId: `string`, formId: `string`, values: [`FormValues`](../../../lib/core/src/lib/form/components/widgets/core/form-values.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>`
Saves a task form. - _appName:_ `string` - Name of the app - _taskId:_ `string` - ID of the target task - _processInstanceId:_ `string` - ID of processInstance - _formId:_ `string` - ID of the form to save - _values:_ [`FormValues`](../../../lib/core/src/lib/form/components/widgets/core/form-values.ts) - [Form](../../../lib/process-services/src/lib/task-list/models/form.model.ts) values object - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>` - Updated task details + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>` - Updated task details ## See also diff --git a/docs/process-services-cloud/services/task-cloud.service.md b/docs/process-services-cloud/services/task-cloud.service.md index 4f750b66daa..2e2d222c752 100644 --- a/docs/process-services-cloud/services/task-cloud.service.md +++ b/docs/process-services-cloud/services/task-cloud.service.md @@ -13,40 +13,40 @@ Manages task cloud. ### Methods -- **assign**(appName: `string`, taskId: `string`, assignee: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`
+- **assign**(appName: `string`, taskId: `string`, assignee: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>`
Updates the task assignee. - _appName:_ `string` - Name of the app - _taskId:_ `string` - ID of the task to update assignee - _assignee:_ `string` - assignee to update current user task assignee - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>` - Updated task details with new assignee -- **canClaimTask**(taskDetails: [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)): `boolean`
+ - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>` - Updated task details with new assignee +- **canClaimTask**(taskDetails: [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)): `boolean`
Validate if a task can be claimed. - - _taskDetails:_ [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts) - task details object + - _taskDetails:_ [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts) - task details object - **Returns** `boolean` - Boolean value if the task can be completed -- **canCompleteTask**(taskDetails: [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)): `boolean`
+- **canCompleteTask**(taskDetails: [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)): `boolean`
Validate if a task can be completed. - - _taskDetails:_ [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts) - task details object + - _taskDetails:_ [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts) - task details object - **Returns** `boolean` - Boolean value if the task can be completed -- **canUnclaimTask**(taskDetails: [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)): `boolean`
+- **canUnclaimTask**(taskDetails: [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)): `boolean`
Validate if a task can be unclaimed. - - _taskDetails:_ [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts) - task details object + - _taskDetails:_ [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts) - task details object - **Returns** `boolean` - Boolean value if the task can be completed -- **claimTask**(appName: `string`, taskId: `string`, assignee: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`
+- **claimTask**(appName: `string`, taskId: `string`, assignee: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>`
Claims a task for an assignee. - _appName:_ `string` - Name of the app - _taskId:_ `string` - ID of the task to claim - _assignee:_ `string` - User to assign the task to - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>` - Details of the claimed task -- **completeTask**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`
+ - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>` - Details of the claimed task +- **completeTask**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>`
Complete a task. - _appName:_ `string` - Name of the app - _taskId:_ `string` - ID of the task to complete - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>` - Details of the task that was completed -- **createNewTask**(startTaskRequest: [`StartTaskCloudRequestModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/start-task-cloud-request.model.ts), appName: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`
+ - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>` - Details of the task that was completed +- **createNewTask**(startTaskRequest: [`StartTaskCloudRequestModel`](../../../lib/process-services-cloud/src/lib/task/models/start-task-cloud-request.model.ts), appName: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>`
Creates a new standalone task. - - _startTaskRequest:_ [`StartTaskCloudRequestModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/start-task-cloud-request.model.ts) - + - _startTaskRequest:_ [`StartTaskCloudRequestModel`](../../../lib/process-services-cloud/src/lib/task/models/start-task-cloud-request.model.ts) - - _appName:_ `string` - - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>` - Details of the newly created task + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>` - Details of the newly created task - **getBasePath**(appName: `string`): `string`
- _appName:_ `string` - @@ -71,33 +71,33 @@ Manages task cloud. Gets the process definitions associated with an app. - _appName:_ `string` - Name of the target app - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`ProcessDefinitionCloud`](../../../lib/process-services-cloud/src/lib/models/process-definition-cloud.model.ts)`[]>` - Array of process definitions -- **getTaskById**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`
+- **getTaskById**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>`
Gets details of a task. - _appName:_ `string` - Name of the app - _taskId:_ `string` - ID of the task whose details you want - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>` - Task details -- **isAssigneePropertyClickable**(taskDetails: [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts), candidateUsers: [`CardViewArrayItem`](../../../lib/core/src/lib/card-view/models/card-view-arrayitem.model.ts)`[]`, candidateGroups: [`CardViewArrayItem`](../../../lib/core/src/lib/card-view/models/card-view-arrayitem.model.ts)`[]`): `boolean`
+ - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>` - Task details +- **isAssigneePropertyClickable**(taskDetails: [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts), candidateUsers: [`CardViewArrayItem`](../../../lib/core/src/lib/card-view/models/card-view-arrayitem.model.ts)`[]`, candidateGroups: [`CardViewArrayItem`](../../../lib/core/src/lib/card-view/models/card-view-arrayitem.model.ts)`[]`): `boolean`
- - _taskDetails:_ [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts) - + - _taskDetails:_ [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts) - - _candidateUsers:_ [`CardViewArrayItem`](../../../lib/core/src/lib/card-view/models/card-view-arrayitem.model.ts)`[]` - - _candidateGroups:_ [`CardViewArrayItem`](../../../lib/core/src/lib/card-view/models/card-view-arrayitem.model.ts)`[]` - - **Returns** `boolean` - -- **isTaskEditable**(taskDetails: [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)): `boolean`
+- **isTaskEditable**(taskDetails: [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)): `boolean`
Validate if a task is editable. - - _taskDetails:_ [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts) - task details object + - _taskDetails:_ [`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts) - task details object - **Returns** `boolean` - Boolean value if the task is editable -- **unclaimTask**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`
+- **unclaimTask**(appName: `string`, taskId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>`
Un-claims a task. - _appName:_ `string` - Name of the app - _taskId:_ `string` - ID of the task to unclaim - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>` - Details of the task that was unclaimed -- **updateTask**(appName: `string`, taskId: `string`, payload: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>`
+ - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>` - Details of the task that was unclaimed +- **updateTask**(appName: `string`, taskId: `string`, payload: `any`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>`
Updates the details (name, description, due date) for a task. - _appName:_ `string` - Name of the app - _taskId:_ `string` - ID of the task to update - _payload:_ `any` - Data to update the task - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts)`>` - Updated task details + - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`TaskDetailsCloudModel`](../../../lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts)`>` - Updated task details ## Details diff --git a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.ts b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.ts index 5b9609a6b0c..a66d489f745 100644 --- a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.ts @@ -52,7 +52,7 @@ import { } from '@alfresco/adf-core'; import { FormCloudService } from '../services/form-cloud.service'; import { TaskVariableCloud } from '../models/task-variable-cloud.model'; -import { TaskDetailsCloudModel } from '../../task/start-task/models/task-details-cloud.model'; +import { TaskDetailsCloudModel } from '../../task/models/task-details-cloud.model'; import { MatDialog } from '@angular/material/dialog'; import { v4 as uuidGeneration } from 'uuid'; import { FormCloudDisplayMode, FormCloudDisplayModeConfiguration } from '../../services/form-fields.interfaces'; diff --git a/lib/process-services-cloud/src/lib/form/services/form-cloud.service.interface.ts b/lib/process-services-cloud/src/lib/form/services/form-cloud.service.interface.ts index 4792056eaa1..b09659e6000 100644 --- a/lib/process-services-cloud/src/lib/form/services/form-cloud.service.interface.ts +++ b/lib/process-services-cloud/src/lib/form/services/form-cloud.service.interface.ts @@ -17,19 +17,26 @@ import { UploadApi } from '@alfresco/js-api'; import { FormFieldOption, FormModel, FormValues } from '@alfresco/adf-core'; -import { TaskDetailsCloudModel } from '../../task/start-task/models/task-details-cloud.model'; +import { TaskDetailsCloudModel } from '../../task/models/task-details-cloud.model'; import { TaskVariableCloud } from '../models/task-variable-cloud.model'; import { FormContent } from '../../services/form-fields.interfaces'; import { Observable } from 'rxjs'; export interface FormCloudServiceInterface { - uploadApi: UploadApi; getTaskForm(appName: string, taskId: string, version?: number): Observable; saveTaskForm(appName: string, taskId: string, processInstanceId: string, formId: string, values: FormValues): Observable; createTemporaryRawRelatedContent(file: any, nodeId: string, contentHost: string): Observable; - completeTaskForm(appName: string, taskId: string, processInstanceId: string, formId: string, formValues: FormValues, outcome: string, version: number): Observable; + completeTaskForm( + appName: string, + taskId: string, + processInstanceId: string, + formId: string, + formValues: FormValues, + outcome: string, + version: number + ): Observable; getTask(appName: string, taskId: string): Observable; getTaskVariables(appName: string, taskId: string): Observable; getForm(appName: string, formKey: string, version?: number): Observable; diff --git a/lib/process-services-cloud/src/lib/form/services/form-cloud.service.ts b/lib/process-services-cloud/src/lib/form/services/form-cloud.service.ts index 06f10c7e381..7e991d30dd0 100644 --- a/lib/process-services-cloud/src/lib/form/services/form-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/form/services/form-cloud.service.ts @@ -19,7 +19,7 @@ import { Injectable } from '@angular/core'; import { FormValues, FormModel, FormFieldOption } from '@alfresco/adf-core'; import { Observable, from, EMPTY } from 'rxjs'; import { expand, map, reduce, switchMap } from 'rxjs/operators'; -import { TaskDetailsCloudModel } from '../../task/start-task/models/task-details-cloud.model'; +import { TaskDetailsCloudModel } from '../../task/models/task-details-cloud.model'; import { CompleteFormRepresentation, UploadApi } from '@alfresco/js-api'; import { TaskVariableCloud } from '../models/task-variable-cloud.model'; import { BaseCloudService } from '../../services/base-cloud.service'; @@ -31,16 +31,13 @@ import { AdfHttpClient } from '@alfresco/adf-core/api'; providedIn: 'root' }) export class FormCloudService extends BaseCloudService implements FormCloudServiceInterface { - private _uploadApi: UploadApi; get uploadApi(): UploadApi { this._uploadApi = this._uploadApi ?? new UploadApi(this.apiService.getInstance()); return this._uploadApi; } - constructor( - adfHttpClient: AdfHttpClient - ) { + constructor(adfHttpClient: AdfHttpClient) { super(adfHttpClient); } @@ -54,20 +51,22 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi */ getTaskForm(appName: string, taskId: string, version?: number): Observable { return this.getTask(appName, taskId).pipe( - switchMap(task => this.getForm(appName, task.formKey, version).pipe( - map((form: FormContent) => { - const flattenForm = { - ...form.formRepresentation, - ...form.formRepresentation.formDefinition, - taskId: task.id, - taskName: task.name, - processDefinitionId: task.processDefinitionId, - processInstanceId: task.processInstanceId - }; - delete flattenForm.formDefinition; - return flattenForm; - }) - )) + switchMap((task) => + this.getForm(appName, task.formKey, version).pipe( + map((form: FormContent) => { + const flattenForm = { + ...form.formRepresentation, + ...form.formRepresentation.formDefinition, + taskId: task.id, + taskName: task.name, + processDefinitionId: task.processDefinitionId, + processInstanceId: task.processInstanceId + }; + delete flattenForm.formDefinition; + return flattenForm; + }) + ) + ) ); } @@ -89,26 +88,15 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi processInstanceId }; - return this.post(apiUrl, saveFormRepresentation).pipe( - map((res: any) => res.entry) - ); + return this.post(apiUrl, saveFormRepresentation).pipe(map((res: any) => res.entry)); } createTemporaryRawRelatedContent(file: any, nodeId: string, contentHost: string): Observable { - const changedConfig = this.apiService.lastConfig; changedConfig.provider = 'ALL'; changedConfig.hostEcm = contentHost.replace('/alfresco', ''); this.apiService.getInstance().setConfig(changedConfig); - return from(this.uploadApi.uploadFile( - file, - '', - nodeId, - null, - { overwrite: true } - )).pipe( - map((res: any) => res.entry) - ); + return from(this.uploadApi.uploadFile(file, '', nodeId, null, { overwrite: true })).pipe(map((res: any) => res.entry)); } /** @@ -123,7 +111,15 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi * @param version of the form * @returns Updated task details */ - completeTaskForm(appName: string, taskId: string, processInstanceId: string, formId: string, formValues: FormValues, outcome: string, version: number): Observable { + completeTaskForm( + appName: string, + taskId: string, + processInstanceId: string, + formId: string, + formValues: FormValues, + outcome: string, + version: number + ): Observable { const apiUrl = `${this.getBasePath(appName)}/form/v1/forms/${formId}/submit/versions/${version}`; const completeFormRepresentation = { values: formValues, @@ -135,9 +131,7 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi completeFormRepresentation.outcome = outcome; } - return this.post(apiUrl, completeFormRepresentation).pipe( - map((res: any) => res.entry) - ); + return this.post(apiUrl, completeFormRepresentation).pipe(map((res: any) => res.entry)); } /** @@ -150,9 +144,7 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi getTask(appName: string, taskId: string): Observable { const apiUrl = `${this.getBasePath(appName)}/query/v1/tasks/${taskId}`; - return this.get(apiUrl).pipe( - map((res: any) => res.entry) - ); + return this.get(apiUrl).pipe(map((res: any) => res.entry)); } /** @@ -170,10 +162,12 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi return this.get(apiUrl, { maxItems, skipCount }).pipe( expand((res: any) => { skipCount += maxItems; - return res.list.pagination.hasMoreItems ? this.get(apiUrl, { - maxItems, - skipCount - }) : EMPTY; + return res.list.pagination.hasMoreItems + ? this.get(apiUrl, { + maxItems, + skipCount + }) + : EMPTY; }), map((res: any) => res.list.entries.map((variable) => new TaskVariableCloud(variable.entry))), reduce((acc, res) => acc.concat(res), []) @@ -221,7 +215,7 @@ export class FormCloudService extends BaseCloudService implements FormCloudServi delete flattenForm.formDefinition; const formValues: FormValues = {}; - (data || []).forEach(variable => { + (data || []).forEach((variable) => { formValues[variable.name] = variable.value; }); diff --git a/lib/process-services-cloud/src/lib/models/engine-event-cloud.model.ts b/lib/process-services-cloud/src/lib/models/engine-event-cloud.model.ts index 73f982d920e..8ba926fa453 100644 --- a/lib/process-services-cloud/src/lib/models/engine-event-cloud.model.ts +++ b/lib/process-services-cloud/src/lib/models/engine-event-cloud.model.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { TaskDetailsCloudModel } from '../task/start-task/models/task-details-cloud.model'; +import { TaskDetailsCloudModel } from '../task/models/task-details-cloud.model'; export interface TaskCloudEngineEvent { eventType: string; diff --git a/lib/process-services-cloud/src/lib/task/mock/task-cloud.service.mock.ts b/lib/process-services-cloud/src/lib/task/mock/task-cloud.service.mock.ts index 53b1ea4e5de..4f046874e46 100644 --- a/lib/process-services-cloud/src/lib/task/mock/task-cloud.service.mock.ts +++ b/lib/process-services-cloud/src/lib/task/mock/task-cloud.service.mock.ts @@ -19,10 +19,10 @@ import { Injectable } from '@angular/core'; import { AppConfigService, CardViewArrayItem } from '@alfresco/adf-core'; import { from, Observable, of, Subject, throwError } from 'rxjs'; import { DEFAULT_TASK_PRIORITIES, TaskPriorityOption } from '../models/task.model'; -import { TaskDetailsCloudModel, TASK_ASSIGNED_STATE, TASK_CREATED_STATE } from '../start-task/models/task-details-cloud.model'; +import { TaskDetailsCloudModel, TASK_ASSIGNED_STATE, TASK_CREATED_STATE } from '../models/task-details-cloud.model'; import { taskDetailsContainer } from '../task-header/mocks/task-details-cloud.mock'; import { ProcessDefinitionCloud } from '../../models/process-definition-cloud.model'; -import { StartTaskCloudRequestModel } from '../start-task/models/start-task-cloud-request.model'; +import { StartTaskCloudRequestModel } from '../models/start-task-cloud-request.model'; import { TaskCloudServiceInterface } from '../services/task-cloud.service.interface'; @Injectable({ diff --git a/lib/process-services-cloud/src/lib/task/start-task/models/start-task-cloud-request.model.ts b/lib/process-services-cloud/src/lib/task/models/start-task-cloud-request.model.ts similarity index 99% rename from lib/process-services-cloud/src/lib/task/start-task/models/start-task-cloud-request.model.ts rename to lib/process-services-cloud/src/lib/task/models/start-task-cloud-request.model.ts index d38ce02f4dc..6d002ca1d74 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/models/start-task-cloud-request.model.ts +++ b/lib/process-services-cloud/src/lib/task/models/start-task-cloud-request.model.ts @@ -16,7 +16,6 @@ */ export class StartTaskCloudRequestModel { - name: string; description: string; assignee: string; diff --git a/lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts b/lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts similarity index 91% rename from lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts rename to lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts index 912bdf2d834..4f236f3ae86 100644 --- a/lib/process-services-cloud/src/lib/task/start-task/models/task-details-cloud.model.ts +++ b/lib/process-services-cloud/src/lib/task/models/task-details-cloud.model.ts @@ -51,12 +51,7 @@ export interface StartTaskCloudResponseModel { entry: TaskDetailsCloudModel; } -export type TaskStatus = - 'COMPLETED' | - 'CREATED' | - 'ASSIGNED' | - 'SUSPENDED' | - 'CANCELLED'; +export type TaskStatus = 'COMPLETED' | 'CREATED' | 'ASSIGNED' | 'SUSPENDED' | 'CANCELLED'; export const TASK_COMPLETED_STATE: TaskStatus = 'COMPLETED'; export const TASK_CREATED_STATE: TaskStatus = 'CREATED'; @@ -64,11 +59,7 @@ export const TASK_ASSIGNED_STATE: TaskStatus = 'ASSIGNED'; export const TASK_SUSPENDED_STATE: TaskStatus = 'SUSPENDED'; export const TASK_CANCELLED_STATE: TaskStatus = 'CANCELLED'; -export type TaskPermissions = - 'VIEW' | - 'CLAIM' | - 'RELEASE' | - 'UPDATE'; +export type TaskPermissions = 'VIEW' | 'CLAIM' | 'RELEASE' | 'UPDATE'; export const TASK_CLAIM_PERMISSION: TaskPermissions = 'CLAIM'; export const TASK_RELEASE_PERMISSION: TaskPermissions = 'RELEASE'; diff --git a/lib/process-services-cloud/src/lib/task/public-api.ts b/lib/process-services-cloud/src/lib/task/public-api.ts index 32c2c721b69..7639f2878bb 100644 --- a/lib/process-services-cloud/src/lib/task/public-api.ts +++ b/lib/process-services-cloud/src/lib/task/public-api.ts @@ -17,7 +17,8 @@ export * from './task-list/public-api'; export * from './task-filters/public-api'; -export * from './start-task/public-api'; +export * from './models/task-details-cloud.model'; +export * from './models/start-task-cloud-request.model'; export * from './task-header/public-api'; export * from './task-form/public-api'; export * from './directives/public-api'; diff --git a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.interface.ts b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.interface.ts index 2c33e72a4ba..c661ab36c06 100644 --- a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.interface.ts +++ b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.interface.ts @@ -19,17 +19,20 @@ import { CardViewArrayItem } from '@alfresco/adf-core'; import { Observable, Subject } from 'rxjs'; import { ProcessDefinitionCloud } from '../../models/process-definition-cloud.model'; import { TaskPriorityOption } from '../models/task.model'; -import { StartTaskCloudRequestModel } from '../start-task/models/start-task-cloud-request.model'; -import { TaskDetailsCloudModel } from '../start-task/models/task-details-cloud.model'; +import { StartTaskCloudRequestModel } from '../models/start-task-cloud-request.model'; +import { TaskDetailsCloudModel } from '../models/task-details-cloud.model'; export interface TaskCloudServiceInterface { - dataChangesDetected$: Subject; priorities: TaskPriorityOption[]; completeTask(appName: string, taskId: string): Observable; canCompleteTask(taskDetails: TaskDetailsCloudModel): boolean; isTaskEditable(taskDetails: TaskDetailsCloudModel): boolean; - isAssigneePropertyClickable(taskDetails: TaskDetailsCloudModel, candidateUsers: CardViewArrayItem[], candidateGroups: CardViewArrayItem[]): boolean; + isAssigneePropertyClickable( + taskDetails: TaskDetailsCloudModel, + candidateUsers: CardViewArrayItem[], + candidateGroups: CardViewArrayItem[] + ): boolean; canClaimTask(taskDetails: TaskDetailsCloudModel): boolean; canUnclaimTask(taskDetails: TaskDetailsCloudModel): boolean; claimTask(appName: string, taskId: string, assignee: string): Observable; diff --git a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts index 4cf355b0d46..17f78bca0ea 100644 --- a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts @@ -26,9 +26,9 @@ import { TASK_CLAIM_PERMISSION, TASK_CREATED_STATE, TASK_RELEASE_PERMISSION -} from '../start-task/models/task-details-cloud.model'; +} from '../models/task-details-cloud.model'; import { BaseCloudService } from '../../services/base-cloud.service'; -import { StartTaskCloudRequestModel } from '../start-task/models/start-task-cloud-request.model'; +import { StartTaskCloudRequestModel } from '../models/start-task-cloud-request.model'; import { ProcessDefinitionCloud } from '../../models/process-definition-cloud.model'; import { DEFAULT_TASK_PRIORITIES, TaskPriorityOption } from '../models/task.model'; import { TaskCloudServiceInterface } from './task-cloud.service.interface'; diff --git a/lib/process-services-cloud/src/lib/task/start-task/public-api.ts b/lib/process-services-cloud/src/lib/task/start-task/public-api.ts deleted file mode 100644 index dfde742c033..00000000000 --- a/lib/process-services-cloud/src/lib/task/start-task/public-api.ts +++ /dev/null @@ -1,18 +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. - */ - -export * from './models/task-details-cloud.model'; diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts index b3dc850fa17..60827ba1e57 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts @@ -15,24 +15,14 @@ * limitations under the License. */ -import { - Component, - EventEmitter, - inject, - Input, - OnChanges, - OnInit, - Output, - SimpleChanges, - ViewEncapsulation -} from '@angular/core'; +import { Component, EventEmitter, inject, Input, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { Observable } from 'rxjs'; import { TaskFilterCloudService } from '../services/task-filter-cloud.service'; import { FilterParamsModel, TaskFilterCloudModel } from '../models/filter-cloud.model'; import { AppConfigService, TranslationService } from '@alfresco/adf-core'; import { debounceTime, tap } from 'rxjs/operators'; import { BaseTaskFiltersCloudComponent } from './base-task-filters-cloud.component'; -import { TaskDetailsCloudModel } from '../../start-task/models/task-details-cloud.model'; +import { TaskDetailsCloudModel } from '../../models/task-details-cloud.model'; import { TaskCloudEngineEvent } from '../../../models/engine-event-cloud.model'; import { TaskListCloudService } from '../../task-list/services/task-list-cloud.service'; import { TaskFilterCloudAdapter } from '../../../models/filter-cloud-model'; diff --git a/lib/process-services-cloud/src/lib/task/task-filters/mock/task-filters-cloud.mock.ts b/lib/process-services-cloud/src/lib/task/task-filters/mock/task-filters-cloud.mock.ts index cc2d7d092ed..efc0f1ec058 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/mock/task-filters-cloud.mock.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/mock/task-filters-cloud.mock.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { TaskDetailsCloudModel } from '../../../task/start-task/models/task-details-cloud.model'; +import { TaskDetailsCloudModel } from '../../models/task-details-cloud.model'; import { assignedTaskDetailsCloudMock } from '../../task-header/mocks/task-details-cloud.mock'; import { TaskFilterCloudModel, ServiceTaskFilterCloudModel, AssignmentType, TaskStatusFilter } from '../models/filter-cloud.model'; diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.spec.ts index 23826db9015..e783847281f 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.spec.ts @@ -31,7 +31,7 @@ import { TASK_RELEASE_PERMISSION, TASK_VIEW_PERMISSION, TaskDetailsCloudModel -} from '../../../start-task/models/task-details-cloud.model'; +} from '../../../models/task-details-cloud.model'; import { UserTaskCloudButtonsComponent } from '../user-task-cloud-buttons/user-task-cloud-buttons.component'; import { TaskFormCloudComponent } from './task-form-cloud.component'; diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.ts index 67b8a87547a..4b250f912aa 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.ts @@ -23,7 +23,7 @@ import { DateCloudWidgetComponent } from '../../../../form/components/widgets/da import { DropdownCloudWidgetComponent } from '../../../../form/components/widgets/dropdown/dropdown-cloud.widget'; import { FormCloudDisplayModeConfiguration } from '../../../../services/form-fields.interfaces'; import { TaskCloudService } from '../../../services/task-cloud.service'; -import { TaskDetailsCloudModel } from '../../../start-task/models/task-details-cloud.model'; +import { TaskDetailsCloudModel } from '../../../models/task-details-cloud.model'; import { CommonModule } from '@angular/common'; import { UserTaskCloudButtonsComponent } from '../user-task-cloud-buttons/user-task-cloud-buttons.component'; import { FormCustomOutcomesComponent } from '../../../../form/components/form-cloud-custom-outcomes.component'; diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts index 18527befbc5..d95febce870 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts @@ -20,7 +20,7 @@ import { Component, DestroyRef, EventEmitter, inject, Input, OnChanges, OnInit, import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { FormCloudDisplayModeConfiguration } from '../../../../services/form-fields.interfaces'; import { TaskCloudService } from '../../../services/task-cloud.service'; -import { TaskDetailsCloudModel } from '../../../start-task/models/task-details-cloud.model'; +import { TaskDetailsCloudModel } from '../../../models/task-details-cloud.model'; import { TaskFormCloudComponent } from '../task-form-cloud/task-form-cloud.component'; import { CommonModule } from '@angular/common'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; diff --git a/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.ts index 143e7945848..b957e1cf1cc 100644 --- a/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.ts @@ -33,7 +33,7 @@ import { TranslationService, UpdateNotification } from '@alfresco/adf-core'; -import { TaskDetailsCloudModel } from '../../start-task/models/task-details-cloud.model'; +import { TaskDetailsCloudModel } from '../../models/task-details-cloud.model'; import { TaskCloudService } from '../../services/task-cloud.service'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { CommonModule } from '@angular/common'; diff --git a/lib/process-services-cloud/src/lib/task/task-header/mocks/task-details-cloud.mock.ts b/lib/process-services-cloud/src/lib/task/task-header/mocks/task-details-cloud.mock.ts index 29e5464c6e5..a7d6748abb5 100644 --- a/lib/process-services-cloud/src/lib/task/task-header/mocks/task-details-cloud.mock.ts +++ b/lib/process-services-cloud/src/lib/task/task-header/mocks/task-details-cloud.mock.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { TaskDetailsCloudModel } from '../../start-task/models/task-details-cloud.model'; +import { TaskDetailsCloudModel } from '../../models/task-details-cloud.model'; export const taskDetailsWithParentTaskIdMock: TaskDetailsCloudModel = { appName: 'task-app', From b0caa0f0d08695dd722f777d63b8c42bca81cb21 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 08:29:24 -0500 Subject: [PATCH 02/30] consolidate shared model classes --- .../src/lib/task/models/public-api.ts | 18 ------------------ .../src/lib/task/public-api.ts | 4 +--- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 lib/process-services-cloud/src/lib/task/models/public-api.ts diff --git a/lib/process-services-cloud/src/lib/task/models/public-api.ts b/lib/process-services-cloud/src/lib/task/models/public-api.ts deleted file mode 100644 index 5f1b43178b5..00000000000 --- a/lib/process-services-cloud/src/lib/task/models/public-api.ts +++ /dev/null @@ -1,18 +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. - */ - - export * from './task.model'; diff --git a/lib/process-services-cloud/src/lib/task/public-api.ts b/lib/process-services-cloud/src/lib/task/public-api.ts index 7639f2878bb..f66c5695ad5 100644 --- a/lib/process-services-cloud/src/lib/task/public-api.ts +++ b/lib/process-services-cloud/src/lib/task/public-api.ts @@ -18,12 +18,10 @@ export * from './task-list/public-api'; export * from './task-filters/public-api'; export * from './models/task-details-cloud.model'; +export * from './models/task.model'; export * from './models/start-task-cloud-request.model'; export * from './task-header/public-api'; export * from './task-form/public-api'; export * from './directives/public-api'; -export * from './models/public-api'; - export * from './services/task-cloud.service'; - export * from './task-cloud.module'; From b360df90efbfe25a2387012c30df914c526caa33 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 09:20:39 -0500 Subject: [PATCH 03/30] split task/service lists --- .../components/task-list-cloud.component.md | 2 +- .../base-task-list-cloud.component.ts | 36 ++++++++- .../service-task-list-cloud.component.html} | 17 +++-- .../service-task-list-cloud.component.scss} | 0 .../service-task-list-cloud.component.spec.ts | 8 +- .../service-task-list-cloud.component.ts | 40 ++++++++-- .../task-list-datatable-adapter.spec.ts | 8 +- .../datatable/task-list-datatable-adapter.ts | 4 +- .../task-list/task-list-cloud.component.html | 58 ++++++++++++++ .../task-list/task-list-cloud.component.scss | 4 + .../task-list-cloud.component.spec.ts | 16 ++-- .../task-list-cloud.component.ts | 56 ++++++++++---- .../models/task-preset-cloud.model.ts | 75 ------------------- .../src/lib/task/task-list/public-api.ts | 5 +- .../task/task-list/task-list-cloud.module.ts | 14 ++-- 15 files changed, 202 insertions(+), 141 deletions(-) rename lib/process-services-cloud/src/lib/task/task-list/components/{base-task-list-cloud.component.html => service-task-list/service-task-list-cloud.component.html} (78%) rename lib/process-services-cloud/src/lib/task/task-list/components/{base-task-list-cloud.component.scss => service-task-list/service-task-list-cloud.component.scss} (100%) rename lib/process-services-cloud/src/lib/task/task-list/components/{ => service-task-list}/service-task-list-cloud.component.spec.ts (98%) rename lib/process-services-cloud/src/lib/task/task-list/components/{ => service-task-list}/service-task-list-cloud.component.ts (77%) rename lib/process-services-cloud/src/lib/task/task-list/{ => components/task-list}/datatable/task-list-datatable-adapter.spec.ts (87%) rename lib/process-services-cloud/src/lib/task/task-list/{ => components/task-list}/datatable/task-list-datatable-adapter.ts (89%) create mode 100644 lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.html create mode 100644 lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.scss rename lib/process-services-cloud/src/lib/task/task-list/components/{ => task-list}/task-list-cloud.component.spec.ts (98%) rename lib/process-services-cloud/src/lib/task/task-list/components/{ => task-list}/task-list-cloud.component.ts (88%) delete mode 100644 lib/process-services-cloud/src/lib/task/task-list/models/task-preset-cloud.model.ts diff --git a/docs/process-services-cloud/components/task-list-cloud.component.md b/docs/process-services-cloud/components/task-list-cloud.component.md index c9f6702a314..a85bb13f6a0 100644 --- a/docs/process-services-cloud/components/task-list-cloud.component.md +++ b/docs/process-services-cloud/components/task-list-cloud.component.md @@ -5,7 +5,7 @@ Status: Experimental Last reviewed: 2019-03-25 --- -# [Task List Cloud component](../../../lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts "Defined in task-list-cloud.component.ts") +# [Task List Cloud component](../../../lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.ts "Defined in task-list-cloud.component.ts") Renders a list containing all the tasks matched by the parameters specified. diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts index 80aaa781fe5..a86b5b0a9dd 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts @@ -43,7 +43,6 @@ import { UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core'; -import { taskPresetsCloudDefaultModel } from '../models/task-preset-cloud.model'; import { TaskQueryCloudRequestModel } from '../../../models/filter-cloud-model'; import { BehaviorSubject, Observable } from 'rxjs'; import { TaskListCloudSortingModel } from '../../../models/task-list-sorting.model'; @@ -53,13 +52,42 @@ import { PreferenceCloudServiceInterface } from '../../../services/preference-cl import { TasksListCloudPreferences } from '../models/tasks-cloud-preferences'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +const taskPresetsCloudDefaultModel = { + default: [ + { + id: 'name', + key: 'name', + type: 'text', + title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.NAME', + sortable: true + }, + { + id: 'created', + key: 'created', + type: 'text', + title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED', + cssClass: 'hidden', + sortable: true + }, + { + id: 'assignee', + key: 'assignee', + type: 'text', + title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.ASSIGNEE', + cssClass: 'hidden', + sortable: true + } + ] +}; + +/* eslint-disable @typescript-eslint/brace-style */ + @Directive() // eslint-disable-next-line @angular-eslint/directive-class-suffix export abstract class BaseTaskListCloudComponent extends DataTableSchema -// eslint-disable-next-line @typescript-eslint/brace-style - implements OnChanges, AfterContentInit, PaginatedComponent, OnInit { - + implements OnChanges, AfterContentInit, PaginatedComponent, OnInit +{ @ContentChild(CustomEmptyContentTemplateDirective) emptyCustomContent: CustomEmptyContentTemplateDirective; diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.html b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.html similarity index 78% rename from lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.html rename to lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.html index 53ca483d242..4b46909ca58 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.html +++ b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.html @@ -29,18 +29,19 @@ > - - + - + diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.scss b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.scss similarity index 100% rename from lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.scss rename to lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.scss diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.spec.ts similarity index 98% rename from lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.spec.ts rename to lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.spec.ts index 2b1e3df9bd6..0036aa75e33 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.spec.ts @@ -20,12 +20,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { AppConfigService, DataRowEvent, ObjectDataRow } from '@alfresco/adf-core'; import { ServiceTaskListCloudComponent } from './service-task-list-cloud.component'; -import { fakeServiceTask, fakeCustomSchema } from '../mock/fake-task-response.mock'; +import { fakeServiceTask, fakeCustomSchema } from '../../mock/fake-task-response.mock'; import { of } from 'rxjs'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; -import { TaskListCloudSortingModel } from '../../../models/task-list-sorting.model'; +import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; +import { TaskListCloudSortingModel } from '../../../../models/task-list-sorting.model'; import { shareReplay, skip } from 'rxjs/operators'; -import { ServiceTaskListCloudService } from '../services/service-task-list-cloud.service'; +import { ServiceTaskListCloudService } from '../../services/service-task-list-cloud.service'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.ts similarity index 77% rename from lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.ts rename to lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.ts index f6ccce78c04..0320cc07d89 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.ts @@ -16,22 +16,46 @@ */ import { Component, Inject, Input, ViewEncapsulation } from '@angular/core'; -import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core'; -import { ServiceTaskQueryCloudRequestModel } from '../models/service-task-cloud.model'; -import { BaseTaskListCloudComponent } from './base-task-list-cloud.component'; -import { ServiceTaskListCloudService } from '../services/service-task-list-cloud.service'; -import { TaskCloudService } from '../../services/task-cloud.service'; +import { + AppConfigService, + ColumnsSelectorComponent, + DataTableComponent, + EmptyContentComponent, + LoadingContentTemplateDirective, + MainMenuDataTableTemplateDirective, + NoContentTemplateDirective, + UserPreferencesService +} from '@alfresco/adf-core'; +import { ServiceTaskQueryCloudRequestModel } from '../../models/service-task-cloud.model'; +import { BaseTaskListCloudComponent } from '../base-task-list-cloud.component'; +import { ServiceTaskListCloudService } from '../../services/service-task-list-cloud.service'; +import { TaskCloudService } from '../../../services/task-cloud.service'; import { BehaviorSubject, combineLatest } from 'rxjs'; -import { PreferenceCloudServiceInterface, TASK_LIST_PREFERENCES_SERVICE_TOKEN } from '../../../services/public-api'; +import { PreferenceCloudServiceInterface, TASK_LIST_PREFERENCES_SERVICE_TOKEN } from '../../../../services/public-api'; import { map } from 'rxjs/operators'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; const PRESET_KEY = 'adf-cloud-service-task-list.presets'; @Component({ selector: 'adf-cloud-service-task-list', - templateUrl: './base-task-list-cloud.component.html', - styleUrls: ['./base-task-list-cloud.component.scss'], + standalone: true, + imports: [ + CommonModule, + ColumnsSelectorComponent, + MainMenuDataTableTemplateDirective, + TranslateModule, + EmptyContentComponent, + NoContentTemplateDirective, + MatProgressSpinnerModule, + LoadingContentTemplateDirective, + DataTableComponent + ], + templateUrl: './service-task-list-cloud.component.html', + styleUrls: ['./service-task-list-cloud.component.scss'], encapsulation: ViewEncapsulation.None }) export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent { diff --git a/lib/process-services-cloud/src/lib/task/task-list/datatable/task-list-datatable-adapter.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/datatable/task-list-datatable-adapter.spec.ts similarity index 87% rename from lib/process-services-cloud/src/lib/task/task-list/datatable/task-list-datatable-adapter.spec.ts rename to lib/process-services-cloud/src/lib/task/task-list/components/task-list/datatable/task-list-datatable-adapter.spec.ts index dfc364ca889..3c38ea1bbbb 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/datatable/task-list-datatable-adapter.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/datatable/task-list-datatable-adapter.spec.ts @@ -16,11 +16,11 @@ */ import { DataColumn, DataRow, getDataColumnMock } from '@alfresco/adf-core'; -import { ProcessListDataColumnCustomData, PROCESS_LIST_CUSTOM_VARIABLE_COLUMN } from '../../../models/data-column-custom-data'; +import { ProcessListDataColumnCustomData, PROCESS_LIST_CUSTOM_VARIABLE_COLUMN } from '../../../../../models/data-column-custom-data'; import { TasksListDatatableAdapter } from './task-list-datatable-adapter'; -import { TaskInstanceCloudListViewModel } from '../models/task-cloud-view.model'; -import { getTaskCloudModelMock } from '../../../mock/task-cloud-model.mock'; -import { getProcessInstanceVariableMock } from '../../../mock/process-instance-variable.mock'; +import { TaskInstanceCloudListViewModel } from '../../../models/task-cloud-view.model'; +import { getTaskCloudModelMock } from '../../../../../mock/task-cloud-model.mock'; +import { getProcessInstanceVariableMock } from '../../../../../mock/process-instance-variable.mock'; describe('TasksListDatatableAdapter', () => { it('should get proepr type for column', () => { diff --git a/lib/process-services-cloud/src/lib/task/task-list/datatable/task-list-datatable-adapter.ts b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/datatable/task-list-datatable-adapter.ts similarity index 89% rename from lib/process-services-cloud/src/lib/task/task-list/datatable/task-list-datatable-adapter.ts rename to lib/process-services-cloud/src/lib/task/task-list/components/task-list/datatable/task-list-datatable-adapter.ts index 75f1edb98b9..87aa0afaea4 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/datatable/task-list-datatable-adapter.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/datatable/task-list-datatable-adapter.ts @@ -16,8 +16,8 @@ */ import { DataColumn, DataRow, ObjectDataTableAdapter } from '@alfresco/adf-core'; -import { ProcessListDataColumnCustomData, PROCESS_LIST_CUSTOM_VARIABLE_COLUMN } from '../../../models/data-column-custom-data'; -import { TaskInstanceCloudListViewModel } from '../models/task-cloud-view.model'; +import { ProcessListDataColumnCustomData, PROCESS_LIST_CUSTOM_VARIABLE_COLUMN } from '../../../../../models/data-column-custom-data'; +import { TaskInstanceCloudListViewModel } from '../../../models/task-cloud-view.model'; export class TasksListDatatableAdapter extends ObjectDataTableAdapter { constructor(data: TaskInstanceCloudListViewModel[], schema: DataColumn[]) { diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.html b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.html new file mode 100644 index 00000000000..4b46909ca58 --- /dev/null +++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.html @@ -0,0 +1,58 @@ +
{{ 'ADF_CLOUD_TASK_LIST.FILTERS.MESSAGES.NONE' | translate }}
+ + + + + + + + + + + + + + + + + + + + + diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.scss b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.scss new file mode 100644 index 00000000000..0f285da50bd --- /dev/null +++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.scss @@ -0,0 +1,4 @@ +.adf-cloud-task-list-loading-margin { + margin-left: calc((100% - 100px) / 2); + margin-right: calc((100% - 100px) / 2); +} diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts similarity index 98% rename from lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.spec.ts rename to lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts index 4049299b28a..39d4dcbaca1 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts @@ -19,17 +19,17 @@ import { Component, SimpleChange, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { AppConfigService, DataRowEvent, ObjectDataRow, User, DataColumn, ColumnsSelectorComponent } from '@alfresco/adf-core'; -import { TaskListCloudService } from '../services/task-list-cloud.service'; +import { TaskListCloudService } from '../../services/task-list-cloud.service'; import { TaskListCloudComponent } from './task-list-cloud.component'; -import { fakeGlobalTasks, fakeCustomSchema, fakeGlobalTask } from '../mock/fake-task-response.mock'; +import { fakeGlobalTasks, fakeCustomSchema, fakeGlobalTask } from '../../mock/fake-task-response.mock'; import { of } from 'rxjs'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; -import { TaskListCloudSortingModel } from '../../../models/task-list-sorting.model'; +import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; +import { TaskListCloudSortingModel } from '../../../../models/task-list-sorting.model'; import { shareReplay, skip } from 'rxjs/operators'; -import { TaskListCloudServiceInterface } from '../../../services/task-list-cloud.service.interface'; -import { TASK_LIST_CLOUD_TOKEN, TASK_LIST_PREFERENCES_SERVICE_TOKEN } from '../../../services/cloud-token.service'; -import { TaskListCloudModule } from '../task-list-cloud.module'; -import { PreferenceCloudServiceInterface } from '../../../services/preference-cloud.interface'; +import { TaskListCloudServiceInterface } from '../../../../services/task-list-cloud.service.interface'; +import { TASK_LIST_CLOUD_TOKEN, TASK_LIST_PREFERENCES_SERVICE_TOKEN } from '../../../../services/cloud-token.service'; +import { TaskListCloudModule } from '../../task-list-cloud.module'; +import { PreferenceCloudServiceInterface } from '../../../../services/preference-cloud.interface'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.ts similarity index 88% rename from lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts rename to lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.ts index bddba5e2d96..229369dc862 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.ts @@ -16,31 +16,55 @@ */ import { Component, Inject, Input, ViewEncapsulation } from '@angular/core'; -import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core'; -import { TaskListRequestModel, TaskQueryCloudRequestModel } from '../../../models/filter-cloud-model'; -import { BaseTaskListCloudComponent } from './base-task-list-cloud.component'; -import { TaskCloudService } from '../../services/task-cloud.service'; -import { TASK_LIST_CLOUD_TOKEN, TASK_LIST_PREFERENCES_SERVICE_TOKEN } from '../../../services/cloud-token.service'; -import { PreferenceCloudServiceInterface } from '../../../services/preference-cloud.interface'; -import { TaskListCloudServiceInterface } from '../../../services/task-list-cloud.service.interface'; +import { + AppConfigService, + ColumnsSelectorComponent, + DataTableComponent, + EmptyContentComponent, + LoadingContentTemplateDirective, + MainMenuDataTableTemplateDirective, + NoContentTemplateDirective, + UserPreferencesService +} from '@alfresco/adf-core'; +import { TaskListRequestModel, TaskQueryCloudRequestModel } from '../../../../models/filter-cloud-model'; +import { BaseTaskListCloudComponent } from '../base-task-list-cloud.component'; +import { TaskCloudService } from '../../../services/task-cloud.service'; +import { TASK_LIST_CLOUD_TOKEN, TASK_LIST_PREFERENCES_SERVICE_TOKEN } from '../../../../services/cloud-token.service'; +import { PreferenceCloudServiceInterface } from '../../../../services/preference-cloud.interface'; +import { TaskListCloudServiceInterface } from '../../../../services/task-list-cloud.service.interface'; import { BehaviorSubject, combineLatest, Subject } from 'rxjs'; import { filter, map, switchMap, take, tap } from 'rxjs/operators'; -import { VariableMapperService } from '../../../services/variable-mapper.sevice'; -import { ProcessListDataColumnCustomData } from '../../../models/data-column-custom-data'; -import { TaskCloudModel } from '../../../models/task-cloud.model'; +import { VariableMapperService } from '../../../../services/variable-mapper.sevice'; +import { ProcessListDataColumnCustomData } from '../../../../models/data-column-custom-data'; +import { TaskCloudModel } from '../../../../models/task-cloud.model'; import { PaginatedEntries } from '@alfresco/js-api'; -import { TaskInstanceCloudListViewModel } from '../models/task-cloud-view.model'; -import { TasksListDatatableAdapter } from '../datatable/task-list-datatable-adapter'; +import { TaskInstanceCloudListViewModel } from '../../models/task-cloud-view.model'; +import { TasksListDatatableAdapter } from './datatable/task-list-datatable-adapter'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { TaskListRequestSortingModel } from '../../../models/task-list-sorting.model'; -import { ProcessVariableFilterModel } from '../../../models/process-variable-filter.model'; +import { TaskListRequestSortingModel } from '../../../../models/task-list-sorting.model'; +import { ProcessVariableFilterModel } from '../../../../models/process-variable-filter.model'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; const PRESET_KEY = 'adf-cloud-task-list.presets'; @Component({ selector: 'adf-cloud-task-list', - templateUrl: './base-task-list-cloud.component.html', - styleUrls: ['./base-task-list-cloud.component.scss'], + standalone: true, + imports: [ + CommonModule, + ColumnsSelectorComponent, + MainMenuDataTableTemplateDirective, + TranslateModule, + EmptyContentComponent, + NoContentTemplateDirective, + MatProgressSpinnerModule, + LoadingContentTemplateDirective, + DataTableComponent + ], + templateUrl: './task-list-cloud.component.html', + styleUrls: ['./task-list-cloud.component.scss'], encapsulation: ViewEncapsulation.None }) export class TaskListCloudComponent extends BaseTaskListCloudComponent { diff --git a/lib/process-services-cloud/src/lib/task/task-list/models/task-preset-cloud.model.ts b/lib/process-services-cloud/src/lib/task/task-list/models/task-preset-cloud.model.ts deleted file mode 100644 index fa5194fdcd2..00000000000 --- a/lib/process-services-cloud/src/lib/task/task-list/models/task-preset-cloud.model.ts +++ /dev/null @@ -1,75 +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. - */ - -export const taskPresetsCloudDefaultModel = { - default: [ - { - id: 'name', - key: 'name', - type: 'text', - title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.NAME', - sortable: true - }, - { - id: 'created', - key: 'created', - type: 'text', - title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED', - cssClass: 'hidden', - sortable: true - }, - { - id: 'assignee', - key: 'assignee', - type: 'text', - title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.ASSIGNEE', - cssClass: 'hidden', - sortable: true - } - ] -}; - -export const serviceTaskPresetsCloudDefaultModel = { - default: [ - { - key: 'activityName', - type: 'text', - title: 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.ACTIVITY_NAME', - sortable: true - }, - { - key: 'status', - type: 'text', - title: 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.STATUS', - sortable: true - }, - { - key: 'startedDate', - type: 'text', - title: 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.STARTED_DATE', - cssClass: 'hidden', - sortable: true - }, - { - key: 'completedDate', - type: 'text', - title: 'ADF_CLOUD_SERVICE_TASK_LIST.PROPERTIES.COMPLETED_DATE', - cssClass: 'hidden', - sortable: true - } - ] -}; diff --git a/lib/process-services-cloud/src/lib/task/task-list/public-api.ts b/lib/process-services-cloud/src/lib/task/task-list/public-api.ts index 5d8600d05f7..d18dd7d0442 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/public-api.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/public-api.ts @@ -15,12 +15,11 @@ * limitations under the License. */ -export * from './components/task-list-cloud.component'; -export * from './components/service-task-list-cloud.component'; +export * from './components/task-list/task-list-cloud.component'; +export * from './components/service-task-list/service-task-list-cloud.component'; export * from './models/service-task-cloud.model'; export * from './models/tasks-cloud-preferences'; -export * from './models/task-preset-cloud.model'; export * from './services/task-list-cloud.service'; export * from './services/service-task-list-cloud.service'; diff --git a/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts index bdc30172bf8..341bab08a1b 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts @@ -16,19 +16,17 @@ */ import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { MaterialModule } from '../../material.module'; -import { TaskListCloudComponent } from './components/task-list-cloud.component'; -import { ServiceTaskListCloudComponent } from './components/service-task-list-cloud.component'; -import { CoreModule } from '@alfresco/adf-core'; +import { TaskListCloudComponent } from './components/task-list/task-list-cloud.component'; +import { ServiceTaskListCloudComponent } from './components/service-task-list/service-task-list-cloud.component'; import { TASK_LIST_CLOUD_TOKEN, TASK_LIST_PREFERENCES_SERVICE_TOKEN } from '../../services/cloud-token.service'; import { TaskListCloudService } from './services/task-list-cloud.service'; import { LocalPreferenceCloudService } from '../../services/local-preference-cloud.service'; +export const TASK_LIST_CLOUD_DIRECTIVES = [TaskListCloudComponent, ServiceTaskListCloudComponent] as const; + @NgModule({ - imports: [CommonModule, MaterialModule, CoreModule], - declarations: [TaskListCloudComponent, ServiceTaskListCloudComponent], - exports: [TaskListCloudComponent, ServiceTaskListCloudComponent], + imports: [...TASK_LIST_CLOUD_DIRECTIVES], + exports: [...TASK_LIST_CLOUD_DIRECTIVES], providers: [ { provide: TASK_LIST_CLOUD_TOKEN, From 0bc5b9879af585ef92a851557f967192aa067e86 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 09:42:19 -0500 Subject: [PATCH 04/30] split task/service filters --- .../edit-task-filter-cloud.component.md | 34 ++--- .../task-filters-cloud.component.md | 2 +- ...-service-task-filter-cloud.component.html} | 0 ...-service-task-filter-cloud.component.scss} | 0 ...ervice-task-filter-cloud.component.spec.ts | 26 ++-- ...dit-service-task-filter-cloud.component.ts | 14 +-- .../edit-task-filter-cloud.component.html | 117 ++++++++++++++++++ .../edit-task-filter-cloud.component.scss | 97 +++++++++++++++ .../edit-task-filter-cloud.component.spec.ts | 34 ++--- .../edit-task-filter-cloud.component.ts | 53 +++----- ...service-task-filters-cloud.component.html} | 0 ...service-task-filters-cloud.component.scss} | 0 ...rvice-task-filters-cloud.component.spec.ts | 12 +- .../service-task-filters-cloud.component.ts | 21 +--- .../task-filters-cloud.component.html | 35 ++++++ .../task-filters-cloud.component.scss | 39 ++++++ .../task-filters-cloud.component.spec.ts | 16 +-- .../task-filters-cloud.component.ts | 18 +-- .../src/lib/task/task-filters/public-api.ts | 8 +- .../task-filters/task-filters-cloud.module.ts | 8 +- 20 files changed, 397 insertions(+), 137 deletions(-) rename lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/{base-edit-task-filter-cloud.component.html => edit-service-task-filter/edit-service-task-filter-cloud.component.html} (100%) rename lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/{base-edit-task-filter-cloud.component.scss => edit-service-task-filter/edit-service-task-filter-cloud.component.scss} (100%) rename lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/{ => edit-service-task-filter}/edit-service-task-filter-cloud.component.spec.ts (96%) rename lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/{ => edit-service-task-filter}/edit-service-task-filter-cloud.component.ts (93%) create mode 100644 lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.html create mode 100644 lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.scss rename lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/{ => edit-task-filter}/edit-task-filter-cloud.component.spec.ts (96%) rename lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/{ => edit-task-filter}/edit-task-filter-cloud.component.ts (89%) rename lib/process-services-cloud/src/lib/task/task-filters/components/{base-task-filters-cloud.component.html => service-task-filters/service-task-filters-cloud.component.html} (100%) rename lib/process-services-cloud/src/lib/task/task-filters/components/{base-task-filters-cloud.component.scss => service-task-filters/service-task-filters-cloud.component.scss} (100%) rename lib/process-services-cloud/src/lib/task/task-filters/components/{ => service-task-filters}/service-task-filters-cloud.component.spec.ts (94%) rename lib/process-services-cloud/src/lib/task/task-filters/components/{ => service-task-filters}/service-task-filters-cloud.component.ts (91%) create mode 100644 lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.html create mode 100644 lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.scss rename lib/process-services-cloud/src/lib/task/task-filters/components/{ => task-filters}/task-filters-cloud.component.spec.ts (97%) rename lib/process-services-cloud/src/lib/task/task-filters/components/{ => task-filters}/task-filters-cloud.component.ts (93%) diff --git a/docs/process-services-cloud/components/edit-task-filter-cloud.component.md b/docs/process-services-cloud/components/edit-task-filter-cloud.component.md index 18342dba905..b3b396bf9a5 100644 --- a/docs/process-services-cloud/components/edit-task-filter-cloud.component.md +++ b/docs/process-services-cloud/components/edit-task-filter-cloud.component.md @@ -5,7 +5,7 @@ Status: Experimental Last reviewed: 2023-04-03 --- -# [Edit Task Filter Cloud component](../../../lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.ts "Defined in edit-task-filter-cloud.component.ts") +# Edit Task Filter Cloud component Edits task filter details. @@ -41,20 +41,20 @@ Edits task filter details. ### Properties -| Name | Type | Default value | Description | -|--------------------|----------------------------------------------------------------------------------------------------------------------|---------------|--------------------------------------------| -| actions | `string[]` | | List of task filter actions. | -| appName | `string` | "" | (required) Name of the app. | -| environmentList | [`Environment`](../../../lib/process-services-cloud/src/lib/common/interface/environment.interface.ts)`[]` | \[] | List of environments. | -| filterProperties | `string[]` | \[] | List of task filter properties to display. | -| id | `string` | | (required) ID of the task filter. | -| processInstanceId | `string` | | processInstanceId of the task filter. | -| role | `string` | "" | user role. | -| showFilterActions | `boolean` | true | Toggles the filter actions. | -| showTaskFilterName | `boolean` | true | Toggles display of task filter name | -| showTitle | `boolean` | true | Toggles the title. | -| sortProperties | `string[]` | \[] | List of sort properties to display. | -| taskFilter | [`TaskFilterCloudModel`](../../../lib/process-services-cloud/src/lib/task/task-filters/models/filter-cloud.model.ts) | | Task Filter to use. | +| Name | Type | Default value | Description | +|--------------------|------------------------|---------------|--------------------------------------------| +| actions | `string[]` | | List of task filter actions. | +| appName | `string` | "" | (required) Name of the app. | +| environmentList | `Environment[]` | \[] | List of environments. | +| filterProperties | `string[]` | \[] | List of task filter properties to display. | +| id | `string` | | (required) ID of the task filter. | +| processInstanceId | `string` | | processInstanceId of the task filter. | +| role | `string` | "" | user role. | +| showFilterActions | `boolean` | true | Toggles the filter actions. | +| showTaskFilterName | `boolean` | true | Toggles display of task filter name | +| showTitle | `boolean` | true | Toggles the title. | +| sortProperties | `string[]` | \[] | List of sort properties to display. | +| taskFilter | `TaskFilterCloudModel` | | Task Filter to use. | ### Events @@ -86,14 +86,14 @@ given below: |---------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **_appName_** | Name of the app | | **_status_** | Execution state of the task. | -| **_assignee_** | [`User`](lib/core/src/lib/pipes/user-initial.pipe.ts) the task is assigned to | +| **_assignee_** | `User` the task is assigned to | | **_taskName_** | Name of the task | | **_taskId_** | ID of the task | | **_parentTaskId_** | ID of the task's parent task | | **_priority_** | Task priority | | **_createdDate_** | Date the task was created | | **_standalone_** | Standalone status of the task | -| **_owner_** | [`User`](lib/core/src/lib/pipes/user-initial.pipe.ts) ID of the task's owner | +| **_owner_** | `User` ID of the task's owner | | **_processDefinitionId_** | Process definition ID | | **_processInstanceId_** | Process instance ID | | **_lastModified_** | Date the task was last modified. If lastModified defined the component will show the range **_lastModifiedFrom_**, **_lastModifiedTo_** | diff --git a/docs/process-services-cloud/components/task-filters-cloud.component.md b/docs/process-services-cloud/components/task-filters-cloud.component.md index a2bccce6339..09a895440cf 100644 --- a/docs/process-services-cloud/components/task-filters-cloud.component.md +++ b/docs/process-services-cloud/components/task-filters-cloud.component.md @@ -5,7 +5,7 @@ Status: Experimental Last reviewed: 2019-01-08 --- -# [Task Filters Cloud component](../../../lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts "Defined in task-filters-cloud.component.ts") +# [Task Filters Cloud component](../../../lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts "Defined in task-filters-cloud.component.ts") Shows all available filters. diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/base-edit-task-filter-cloud.component.html b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.html similarity index 100% rename from lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/base-edit-task-filter-cloud.component.html rename to lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.html diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/base-edit-task-filter-cloud.component.scss b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.scss similarity index 100% rename from lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/base-edit-task-filter-cloud.component.scss rename to lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.scss diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.spec.ts similarity index 96% rename from lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter-cloud.component.spec.ts rename to lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.spec.ts index 9905455fc93..1e06210b5d9 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.spec.ts @@ -19,21 +19,21 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { SimpleChange } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; import { of, Subject } from 'rxjs'; -import { TASK_FILTERS_SERVICE_TOKEN } from '../../../../services/cloud-token.service'; -import { LocalPreferenceCloudService } from '../../../../services/local-preference-cloud.service'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; -import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service'; -import { fakeApplicationInstance, fakeApplicationInstanceWithEnvironment } from '../../../../app/mock/app-model.mock'; -import { TaskFiltersCloudModule } from '../../task-filters-cloud.module'; -import { ServiceTaskFilterCloudService } from '../../services/service-task-filter-cloud.service'; -import { TaskCloudService } from '../../../services/task-cloud.service'; -import { fakeServiceFilter } from '../../mock/task-filters-cloud.mock'; +import { TASK_FILTERS_SERVICE_TOKEN } from '../../../../../services/cloud-token.service'; +import { LocalPreferenceCloudService } from '../../../../../services/local-preference-cloud.service'; +import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; +import { AppsProcessCloudService } from '../../../../../app/services/apps-process-cloud.service'; +import { fakeApplicationInstance, fakeApplicationInstanceWithEnvironment } from '../../../../../app/mock/app-model.mock'; +import { TaskFiltersCloudModule } from '../../../task-filters-cloud.module'; +import { ServiceTaskFilterCloudService } from '../../../services/service-task-filter-cloud.service'; +import { TaskCloudService } from '../../../../services/task-cloud.service'; +import { fakeServiceFilter } from '../../../mock/task-filters-cloud.mock'; import { EditServiceTaskFilterCloudComponent } from './edit-service-task-filter-cloud.component'; import { MatIconTestingModule } from '@angular/material/icon/testing'; -import { ProcessDefinitionCloud } from '../../../../models/process-definition-cloud.model'; -import { TaskFilterDialogCloudComponent } from '../task-filter-dialog/task-filter-dialog-cloud.component'; -import { fakeEnvironmentList } from '../../../../common/mock/environment.mock'; -import { mockApplicationTaskFilterProperties } from '../../mock/edit-task-filter-cloud.mock'; +import { ProcessDefinitionCloud } from '../../../../../models/process-definition-cloud.model'; +import { TaskFilterDialogCloudComponent } from '../../task-filter-dialog/task-filter-dialog-cloud.component'; +import { fakeEnvironmentList } from '../../../../../common/mock/environment.mock'; +import { mockApplicationTaskFilterProperties } from '../../../mock/edit-task-filter-cloud.mock'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatExpansionPanelHarness } from '@angular/material/expansion/testing'; diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.ts similarity index 93% rename from lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter-cloud.component.ts rename to lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.ts index efcf6c47ada..9f112eb47e5 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.ts @@ -17,15 +17,15 @@ import { Component, inject, ViewEncapsulation } from '@angular/core'; import { Observable } from 'rxjs'; -import { ServiceTaskFilterCloudModel, TaskFilterAction, TaskFilterProperties } from '../../models/filter-cloud.model'; -import { ServiceTaskFilterCloudService } from '../../services/service-task-filter-cloud.service'; -import { BaseEditTaskFilterCloudComponent, DropdownOption } from './base-edit-task-filter-cloud.component'; +import { ServiceTaskFilterCloudModel, TaskFilterAction, TaskFilterProperties } from '../../../models/filter-cloud.model'; +import { ServiceTaskFilterCloudService } from '../../../services/service-task-filter-cloud.service'; +import { BaseEditTaskFilterCloudComponent, DropdownOption } from '../base-edit-task-filter-cloud.component'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @Component({ selector: 'adf-cloud-edit-service-task-filter', - templateUrl: './base-edit-task-filter-cloud.component.html', - styleUrls: ['./base-edit-task-filter-cloud.component.scss'], + templateUrl: './edit-service-task-filter-cloud.component.html', + styleUrls: ['./edit-service-task-filter-cloud.component.scss'], encapsulation: ViewEncapsulation.None }) export class EditServiceTaskFilterCloudComponent extends BaseEditTaskFilterCloudComponent { @@ -62,9 +62,7 @@ export class EditServiceTaskFilterCloudComponent extends BaseEditTaskFilterCloud } protected addFilter(filterToAdd: ServiceTaskFilterCloudModel): Observable { - return this.serviceTaskFilterCloudService - .addFilter(filterToAdd) - .pipe(takeUntilDestroyed(this.destroyRef)); + return this.serviceTaskFilterCloudService.addFilter(filterToAdd).pipe(takeUntilDestroyed(this.destroyRef)); } isDisabledForDefaultFilters(action: TaskFilterAction): boolean { diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.html b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.html new file mode 100644 index 00000000000..c679e221968 --- /dev/null +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.html @@ -0,0 +1,117 @@ + + + + + {{taskFilter.name | translate}} + + {{ 'ADF_CLOUD_EDIT_TASK_FILTER.TITLE' | translate}} +
+ + + +
+
+
+ +
+ +
+
+
+ +
+
+ + + {{taskFilterProperty.label | translate}} + + + {{ propertyOption.label | translate }} + + + + + + + + + {{taskFilterProperty.label | translate}} + + + +
+
+
{{'ADF_TASK_LIST.START_TASK.FORM.ERROR.DATE'|translate}}
+ warning +
+
+
+
+ {{taskFilterProperty.label | translate}} +
+ + + + + + +
+
+
+
+
+
diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.scss b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.scss new file mode 100644 index 00000000000..012b777547c --- /dev/null +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.scss @@ -0,0 +1,97 @@ +@import 'styles/flex'; + +.adf-edit-task-filter-checkbox { + font-size: var(--theme-subheading-2-font-size); + padding-top: 10px; + text-align: center; + flex: 1 23%; +} + +.adf-edit-task-filter-date-error-container { + position: absolute; + height: 20px; + margin-top: 12px; + width: 100%; + + & > div { + display: flex; + flex-flow: row; + justify-content: flex-start; + } + + .adf-error-text { + padding-right: 8px; + height: 16px; + font-size: 10px; + line-height: 1.33; + color: var(--theme-warn-color); + width: auto; + } + + .adf-error-icon { + font-size: 16px; + color: var(--theme-warn-color); + } +} + +.adf-edit-task-filter-dateRange mat-grid-list { + width: 450px; +} + +.adf { + &-cloud-edit-task-filter-loading-margin { + margin-left: calc((100% - 100px) / 2); + margin-right: calc((100% - 100px) / 2); + } + + &-edit-task-filter-form { + flex-flow: row wrap; + display: flex; + place-content: center flex-start; + align-items: center; + + :not(:last-child) { + margin-right: 10px; + } + + mat-form-field, + adf-cloud-people, + adf-cloud-task-assignment-filter { + flex: 1 1 23%; + } + + @include layout-bp(lt-sm) { + flex-flow: column; + + :not(:last-child) { + margin-bottom: 10px; + margin-right: 0; + } + } + } + + &-edit-task-filter { + &-header { + height: var(--adf-edit-task-and-service-filter-header-height); + + &__title { + color: var(--adf-edit-task-and-service-filter-header-title-color); + } + + &__description { + color: var(--adf-edit-task-and-service-filter-header-description-color); + place-content: center space-between; + } + } + + &-content { + &__text-label { + color: var(--adf-edit-task-and-service-filter-content-text-label-color); + } + + &__select-label { + color: var(--adf-edit-task-and-service-filter-content-select-label-color); + } + } + } +} diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts similarity index 96% rename from lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.spec.ts rename to lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts index 8e0481f505e..4991d4ffda6 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts @@ -20,20 +20,20 @@ import { By } from '@angular/platform-browser'; import { AlfrescoApiService } from '@alfresco/adf-content-services'; import { MatDialog } from '@angular/material/dialog'; import { of, Subject } from 'rxjs'; -import { TASK_FILTERS_SERVICE_TOKEN } from '../../../../services/cloud-token.service'; -import { LocalPreferenceCloudService } from '../../../../services/local-preference-cloud.service'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; -import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service'; -import { fakeApplicationInstance } from '../../../../app/mock/app-model.mock'; -import { TaskFiltersCloudModule } from '../../task-filters-cloud.module'; +import { TASK_FILTERS_SERVICE_TOKEN } from '../../../../../services/cloud-token.service'; +import { LocalPreferenceCloudService } from '../../../../../services/local-preference-cloud.service'; +import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; +import { AppsProcessCloudService } from '../../../../../app/services/apps-process-cloud.service'; +import { fakeApplicationInstance } from '../../../../../app/mock/app-model.mock'; +import { TaskFiltersCloudModule } from '../../../task-filters-cloud.module'; import { EditTaskFilterCloudComponent } from './edit-task-filter-cloud.component'; -import { TaskFilterCloudService } from '../../services/task-filter-cloud.service'; -import { TaskCloudService } from '../../../services/task-cloud.service'; -import { fakeFilter } from '../../mock/task-filters-cloud.mock'; -import { DateCloudFilterType } from '../../../../models/date-cloud-filter.model'; -import { AssignmentType, TaskFilterCloudModel, TaskStatusFilter } from '../../models/filter-cloud.model'; -import { PeopleCloudModule } from '../../../../people/people-cloud.module'; -import { ProcessDefinitionCloud } from '../../../../models/process-definition-cloud.model'; +import { TaskFilterCloudService } from '../../../services/task-filter-cloud.service'; +import { TaskCloudService } from '../../../../services/task-cloud.service'; +import { fakeFilter } from '../../../mock/task-filters-cloud.mock'; +import { DateCloudFilterType } from '../../../../../models/date-cloud-filter.model'; +import { AssignmentType, TaskFilterCloudModel, TaskStatusFilter } from '../../../models/filter-cloud.model'; +import { PeopleCloudModule } from '../../../../../people/people-cloud.module'; +import { ProcessDefinitionCloud } from '../../../../../models/process-definition-cloud.model'; import { MatIconTestingModule } from '@angular/material/icon/testing'; import { mockAlfrescoApi, @@ -46,11 +46,11 @@ import { mockTaskFilterIdChange, mockTaskFilterResponse, mockTaskFilterResponseWithProcessInstanceIdNull -} from '../../mock/edit-task-filter-cloud.mock'; -import { mockFoodUsers } from '../../../../people/mock/people-cloud.mock'; -import { mockFoodGroups } from '../../../../group/mock/group-cloud.mock'; +} from '../../../mock/edit-task-filter-cloud.mock'; +import { mockFoodUsers } from '../../../../../people/mock/people-cloud.mock'; +import { mockFoodGroups } from '../../../../../group/mock/group-cloud.mock'; import { SimpleChanges } from '@angular/core'; -import { TaskFilterDialogCloudComponent } from '../task-filter-dialog/task-filter-dialog-cloud.component'; +import { TaskFilterDialogCloudComponent } from '../../task-filter-dialog/task-filter-dialog-cloud.component'; import { set } from 'date-fns'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.ts similarity index 89% rename from lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.ts rename to lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.ts index 13d20a6fc1e..8e9a04ef747 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.ts @@ -18,22 +18,17 @@ import { Component, inject, ViewEncapsulation } from '@angular/core'; import { map } from 'rxjs/operators'; import { Observable } from 'rxjs'; -import { - TaskFilterAction, - TaskFilterCloudModel, - TaskFilterProperties, - TaskStatusFilter -} from '../../models/filter-cloud.model'; -import { TaskFilterCloudService } from '../../services/task-filter-cloud.service'; -import { DateCloudFilterType } from '../../../../models/date-cloud-filter.model'; -import { BaseEditTaskFilterCloudComponent, DropdownOption } from './base-edit-task-filter-cloud.component'; +import { TaskFilterAction, TaskFilterCloudModel, TaskFilterProperties, TaskStatusFilter } from '../../../models/filter-cloud.model'; +import { TaskFilterCloudService } from '../../../services/task-filter-cloud.service'; +import { DateCloudFilterType } from '../../../../../models/date-cloud-filter.model'; +import { BaseEditTaskFilterCloudComponent, DropdownOption } from '../base-edit-task-filter-cloud.component'; import { set } from 'date-fns'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @Component({ selector: 'adf-cloud-edit-task-filter', - templateUrl: './base-edit-task-filter-cloud.component.html', - styleUrls: ['./base-edit-task-filter-cloud.component.scss'], + templateUrl: './edit-task-filter-cloud.component.html', + styleUrls: ['./edit-task-filter-cloud.component.scss'], encapsulation: ViewEncapsulation.None }) export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudComponent { @@ -51,21 +46,14 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone } protected getTaskFilterById(appName: string, id: string) { - return this.taskFilterCloudService - .getTaskFilterById(appName, id) - .pipe( - map(response => new TaskFilterCloudModel(response)) - ); + return this.taskFilterCloudService.getTaskFilterById(appName, id).pipe(map((response) => new TaskFilterCloudModel(response))); } createAndFilterProperties() { const result = super.createAndFilterProperties(); if (this.hasLastModifiedProperty()) { - return [ - ...result, - ...this.createLastModifiedProperty() - ]; + return [...result, ...this.createLastModifiedProperty()]; } return result; @@ -81,14 +69,11 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone private setLastModifiedToFilter(formValues: TaskFilterCloudModel) { if (formValues.lastModifiedTo && Date.parse(formValues.lastModifiedTo.toString())) { - const lastModifiedToFilterValue = set( - new Date(formValues.lastModifiedTo), - { - hours: 23, - minutes: 59, - seconds: 59 - } - ); + const lastModifiedToFilterValue = set(new Date(formValues.lastModifiedTo), { + hours: 23, + minutes: 59, + seconds: 59 + }); formValues.lastModifiedTo = lastModifiedToFilterValue.toISOString(); } } @@ -102,9 +87,7 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone } protected addFilter(filterToAdd: TaskFilterCloudModel): Observable { - return this.taskFilterCloudService - .addFilter(filterToAdd) - .pipe(takeUntilDestroyed(this.destroyRef)); + return this.taskFilterCloudService.addFilter(filterToAdd).pipe(takeUntilDestroyed(this.destroyRef)); } isDisabledForDefaultFilters(action: TaskFilterAction): boolean { @@ -250,7 +233,7 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.DUE_DATE', type: 'date-range', key: 'dueDateRange', - attributes: { dateType: 'dueDateType', from: '_dueDateFrom', to: '_dueDateTo'}, + attributes: { dateType: 'dueDateType', from: '_dueDateFrom', to: '_dueDateTo' }, value: { dueDateType: this.taskFilter.dueDateType || null, _dueDateFrom: this.taskFilter.dueDateFrom || null, @@ -268,7 +251,7 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.COMPLETED_DATE', type: 'date-range', key: 'completedDateRange', - attributes: { dateType: 'completedDateType', from: '_completedFrom', to: '_completedTo'}, + attributes: { dateType: 'completedDateType', from: '_completedFrom', to: '_completedTo' }, value: { completedDateType: this.taskFilter.completedDateType || null, _completedFrom: this.taskFilter.completedFrom || null, @@ -279,7 +262,7 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.CREATED_DATE', type: 'date-range', key: 'createdDateRange', - attributes: { dateType: 'createdDateType', from: '_createdFrom', to: '_createdTo'}, + attributes: { dateType: 'createdDateType', from: '_createdFrom', to: '_createdTo' }, value: { createdDateType: this.taskFilter.createdDateType || null, _createdFrom: this.taskFilter.createdFrom || null, @@ -297,7 +280,7 @@ export class EditTaskFilterCloudComponent extends BaseEditTaskFilterCloudCompone label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.ASSIGNMENT', type: 'assignment', key: 'assignment', - attributes: { assignedUsers: 'assignedUsers', candidateGroups: 'candidateGroups'}, + attributes: { assignedUsers: 'assignedUsers', candidateGroups: 'candidateGroups' }, value: { assignedUsers: this.taskFilter.assignedUsers || [], candidateGroups: this.taskFilter.candidateGroups || [] diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/base-task-filters-cloud.component.html b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.html similarity index 100% rename from lib/process-services-cloud/src/lib/task/task-filters/components/base-task-filters-cloud.component.html rename to lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.html diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/base-task-filters-cloud.component.scss b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.scss similarity index 100% rename from lib/process-services-cloud/src/lib/task/task-filters/components/base-task-filters-cloud.component.scss rename to lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.scss diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts similarity index 94% rename from lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters-cloud.component.spec.ts rename to lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts index d8f6addf3f4..9e24ef48d43 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts @@ -18,13 +18,13 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of, throwError } from 'rxjs'; -import { TASK_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service'; -import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service'; +import { TASK_FILTERS_SERVICE_TOKEN } from '../../../../services/cloud-token.service'; +import { LocalPreferenceCloudService } from '../../../../services/local-preference-cloud.service'; import { By } from '@angular/platform-browser'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; -import { TaskFiltersCloudModule } from '../task-filters-cloud.module'; -import { fakeGlobalServiceFilters } from '../mock/task-filters-cloud.mock'; -import { ServiceTaskFilterCloudService } from '../services/service-task-filter-cloud.service'; +import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; +import { TaskFiltersCloudModule } from '../../task-filters-cloud.module'; +import { fakeGlobalServiceFilters } from '../../mock/task-filters-cloud.mock'; +import { ServiceTaskFilterCloudService } from '../../services/service-task-filter-cloud.service'; import { ServiceTaskFiltersCloudComponent } from './service-task-filters-cloud.component'; describe('ServiceTaskFiltersCloudComponent', () => { diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.ts similarity index 91% rename from lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters-cloud.component.ts rename to lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.ts index 7b95849f46d..578f102ff36 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.ts @@ -15,27 +15,18 @@ * limitations under the License. */ -import { - Component, - EventEmitter, - inject, - OnChanges, - OnInit, - Output, - SimpleChanges, - ViewEncapsulation -} from '@angular/core'; +import { Component, EventEmitter, inject, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { Observable } from 'rxjs'; -import { FilterParamsModel, ServiceTaskFilterCloudModel } from '../models/filter-cloud.model'; -import { BaseTaskFiltersCloudComponent } from './base-task-filters-cloud.component'; -import { ServiceTaskFilterCloudService } from '../services/service-task-filter-cloud.service'; +import { FilterParamsModel, ServiceTaskFilterCloudModel } from '../../models/filter-cloud.model'; +import { BaseTaskFiltersCloudComponent } from '../base-task-filters-cloud.component'; +import { ServiceTaskFilterCloudService } from '../../services/service-task-filter-cloud.service'; import { TranslationService } from '@alfresco/adf-core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @Component({ selector: 'adf-cloud-service-task-filters', - templateUrl: './base-task-filters-cloud.component.html', - styleUrls: ['./base-task-filters-cloud.component.scss'], + templateUrl: './service-task-filters-cloud.component.html', + styleUrls: ['./service-task-filters-cloud.component.scss'], encapsulation: ViewEncapsulation.None }) export class ServiceTaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent implements OnInit, OnChanges { diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.html b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.html new file mode 100644 index 00000000000..48e2a7d9f8f --- /dev/null +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.html @@ -0,0 +1,35 @@ + + + + + +
+ +
+
+
diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.scss b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.scss new file mode 100644 index 00000000000..4533107f4a3 --- /dev/null +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.scss @@ -0,0 +1,39 @@ +.adf-task-filters { + margin-right: calc(-1 * var(--adf-theme-spacing)); + + &__entry { + font-size: var(--theme-body-1-font-size); + color: var(--adf-theme-foreground-text-color-054); + display: flex; + justify-content: space-between; + align-items: center; + flex: 1; + height: 100%; + + &:hover { + color: var(--theme-primary-color); + } + } + + &__entry-label { + display: flex; + flex: 1; + align-items: center; + gap: var(--adf-theme-spacing); + } + + &__entry-counter { + padding: 0 5px; + border-radius: 15px; + + &.adf-active { + background-color: var(--theme-accent-color); + color: var(--theme-accent-color-default-contrast); + font-size: smaller; + } + } + + .adf-active .adf-task-filters__entry-label { + color: var(--theme-primary-color); + } +} diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts similarity index 97% rename from lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.spec.ts rename to lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts index f1eae314406..e78636d7276 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts @@ -20,18 +20,18 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed, fakeAsync } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { first, of, throwError } from 'rxjs'; -import { TASK_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service'; -import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; -import { defaultTaskFiltersMock, fakeGlobalFilter, taskNotifications } from '../mock/task-filters-cloud.mock'; -import { TaskFilterCloudService } from '../services/task-filter-cloud.service'; -import { TaskFiltersCloudModule } from '../task-filters-cloud.module'; +import { TASK_FILTERS_SERVICE_TOKEN } from '../../../../services/cloud-token.service'; +import { LocalPreferenceCloudService } from '../../../../services/local-preference-cloud.service'; +import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; +import { defaultTaskFiltersMock, fakeGlobalFilter, taskNotifications } from '../../mock/task-filters-cloud.mock'; +import { TaskFilterCloudService } from '../../services/task-filter-cloud.service'; +import { TaskFiltersCloudModule } from '../../task-filters-cloud.module'; import { TaskFiltersCloudComponent } from './task-filters-cloud.component'; -import { TaskListCloudService } from '../../task-list/services/task-list-cloud.service'; +import { TaskListCloudService } from '../../../task-list/services/task-list-cloud.service'; import { HarnessLoader } from '@angular/cdk/testing'; import { MatActionListItemHarness } from '@angular/material/list/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; -import { TaskFilterCloudAdapter } from '../../../models/filter-cloud-model'; +import { TaskFilterCloudAdapter } from '../../../../models/filter-cloud-model'; describe('TaskFiltersCloudComponent', () => { let loader: HarnessLoader; diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts similarity index 93% rename from lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts rename to lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts index 60827ba1e57..eb591667122 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts @@ -17,21 +17,21 @@ import { Component, EventEmitter, inject, Input, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core'; import { Observable } from 'rxjs'; -import { TaskFilterCloudService } from '../services/task-filter-cloud.service'; -import { FilterParamsModel, TaskFilterCloudModel } from '../models/filter-cloud.model'; +import { TaskFilterCloudService } from '../../services/task-filter-cloud.service'; +import { FilterParamsModel, TaskFilterCloudModel } from '../../models/filter-cloud.model'; import { AppConfigService, TranslationService } from '@alfresco/adf-core'; import { debounceTime, tap } from 'rxjs/operators'; -import { BaseTaskFiltersCloudComponent } from './base-task-filters-cloud.component'; -import { TaskDetailsCloudModel } from '../../models/task-details-cloud.model'; -import { TaskCloudEngineEvent } from '../../../models/engine-event-cloud.model'; -import { TaskListCloudService } from '../../task-list/services/task-list-cloud.service'; -import { TaskFilterCloudAdapter } from '../../../models/filter-cloud-model'; +import { BaseTaskFiltersCloudComponent } from '../base-task-filters-cloud.component'; +import { TaskDetailsCloudModel } from '../../../models/task-details-cloud.model'; +import { TaskCloudEngineEvent } from '../../../../models/engine-event-cloud.model'; +import { TaskListCloudService } from '../../../task-list/services/task-list-cloud.service'; +import { TaskFilterCloudAdapter } from '../../../../models/filter-cloud-model'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @Component({ selector: 'adf-cloud-task-filters', - templateUrl: './base-task-filters-cloud.component.html', - styleUrls: ['./base-task-filters-cloud.component.scss'], + templateUrl: './task-filters-cloud.component.html', + styleUrls: ['./task-filters-cloud.component.scss'], encapsulation: ViewEncapsulation.None }) export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent implements OnInit, OnChanges { diff --git a/lib/process-services-cloud/src/lib/task/task-filters/public-api.ts b/lib/process-services-cloud/src/lib/task/task-filters/public-api.ts index 4a7d9f2c065..3a296f94b9a 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/public-api.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/public-api.ts @@ -15,10 +15,10 @@ * limitations under the License. */ -export * from './components/task-filters-cloud.component'; -export * from './components/service-task-filters-cloud.component'; -export * from './components/edit-task-filters/edit-task-filter-cloud.component'; -export * from './components/edit-task-filters/edit-service-task-filter-cloud.component'; +export * from './components/task-filters/task-filters-cloud.component'; +export * from './components/service-task-filters/service-task-filters-cloud.component'; +export * from './components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component'; +export * from './components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component'; export * from './models/filter-cloud.model'; diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index 32ac93bf750..476fb9e1e0b 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -18,16 +18,16 @@ import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; -import { TaskFiltersCloudComponent } from './components/task-filters-cloud.component'; +import { TaskFiltersCloudComponent } from './components/task-filters/task-filters-cloud.component'; import { MaterialModule } from '../../material.module'; import { CoreModule } from '@alfresco/adf-core'; import { HttpClientModule } from '@angular/common/http'; import { ProcessCommonModule } from '../../common/process-common.module'; import { PeopleCloudModule } from '../../people/people-cloud.module'; -import { EditServiceTaskFilterCloudComponent } from './components/edit-task-filters/edit-service-task-filter-cloud.component'; -import { EditTaskFilterCloudComponent } from './components/edit-task-filters/edit-task-filter-cloud.component'; +import { EditServiceTaskFilterCloudComponent } from './components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component'; +import { EditTaskFilterCloudComponent } from './components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component'; import { TaskFilterDialogCloudComponent } from './components/task-filter-dialog/task-filter-dialog-cloud.component'; -import { ServiceTaskFiltersCloudComponent } from './components/service-task-filters-cloud.component'; +import { ServiceTaskFiltersCloudComponent } from './components/service-task-filters/service-task-filters-cloud.component'; import { TaskAssignmentFilterCloudComponent } from './components/task-assignment-filter/task-assignment-filter.component'; import { GroupCloudModule } from '../../group/group-cloud.module'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; From bd9b77928bd8d13f6beb4c7f4f93a026745829b4 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 11:03:02 -0500 Subject: [PATCH 05/30] TaskFilterDialogCloudComponent --- ...task-filter-dialog-cloud.component.spec.ts | 2 +- .../task-filter-dialog-cloud.component.ts | 24 ++++++++++++------- .../task-filters/task-filters-cloud.module.ts | 4 ++-- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts index 3681ccad494..3d369020011 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts @@ -36,7 +36,7 @@ describe('TaskFilterDialogCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule], + imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, TaskFilterDialogCloudComponent], providers: [ { provide: MatDialogRef, useValue: mockDialogRef }, { provide: MAT_DIALOG_DATA, useValue: mockDialogData } diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.ts index f36ef366ff5..234c86e8b9d 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.ts @@ -16,17 +16,23 @@ */ import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core'; -import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { AbstractControl, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; +import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog'; +import { AbstractControl, ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { MatInputModule } from '@angular/material/input'; +import { MatCardModule } from '@angular/material/card'; +import { MatButtonModule } from '@angular/material/button'; @Component({ - selector: 'adf-cloud-task-filter-dialog', - templateUrl: './task-filter-dialog-cloud.component.html', - styleUrls: ['./task-filter-dialog-cloud.component.scss'], - encapsulation: ViewEncapsulation.None + selector: 'adf-cloud-task-filter-dialog', + standalone: true, + imports: [CommonModule, TranslateModule, MatInputModule, ReactiveFormsModule, MatDialogModule, MatCardModule, MatButtonModule], + templateUrl: './task-filter-dialog-cloud.component.html', + styleUrls: ['./task-filter-dialog-cloud.component.scss'], + encapsulation: ViewEncapsulation.None }) export class TaskFilterDialogCloudComponent implements OnInit { - // eslint-disable-next-line @typescript-eslint/naming-convention public static ACTION_SAVE = 'SAVE'; defaultIcon = 'inbox'; @@ -36,8 +42,8 @@ export class TaskFilterDialogCloudComponent implements OnInit { constructor( private fb: UntypedFormBuilder, public dialogRef: MatDialogRef, - @Inject(MAT_DIALOG_DATA) public data) { - } + @Inject(MAT_DIALOG_DATA) public data + ) {} ngOnInit() { this.filterForm = this.fb.group({ diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index 476fb9e1e0b..def77b60ec2 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -45,14 +45,14 @@ import { APP_LIST_CLOUD_DIRECTIVES } from '../../app/app-list-cloud.module'; GroupCloudModule, ProcessCommonModule, PeopleCloudModule, - MatProgressSpinnerModule + MatProgressSpinnerModule, + TaskFilterDialogCloudComponent ], declarations: [ TaskFiltersCloudComponent, ServiceTaskFiltersCloudComponent, EditTaskFilterCloudComponent, EditServiceTaskFilterCloudComponent, - TaskFilterDialogCloudComponent, TaskAssignmentFilterCloudComponent ], exports: [TaskFiltersCloudComponent, ServiceTaskFiltersCloudComponent, EditTaskFilterCloudComponent, EditServiceTaskFilterCloudComponent] From eee53aa2c6917c69a4a6c32c96033a8b837a3959 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 11:27:15 -0500 Subject: [PATCH 06/30] TaskFiltersCloudComponent --- .../task-filters/task-filters-cloud.component.spec.ts | 2 +- .../task-filters/task-filters-cloud.component.ts | 8 +++++++- .../lib/task/task-filters/task-filters-cloud.module.ts | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts index e78636d7276..1a8d115893d 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts @@ -47,7 +47,7 @@ describe('TaskFiltersCloudComponent', () => { const configureTestingModule = (searchApiMethod: 'GET' | 'POST') => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule], + imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, TaskFiltersCloudComponent], providers: [{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); taskFilterService = TestBed.inject(TaskFilterCloudService); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts index eb591667122..a491a1379d0 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts @@ -19,7 +19,7 @@ import { Component, EventEmitter, inject, Input, OnChanges, OnInit, Output, Simp import { Observable } from 'rxjs'; import { TaskFilterCloudService } from '../../services/task-filter-cloud.service'; import { FilterParamsModel, TaskFilterCloudModel } from '../../models/filter-cloud.model'; -import { AppConfigService, TranslationService } from '@alfresco/adf-core'; +import { AppConfigService, IconComponent, TranslationService } from '@alfresco/adf-core'; import { debounceTime, tap } from 'rxjs/operators'; import { BaseTaskFiltersCloudComponent } from '../base-task-filters-cloud.component'; import { TaskDetailsCloudModel } from '../../../models/task-details-cloud.model'; @@ -27,9 +27,15 @@ import { TaskCloudEngineEvent } from '../../../../models/engine-event-cloud.mode import { TaskListCloudService } from '../../../task-list/services/task-list-cloud.service'; import { TaskFilterCloudAdapter } from '../../../../models/filter-cloud-model'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { TranslateModule } from '@ngx-translate/core'; +import { CommonModule } from '@angular/common'; +import { MatListModule } from '@angular/material/list'; @Component({ selector: 'adf-cloud-task-filters', + standalone: true, + imports: [CommonModule, MatProgressSpinnerModule, TranslateModule, IconComponent, MatListModule], templateUrl: './task-filters-cloud.component.html', styleUrls: ['./task-filters-cloud.component.scss'], encapsulation: ViewEncapsulation.None diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index def77b60ec2..18e729c8629 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -46,10 +46,10 @@ import { APP_LIST_CLOUD_DIRECTIVES } from '../../app/app-list-cloud.module'; ProcessCommonModule, PeopleCloudModule, MatProgressSpinnerModule, - TaskFilterDialogCloudComponent + TaskFilterDialogCloudComponent, + TaskFiltersCloudComponent ], declarations: [ - TaskFiltersCloudComponent, ServiceTaskFiltersCloudComponent, EditTaskFilterCloudComponent, EditServiceTaskFilterCloudComponent, From 492947b7b60061fa9642cde56f2f7a0135baa5da Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 11:51:43 -0500 Subject: [PATCH 07/30] reduce group initial pipe --- docs/README.md | 6 --- .../pipes/group-initial.pipe.md | 33 --------------- .../components/group-cloud.component.html | 2 +- .../group/components/group-cloud.component.ts | 9 ++++ .../src/lib/group/group-cloud.module.ts | 6 +-- .../src/lib/group/mock/group-cloud.mock.ts | 15 ++----- .../lib/group/pipe/group-initial.pipe.spec.ts | 41 ------------------- .../src/lib/group/pipe/group-initial.pipe.ts | 38 ----------------- .../src/lib/group/public-api.ts | 1 - 9 files changed, 16 insertions(+), 135 deletions(-) delete mode 100644 docs/process-services-cloud/pipes/group-initial.pipe.md delete mode 100644 lib/process-services-cloud/src/lib/group/pipe/group-initial.pipe.spec.ts delete mode 100644 lib/process-services-cloud/src/lib/group/pipe/group-initial.pipe.ts diff --git a/docs/README.md b/docs/README.md index d5be727be52..c042392623c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -502,12 +502,6 @@ Status: Experimental | [Source](<>) | | [Complete Task Directive](process-services-cloud/directives/complete-task.directive.md) ![Experimental](docassets/images/ExperimentalIcon.png) | Completes a task. | [Source](../lib/process-services-cloud/src/lib/task/directives/complete-task.directive.ts) | | [Unclaim Task Cloud Directive](process-services-cloud/directives/unclaim-task-cloud.directive.md) ![Experimental](docassets/images/ExperimentalIcon.png) | Unclaims a task | [Source](../lib/process-services-cloud/src/lib/task/directives/unclaim-task-cloud.directive.ts) | -### Pipes - -| Name | Description | Source link | -| ---- | ----------- | ----------- | -| [Group initial pipe](process-services-cloud/pipes/group-initial.pipe.md) | Extracts the initial character from a group name. | [Source](../lib/process-services-cloud/src/lib/group/pipe/group-initial.pipe.ts) | - ### Services | Name | Description | Source link | diff --git a/docs/process-services-cloud/pipes/group-initial.pipe.md b/docs/process-services-cloud/pipes/group-initial.pipe.md deleted file mode 100644 index 1616b489e3c..00000000000 --- a/docs/process-services-cloud/pipes/group-initial.pipe.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -Title: Group initial pipe -Added: v3.0.0 -Status: Active -Last reviewed: 2019-01-17 ---- - -# [Group initial pipe](../../../lib/process-services-cloud/src/lib/group/pipe/group-initial.pipe.ts "Defined in group-initial.pipe.ts") - -Extracts the initial character from a group name. - -## Basic Usage - - - -```HTML -
- Group: {{ currentGroup | groupNameInitial }} -
-``` - - - -## Details - -This pipe takes a [`IdentityGroupModel`](../../../lib/process-services-cloud/src/lib/group/models/identity-group.model.ts) -object as its parameter and extracts the initial character from the `name` -property. The initial is a handy way to identify the group in lists and -other situations where there is limited screen space available. - -## See also - -- [Group cloud component](../components/group-cloud.component.md) diff --git a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.html b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.html index f949b7f99b8..09931d4d212 100644 --- a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.html +++ b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.html @@ -43,7 +43,7 @@ class="adf-cloud-group-row" id="adf-group-{{i}}" data-automation-id="adf-cloud-group-row"> - + {{group.name}} diff --git a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts index fd98e26abf6..13947aec442 100644 --- a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts @@ -470,4 +470,13 @@ export class GroupCloudComponent implements OnInit, OnChanges { getValidationMinLength(): string { return this.searchGroupsControl.errors.minlength.requiredLength; } + + getGroupNameInitials(group: IdentityGroupModel): string { + let result = ''; + if (group) { + const groupName = group.name; + result = (groupName ? groupName[0] : '').toUpperCase(); + } + return result; + } } diff --git a/lib/process-services-cloud/src/lib/group/group-cloud.module.ts b/lib/process-services-cloud/src/lib/group/group-cloud.module.ts index 60f1885408c..1c832aede9d 100644 --- a/lib/process-services-cloud/src/lib/group/group-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/group/group-cloud.module.ts @@ -18,19 +18,17 @@ import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common'; - import { CoreModule } from '@alfresco/adf-core'; import { MaterialModule } from '../material.module'; import { GroupCloudComponent } from './components/group-cloud.component'; -import { InitialGroupNamePipe } from './pipe/group-initial.pipe'; import { IDENTITY_GROUP_SERVICE_TOKEN } from './services/identity-group-service.token'; import { IdentityGroupService } from './services/identity-group.service'; import { MatProgressBarModule } from '@angular/material/progress-bar'; @NgModule({ imports: [CommonModule, MaterialModule, FormsModule, ReactiveFormsModule, CoreModule, MatProgressBarModule], - declarations: [GroupCloudComponent, InitialGroupNamePipe], + declarations: [GroupCloudComponent], providers: [{ provide: IDENTITY_GROUP_SERVICE_TOKEN, useExisting: IdentityGroupService }], - exports: [GroupCloudComponent, InitialGroupNamePipe] + exports: [GroupCloudComponent] }) export class GroupCloudModule {} diff --git a/lib/process-services-cloud/src/lib/group/mock/group-cloud.mock.ts b/lib/process-services-cloud/src/lib/group/mock/group-cloud.mock.ts index f42c7760b9e..1d0838ee099 100644 --- a/lib/process-services-cloud/src/lib/group/mock/group-cloud.mock.ts +++ b/lib/process-services-cloud/src/lib/group/mock/group-cloud.mock.ts @@ -21,15 +21,10 @@ import { IdentityGroupModel } from '../models/identity-group.model'; import { IdentityGroupFilterInterface } from '../services/identity-group-filter.interface'; import { IdentityGroupServiceInterface } from '../services/identity-group.service.interface'; -export const mockVegetableAubergine: IdentityGroupModel = { id: 'aubergine', name: 'Vegetable Aubergine'}; -export const mockMeatChicken: IdentityGroupModel = { id: 'chicken', name: 'Meat Chicken'}; +export const mockVegetableAubergine: IdentityGroupModel = { id: 'aubergine', name: 'Vegetable Aubergine' }; +export const mockMeatChicken: IdentityGroupModel = { id: 'chicken', name: 'Meat Chicken' }; -export const mockFoodGroups = [ mockVegetableAubergine, mockMeatChicken ]; - -export const mockSearchGroupEmptyFilters: IdentityGroupFilterInterface = { - roles: [], - withinApplication: '' -}; +export const mockFoodGroups = [mockVegetableAubergine, mockMeatChicken]; @Injectable({ providedIn: 'root' @@ -40,8 +35,6 @@ export class IdentityGroupServiceMock implements IdentityGroupServiceInterface { return EMPTY; } - return of(mockFoodGroups.filter(group => - group.name.toUpperCase().includes(name.toUpperCase()) - )); + return of(mockFoodGroups.filter((group) => group.name.toUpperCase().includes(name.toUpperCase()))); } } diff --git a/lib/process-services-cloud/src/lib/group/pipe/group-initial.pipe.spec.ts b/lib/process-services-cloud/src/lib/group/pipe/group-initial.pipe.spec.ts deleted file mode 100644 index 7c737853701..00000000000 --- a/lib/process-services-cloud/src/lib/group/pipe/group-initial.pipe.spec.ts +++ /dev/null @@ -1,41 +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. - */ - -import { IdentityGroupModel } from '../models/identity-group.model'; -import { InitialGroupNamePipe } from './group-initial.pipe'; - -describe('InitialGroupNamePipe', () => { - - let pipe: InitialGroupNamePipe; - let fakeGroup: IdentityGroupModel; - - beforeEach(() => { - pipe = new InitialGroupNamePipe(); - fakeGroup = {name: 'mock'}; - }); - - it('should return with the group initial', () => { - fakeGroup.name = 'FAKE-GROUP-NAME'; - const result = pipe.transform(fakeGroup); - expect(result).toBe('F'); - }); - - it('should return an empty string when group is null', () => { - const result = pipe.transform(null); - expect(result).toBe(''); - }); -}); diff --git a/lib/process-services-cloud/src/lib/group/pipe/group-initial.pipe.ts b/lib/process-services-cloud/src/lib/group/pipe/group-initial.pipe.ts deleted file mode 100644 index cb9e83a2f0a..00000000000 --- a/lib/process-services-cloud/src/lib/group/pipe/group-initial.pipe.ts +++ /dev/null @@ -1,38 +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. - */ - -import { Pipe, PipeTransform } from '@angular/core'; -import { IdentityGroupModel } from '../models/identity-group.model'; - -@Pipe({ - name: 'groupNameInitial' -}) -export class InitialGroupNamePipe implements PipeTransform { - - transform(group: IdentityGroupModel): string { - let result = ''; - if (group) { - result = this.getInitialGroupName(group.name).toUpperCase(); - } - return result; - } - - getInitialGroupName(groupName: string) { - groupName = (groupName ? groupName[0] : ''); - return groupName; - } -} diff --git a/lib/process-services-cloud/src/lib/group/public-api.ts b/lib/process-services-cloud/src/lib/group/public-api.ts index 4e4fe249af4..3ea175ecd5f 100644 --- a/lib/process-services-cloud/src/lib/group/public-api.ts +++ b/lib/process-services-cloud/src/lib/group/public-api.ts @@ -16,7 +16,6 @@ */ export * from './components/group-cloud.component'; -export * from './pipe/group-initial.pipe'; export * from './models/identity-group.model'; export * from './group-cloud.module'; export * from './services/identity-group.service'; From 581e945d34d853b0b72703f1ccf62bbbef01a579 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 12:03:58 -0500 Subject: [PATCH 08/30] group component --- .../widgets/group/group-cloud.widget.ts | 4 +-- .../components/group-cloud.component.spec.ts | 3 +- .../group-cloud.component.stories.ts | 12 +++----- .../group/components/group-cloud.component.ts | 28 ++++++++++++++++++- .../src/lib/group/group-cloud.module.ts | 12 ++------ .../src/lib/process-services-cloud.module.ts | 6 ++-- .../task-assignment-filter.component.spec.ts | 4 +-- .../task-filters/task-filters-cloud.module.ts | 4 +-- 8 files changed, 43 insertions(+), 30 deletions(-) diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/group/group-cloud.widget.ts b/lib/process-services-cloud/src/lib/form/components/widgets/group/group-cloud.widget.ts index 9b66e3f4c28..3290e917590 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/group/group-cloud.widget.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/group/group-cloud.widget.ts @@ -24,14 +24,14 @@ import { IdentityGroupModel } from '../../../../group/models/identity-group.mode import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { CommonModule } from '@angular/common'; import { TranslateModule } from '@ngx-translate/core'; -import { GroupCloudModule } from '../../../../group/group-cloud.module'; +import { GroupCloudComponent } from '../../../../group/components/group-cloud.component'; /* eslint-disable @angular-eslint/component-selector */ @Component({ selector: 'group-cloud-widget', standalone: true, - imports: [CommonModule, TranslateModule, ErrorWidgetComponent, GroupCloudModule], + imports: [CommonModule, TranslateModule, ErrorWidgetComponent, GroupCloudComponent], templateUrl: './group-cloud.widget.html', host: { '(click)': 'event($event)', diff --git a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts index 4e05efb860b..e4d95f27213 100644 --- a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts @@ -18,7 +18,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { of } from 'rxjs'; -import { GroupCloudModule } from '../group-cloud.module'; import { GroupCloudComponent } from './group-cloud.component'; import { CoreTestingModule } from '@alfresco/adf-core'; import { DebugElement, SimpleChange } from '@angular/core'; @@ -72,7 +71,7 @@ describe('GroupCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, GroupCloudModule] + imports: [CoreTestingModule, GroupCloudComponent] }); fixture = TestBed.createComponent(GroupCloudComponent); component = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.stories.ts b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.stories.ts index 0c493406248..ec3b5465e68 100644 --- a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.stories.ts +++ b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.stories.ts @@ -16,7 +16,6 @@ */ import { applicationConfig, Meta, moduleMetadata, StoryFn } from '@storybook/angular'; -import { GroupCloudModule } from '../group-cloud.module'; import { GroupCloudComponent } from './group-cloud.component'; import { ProcessServicesCloudStoryModule } from '../../testing/process-services-cloud-story.module'; import { IdentityGroupService } from '../services/identity-group.service'; @@ -28,13 +27,10 @@ export default { title: 'Process Services Cloud/Group Cloud/Group Cloud', decorators: [ moduleMetadata({ - imports: [GroupCloudModule] + imports: [GroupCloudComponent] }), applicationConfig({ - providers: [ - { provide: IdentityGroupService, useClass: IdentityGroupServiceMock }, - importProvidersFrom(ProcessServicesCloudStoryModule) - ] + providers: [{ provide: IdentityGroupService, useClass: IdentityGroupServiceMock }, importProvidersFrom(ProcessServicesCloudStoryModule)] }) ], argTypes: { @@ -102,7 +98,7 @@ export default { description: 'FormControl to list of group.', table: { type: { summary: 'FormControl' }, - defaultValue: { summary: 'new FormControl({ value: \'\', disabled: false })' }, + defaultValue: { summary: "new FormControl({ value: '', disabled: false })" }, category: 'Form Controls' } }, @@ -111,7 +107,7 @@ export default { description: 'FormControl to search the group.', table: { type: { summary: 'FormControl' }, - defaultValue: { summary: 'new FormControl({ value: \'\', disabled: false })' }, + defaultValue: { summary: "new FormControl({ value: '', disabled: false })" }, category: 'Form Controls' } }, diff --git a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts index 13947aec442..a3df9818237 100644 --- a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts @@ -30,7 +30,7 @@ import { ViewChild, ViewEncapsulation } from '@angular/core'; -import { UntypedFormControl } from '@angular/forms'; +import { ReactiveFormsModule, UntypedFormControl } from '@angular/forms'; import { animate, state, style, transition, trigger } from '@angular/animations'; import { BehaviorSubject, Observable } from 'rxjs'; import { debounceTime, distinctUntilChanged, filter, mergeMap, switchMap, tap } from 'rxjs/operators'; @@ -39,9 +39,35 @@ import { IdentityGroupModel } from '../models/identity-group.model'; import { IdentityGroupServiceInterface } from '../services/identity-group.service.interface'; import { IDENTITY_GROUP_SERVICE_TOKEN } from '../services/identity-group-service.token'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { MatIconModule } from '@angular/material/icon'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { MatSelectModule } from '@angular/material/select'; +import { MatAutocompleteModule } from '@angular/material/autocomplete'; +import { MatButtonModule } from '@angular/material/button'; +import { MatInputModule } from '@angular/material/input'; +import { MatChipsModule } from '@angular/material/chips'; +import { IdentityGroupService } from '../services/identity-group.service'; @Component({ selector: 'adf-cloud-group', + standalone: true, + imports: [ + CommonModule, + TranslateModule, + MatIconModule, + MatFormFieldModule, + MatProgressBarModule, + MatSelectModule, + MatAutocompleteModule, + MatButtonModule, + ReactiveFormsModule, + MatInputModule, + MatChipsModule + ], + providers: [{ provide: IDENTITY_GROUP_SERVICE_TOKEN, useExisting: IdentityGroupService }], templateUrl: './group-cloud.component.html', styleUrls: ['./group-cloud.component.scss'], animations: [ diff --git a/lib/process-services-cloud/src/lib/group/group-cloud.module.ts b/lib/process-services-cloud/src/lib/group/group-cloud.module.ts index 1c832aede9d..5041bceec5b 100644 --- a/lib/process-services-cloud/src/lib/group/group-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/group/group-cloud.module.ts @@ -16,19 +16,11 @@ */ import { NgModule } from '@angular/core'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { CommonModule } from '@angular/common'; -import { CoreModule } from '@alfresco/adf-core'; -import { MaterialModule } from '../material.module'; import { GroupCloudComponent } from './components/group-cloud.component'; -import { IDENTITY_GROUP_SERVICE_TOKEN } from './services/identity-group-service.token'; -import { IdentityGroupService } from './services/identity-group.service'; -import { MatProgressBarModule } from '@angular/material/progress-bar'; +/** @deprecated use GroupCloudComponent instead */ @NgModule({ - imports: [CommonModule, MaterialModule, FormsModule, ReactiveFormsModule, CoreModule, MatProgressBarModule], - declarations: [GroupCloudComponent], - providers: [{ provide: IDENTITY_GROUP_SERVICE_TOKEN, useExisting: IdentityGroupService }], + imports: [GroupCloudComponent], exports: [GroupCloudComponent] }) export class GroupCloudModule {} diff --git a/lib/process-services-cloud/src/lib/process-services-cloud.module.ts b/lib/process-services-cloud/src/lib/process-services-cloud.module.ts index 41cea65ca6c..dfecadf46b5 100644 --- a/lib/process-services-cloud/src/lib/process-services-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process-services-cloud.module.ts @@ -20,7 +20,6 @@ import { CoreModule, FormRenderingService, provideTranslations } from '@alfresco import { APP_LIST_CLOUD_DIRECTIVES } from './app/app-list-cloud.module'; import { TaskCloudModule } from './task/task-cloud.module'; import { ProcessCloudModule } from './process/process-cloud.module'; -import { GroupCloudModule } from './group/group-cloud.module'; import { FORM_CLOUD_DIRECTIVES } from './form/form-cloud.module'; import { TaskFormModule } from './task/task-form/task-form.module'; import { @@ -35,6 +34,7 @@ import { PeopleCloudModule } from './people/people-cloud.module'; import { CloudFormRenderingService } from './form/components/cloud-form-rendering.service'; import { ApolloModule } from 'apollo-angular'; import { RichTextEditorComponent } from './rich-text-editor'; +import { GroupCloudComponent } from './group/components/group-cloud.component'; @NgModule({ imports: [ @@ -42,7 +42,7 @@ import { RichTextEditorComponent } from './rich-text-editor'; ...APP_LIST_CLOUD_DIRECTIVES, ProcessCloudModule, TaskCloudModule, - GroupCloudModule, + GroupCloudComponent, PeopleCloudModule, ...FORM_CLOUD_DIRECTIVES, TaskFormModule, @@ -54,7 +54,7 @@ import { RichTextEditorComponent } from './rich-text-editor'; ...APP_LIST_CLOUD_DIRECTIVES, ProcessCloudModule, TaskCloudModule, - GroupCloudModule, + GroupCloudComponent, ...FORM_CLOUD_DIRECTIVES, TaskFormModule, PeopleCloudModule, diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts index 8c00b6dd44d..bad2bc2a4d0 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts @@ -17,7 +17,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TaskAssignmentFilterCloudComponent } from './task-assignment-filter.component'; -import { GroupCloudModule } from '../../../../group/group-cloud.module'; import { TaskFiltersCloudModule } from '../../task-filters-cloud.module'; import { AssignmentType, TaskStatusFilter } from '../../models/filter-cloud.model'; import { IdentityUserService } from '../../../../people/services/identity-user.service'; @@ -30,6 +29,7 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatSelectHarness } from '@angular/material/select/testing'; import { MatFormFieldHarness } from '@angular/material/form-field/testing'; import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; +import { GroupCloudComponent } from '@alfresco/adf-process-services-cloud'; describe('TaskAssignmentFilterComponent', () => { let component: TaskAssignmentFilterCloudComponent; @@ -58,7 +58,7 @@ describe('TaskAssignmentFilterComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, GroupCloudModule, TaskFiltersCloudModule] + imports: [ProcessServiceCloudTestingModule, GroupCloudComponent, TaskFiltersCloudModule] }); }); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index 18e729c8629..6d2f3db2e8e 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -29,9 +29,9 @@ import { EditTaskFilterCloudComponent } from './components/edit-task-filters/edi import { TaskFilterDialogCloudComponent } from './components/task-filter-dialog/task-filter-dialog-cloud.component'; import { ServiceTaskFiltersCloudComponent } from './components/service-task-filters/service-task-filters-cloud.component'; import { TaskAssignmentFilterCloudComponent } from './components/task-assignment-filter/task-assignment-filter.component'; -import { GroupCloudModule } from '../../group/group-cloud.module'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { APP_LIST_CLOUD_DIRECTIVES } from '../../app/app-list-cloud.module'; +import { GroupCloudComponent } from '../../group/components/group-cloud.component'; @NgModule({ imports: [ @@ -42,7 +42,7 @@ import { APP_LIST_CLOUD_DIRECTIVES } from '../../app/app-list-cloud.module'; MaterialModule, ...APP_LIST_CLOUD_DIRECTIVES, CoreModule, - GroupCloudModule, + GroupCloudComponent, ProcessCommonModule, PeopleCloudModule, MatProgressSpinnerModule, From 8af39c25f73c815a6a2bfaccda8e938828594b56 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 12:29:31 -0500 Subject: [PATCH 09/30] people component --- .../widgets/people/people-cloud.widget.ts | 4 +-- .../components/people-cloud.component.html | 6 ++-- .../components/people-cloud.component.spec.ts | 5 ++- .../people-cloud.component.stories.ts | 14 +++----- .../components/people-cloud.component.ts | 32 ++++++++++++++++--- .../src/lib/people/people-cloud.module.ts | 14 ++------ .../src/lib/process-services-cloud.module.ts | 6 ++-- ...dit-process-filter-cloud.component.spec.ts | 5 +-- .../process-filters-cloud.module.ts | 4 +-- .../edit-task-filter-cloud.component.spec.ts | 4 +-- .../task-filters/task-filters-cloud.module.ts | 4 +-- 11 files changed, 54 insertions(+), 44 deletions(-) diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.ts b/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.ts index fcb24027dea..c48d12481d0 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.ts @@ -25,14 +25,14 @@ import { IdentityUserService } from '../../../../people/services/identity-user.s import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { CommonModule } from '@angular/common'; import { TranslateModule } from '@ngx-translate/core'; -import { PeopleCloudModule } from '../../../../people/people-cloud.module'; +import { PeopleCloudComponent } from '../../../../people/components/people-cloud.component'; /* eslint-disable @angular-eslint/component-selector */ @Component({ selector: 'people-cloud-widget', standalone: true, - imports: [CommonModule, TranslateModule, ErrorWidgetComponent, PeopleCloudModule], + imports: [CommonModule, TranslateModule, ErrorWidgetComponent, PeopleCloudComponent], templateUrl: './people-cloud.widget.html', host: { '(click)': 'event($event)', diff --git a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.html b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.html index 0d02bd20382..5508015a117 100644 --- a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.html +++ b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.html @@ -25,7 +25,6 @@ - + +
diff --git a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts index b7d1833d774..3e56235da11 100644 --- a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts @@ -19,7 +19,6 @@ import { PeopleCloudComponent } from './people-cloud.component'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CoreTestingModule } from '@alfresco/adf-core'; import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; -import { PeopleCloudModule } from '../people-cloud.module'; import { DebugElement, SimpleChange } from '@angular/core'; import { By } from '@angular/platform-browser'; import { of } from 'rxjs'; @@ -83,13 +82,13 @@ describe('PeopleCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, ProcessServiceCloudTestingModule, PeopleCloudModule] + imports: [CoreTestingModule, ProcessServiceCloudTestingModule, PeopleCloudComponent] }); fixture = TestBed.createComponent(PeopleCloudComponent); component = fixture.componentInstance; element = fixture.nativeElement; - identityUserService = TestBed.inject(IDENTITY_USER_SERVICE_TOKEN); + identityUserService = fixture.debugElement.injector.get(IDENTITY_USER_SERVICE_TOKEN); loader = TestbedHarnessEnvironment.loader(fixture); }); diff --git a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.stories.ts b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.stories.ts index bc041cb49d7..0240f33a634 100644 --- a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.stories.ts +++ b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.stories.ts @@ -17,7 +17,6 @@ import { applicationConfig, Meta, moduleMetadata, StoryFn } from '@storybook/angular'; import { PeopleCloudComponent } from './people-cloud.component'; -import { PeopleCloudModule } from '../people-cloud.module'; import { ProcessServicesCloudStoryModule } from '../../testing/process-services-cloud-story.module'; import { IdentityUserService } from '../services/identity-user.service'; import { IdentityUserServiceMock, mockFoodUsers, mockKielbasaSausage, mockShepherdsPie, mockYorkshirePudding } from '../mock/people-cloud.mock'; @@ -28,13 +27,10 @@ export default { title: 'Process Services Cloud/People Cloud/People Cloud', decorators: [ moduleMetadata({ - imports: [PeopleCloudModule] + imports: [PeopleCloudComponent] }), applicationConfig({ - providers: [ - { provide: IdentityUserService, useClass: IdentityUserServiceMock }, - importProvidersFrom(ProcessServicesCloudStoryModule) - ] + providers: [{ provide: IdentityUserService, useClass: IdentityUserServiceMock }, importProvidersFrom(ProcessServicesCloudStoryModule)] }) ], argTypes: { @@ -119,7 +115,7 @@ export default { description: 'FormControl to list of users.', table: { type: { summary: 'FormControl' }, - defaultValue: { summary: 'new FormControl({ value: \'\', disabled: false })' }, + defaultValue: { summary: "new FormControl({ value: '', disabled: false })" }, category: 'Form Controls' } }, @@ -128,7 +124,7 @@ export default { description: 'FormControl to search the user.', table: { type: { summary: 'FormControl' }, - defaultValue: { summary: 'new FormControl({ value: \'\', disabled: false })' }, + defaultValue: { summary: "new FormControl({ value: '', disabled: false })" }, category: 'Form Controls' } }, @@ -173,7 +169,7 @@ export default { } } as Meta; -const template: StoryFn = args => ({ +const template: StoryFn = (args) => ({ props: args }); diff --git a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.ts b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.ts index bde0e1d1a7a..faffc50b497 100644 --- a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { UntypedFormControl } from '@angular/forms'; +import { ReactiveFormsModule, UntypedFormControl } from '@angular/forms'; import { AfterViewInit, Component, @@ -34,17 +34,42 @@ import { } from '@angular/core'; import { BehaviorSubject, Observable } from 'rxjs'; import { debounceTime, distinctUntilChanged, filter, mergeMap, switchMap, tap } from 'rxjs/operators'; -import { FullNamePipe } from '@alfresco/adf-core'; +import { FullNamePipe, InitialUsernamePipe } from '@alfresco/adf-core'; import { animate, state, style, transition, trigger } from '@angular/animations'; import { ComponentSelectionMode } from '../../types'; import { IdentityUserModel } from '../models/identity-user.model'; import { IdentityUserServiceInterface } from '../services/identity-user.service.interface'; import { IDENTITY_USER_SERVICE_TOKEN } from '../services/identity-user-service.token'; -import { MatFormFieldAppearance, SubscriptSizing } from '@angular/material/form-field'; +import { MatFormFieldAppearance, MatFormFieldModule, SubscriptSizing } from '@angular/material/form-field'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { MatIconModule } from '@angular/material/icon'; +import { MatProgressBarModule } from '@angular/material/progress-bar'; +import { MatSelectModule } from '@angular/material/select'; +import { MatAutocompleteModule } from '@angular/material/autocomplete'; +import { MatChipsModule } from '@angular/material/chips'; +import { MatInputModule } from '@angular/material/input'; +import { IdentityUserService } from '../services/identity-user.service'; @Component({ selector: 'adf-cloud-people', + standalone: true, + imports: [ + CommonModule, + TranslateModule, + MatIconModule, + MatFormFieldModule, + MatProgressBarModule, + MatSelectModule, + InitialUsernamePipe, + FullNamePipe, + MatAutocompleteModule, + ReactiveFormsModule, + MatChipsModule, + MatInputModule + ], + providers: [FullNamePipe, { provide: IDENTITY_USER_SERVICE_TOKEN, useExisting: IdentityUserService }], templateUrl: './people-cloud.component.html', styleUrls: ['./people-cloud.component.scss'], animations: [ @@ -53,7 +78,6 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; transition('void => enter', [style({ opacity: 0, transform: 'translateY(-100%)' }), animate('300ms cubic-bezier(0.55, 0, 0.55, 0.2)')]) ]) ], - providers: [FullNamePipe], encapsulation: ViewEncapsulation.None }) export class PeopleCloudComponent implements OnInit, OnChanges, AfterViewInit { diff --git a/lib/process-services-cloud/src/lib/people/people-cloud.module.ts b/lib/process-services-cloud/src/lib/people/people-cloud.module.ts index 8b526c1cf6c..125705fc2f6 100644 --- a/lib/process-services-cloud/src/lib/people/people-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/people/people-cloud.module.ts @@ -17,18 +17,10 @@ import { NgModule } from '@angular/core'; import { PeopleCloudComponent } from './components/people-cloud.component'; -import { CommonModule } from '@angular/common'; -import { MaterialModule } from '../material.module'; -import { CoreModule, FullNamePipe, InitialUsernamePipe } from '@alfresco/adf-core'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { IdentityUserService } from './services/identity-user.service'; -import { IDENTITY_USER_SERVICE_TOKEN } from './services/identity-user-service.token'; -import { MatProgressBarModule } from '@angular/material/progress-bar'; +/** @deprecated use PeopleCloudComponent instead */ @NgModule({ - imports: [CommonModule, MaterialModule, FormsModule, ReactiveFormsModule, CoreModule, FullNamePipe, InitialUsernamePipe, MatProgressBarModule], - declarations: [PeopleCloudComponent], - exports: [PeopleCloudComponent], - providers: [{ provide: IDENTITY_USER_SERVICE_TOKEN, useExisting: IdentityUserService }] + imports: [PeopleCloudComponent], + exports: [PeopleCloudComponent] }) export class PeopleCloudModule {} diff --git a/lib/process-services-cloud/src/lib/process-services-cloud.module.ts b/lib/process-services-cloud/src/lib/process-services-cloud.module.ts index dfecadf46b5..c23fac64795 100644 --- a/lib/process-services-cloud/src/lib/process-services-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process-services-cloud.module.ts @@ -30,11 +30,11 @@ import { PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN, TASK_LIST_PREFERENCES_SERVICE_TOKEN } from './services/public-api'; -import { PeopleCloudModule } from './people/people-cloud.module'; import { CloudFormRenderingService } from './form/components/cloud-form-rendering.service'; import { ApolloModule } from 'apollo-angular'; import { RichTextEditorComponent } from './rich-text-editor'; import { GroupCloudComponent } from './group/components/group-cloud.component'; +import { PeopleCloudComponent } from './people/components/people-cloud.component'; @NgModule({ imports: [ @@ -43,7 +43,7 @@ import { GroupCloudComponent } from './group/components/group-cloud.component'; ProcessCloudModule, TaskCloudModule, GroupCloudComponent, - PeopleCloudModule, + PeopleCloudComponent, ...FORM_CLOUD_DIRECTIVES, TaskFormModule, ApolloModule, @@ -57,7 +57,7 @@ import { GroupCloudComponent } from './group/components/group-cloud.component'; GroupCloudComponent, ...FORM_CLOUD_DIRECTIVES, TaskFormModule, - PeopleCloudModule, + PeopleCloudComponent, RichTextEditorComponent ] }) diff --git a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts index 92bb7811abb..b6f505cc6ec 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts @@ -114,7 +114,8 @@ describe('EditProcessFilterCloudComponent', () => { MatInputModule, ReactiveFormsModule, MatChipsModule, - MatProgressBarModule + MatProgressBarModule, + PeopleCloudComponent ], providers: [ { provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }, @@ -124,7 +125,7 @@ describe('EditProcessFilterCloudComponent', () => { { provide: MAT_DATE_FORMATS, useValue: ADF_DATE_FORMATS }, { provide: IDENTITY_USER_SERVICE_TOKEN, useExisting: IdentityUserServiceMock } ], - declarations: [PeopleCloudComponent, DateRangeFilterComponent] + declarations: [DateRangeFilterComponent] }); fixture = TestBed.createComponent(EditProcessFilterCloudComponent); component = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts index bbf05837ad3..3033f0f24b8 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts @@ -26,7 +26,7 @@ import { EditProcessFilterCloudComponent } from './components/edit-process-filte import { ProcessFilterDialogCloudComponent } from './components/process-filter-dialog-cloud.component'; import { APP_LIST_CLOUD_DIRECTIVES } from './../../app/app-list-cloud.module'; import { ProcessCommonModule } from '../../common/process-common.module'; -import { PeopleCloudModule } from '../../people/people-cloud.module'; +import { PeopleCloudComponent } from '../../people/components/people-cloud.component'; @NgModule({ imports: [ @@ -38,7 +38,7 @@ import { PeopleCloudModule } from '../../people/people-cloud.module'; ...APP_LIST_CLOUD_DIRECTIVES, CoreModule, ProcessCommonModule, - PeopleCloudModule + PeopleCloudComponent ], declarations: [ProcessFiltersCloudComponent, EditProcessFilterCloudComponent, ProcessFilterDialogCloudComponent], exports: [ProcessFiltersCloudComponent, EditProcessFilterCloudComponent, ProcessFilterDialogCloudComponent] diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts index 4991d4ffda6..e97bf73ebdf 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts @@ -32,7 +32,6 @@ import { TaskCloudService } from '../../../../services/task-cloud.service'; import { fakeFilter } from '../../../mock/task-filters-cloud.mock'; import { DateCloudFilterType } from '../../../../../models/date-cloud-filter.model'; import { AssignmentType, TaskFilterCloudModel, TaskStatusFilter } from '../../../models/filter-cloud.model'; -import { PeopleCloudModule } from '../../../../../people/people-cloud.module'; import { ProcessDefinitionCloud } from '../../../../../models/process-definition-cloud.model'; import { MatIconTestingModule } from '@angular/material/icon/testing'; import { @@ -57,6 +56,7 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatSelectHarness } from '@angular/material/select/testing'; import { MatExpansionPanelHarness } from '@angular/material/expansion/testing'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; +import { PeopleCloudComponent } from '@alfresco/adf-process-services-cloud'; describe('EditTaskFilterCloudComponent', () => { let loader: HarnessLoader; @@ -74,7 +74,7 @@ describe('EditTaskFilterCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, PeopleCloudModule, MatIconTestingModule], + imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, PeopleCloudComponent, MatIconTestingModule], providers: [MatDialog, { provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); fixture = TestBed.createComponent(EditTaskFilterCloudComponent); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index 6d2f3db2e8e..f98fc8658f2 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -23,7 +23,6 @@ import { MaterialModule } from '../../material.module'; import { CoreModule } from '@alfresco/adf-core'; import { HttpClientModule } from '@angular/common/http'; import { ProcessCommonModule } from '../../common/process-common.module'; -import { PeopleCloudModule } from '../../people/people-cloud.module'; import { EditServiceTaskFilterCloudComponent } from './components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component'; import { EditTaskFilterCloudComponent } from './components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component'; import { TaskFilterDialogCloudComponent } from './components/task-filter-dialog/task-filter-dialog-cloud.component'; @@ -32,6 +31,7 @@ import { TaskAssignmentFilterCloudComponent } from './components/task-assignment import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { APP_LIST_CLOUD_DIRECTIVES } from '../../app/app-list-cloud.module'; import { GroupCloudComponent } from '../../group/components/group-cloud.component'; +import { PeopleCloudComponent } from '../../people/components/people-cloud.component'; @NgModule({ imports: [ @@ -44,7 +44,7 @@ import { GroupCloudComponent } from '../../group/components/group-cloud.componen CoreModule, GroupCloudComponent, ProcessCommonModule, - PeopleCloudModule, + PeopleCloudComponent, MatProgressSpinnerModule, TaskFilterDialogCloudComponent, TaskFiltersCloudComponent From 049353a0effa76d49465b37a8408e63232651098 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 12:40:41 -0500 Subject: [PATCH 10/30] remove tokens --- .../group/components/group-cloud.component.ts | 9 +------- .../src/lib/group/public-api.ts | 1 - .../services/identity-group-service.token.ts | 21 ------------------- .../components/people-cloud.component.spec.ts | 7 +++---- .../components/people-cloud.component.ts | 10 ++------- .../src/lib/people/public-api.ts | 1 - .../services/identity-user-service.token.ts | 21 ------------------- ...dit-process-filter-cloud.component.spec.ts | 4 ++-- 8 files changed, 8 insertions(+), 66 deletions(-) delete mode 100644 lib/process-services-cloud/src/lib/group/services/identity-group-service.token.ts delete mode 100644 lib/process-services-cloud/src/lib/people/services/identity-user-service.token.ts diff --git a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts index a3df9818237..2fbd6f6c1bf 100644 --- a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.ts @@ -20,7 +20,6 @@ import { DestroyRef, ElementRef, EventEmitter, - Inject, inject, Input, OnChanges, @@ -36,8 +35,6 @@ import { BehaviorSubject, Observable } from 'rxjs'; import { debounceTime, distinctUntilChanged, filter, mergeMap, switchMap, tap } from 'rxjs/operators'; import { ComponentSelectionMode } from '../../types'; import { IdentityGroupModel } from '../models/identity-group.model'; -import { IdentityGroupServiceInterface } from '../services/identity-group.service.interface'; -import { IDENTITY_GROUP_SERVICE_TOKEN } from '../services/identity-group-service.token'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { CommonModule } from '@angular/common'; import { TranslateModule } from '@ngx-translate/core'; @@ -67,7 +64,6 @@ import { IdentityGroupService } from '../services/identity-group.service'; MatInputModule, MatChipsModule ], - providers: [{ provide: IDENTITY_GROUP_SERVICE_TOKEN, useExisting: IdentityGroupService }], templateUrl: './group-cloud.component.html', styleUrls: ['./group-cloud.component.scss'], animations: [ @@ -166,10 +162,7 @@ export class GroupCloudComponent implements OnInit, OnChanges { private readonly destroyRef = inject(DestroyRef); - constructor( - @Inject(IDENTITY_GROUP_SERVICE_TOKEN) - private identityGroupService: IdentityGroupServiceInterface - ) {} + constructor(private identityGroupService: IdentityGroupService) {} ngOnInit(): void { this.initSearch(); diff --git a/lib/process-services-cloud/src/lib/group/public-api.ts b/lib/process-services-cloud/src/lib/group/public-api.ts index 3ea175ecd5f..bb235260f75 100644 --- a/lib/process-services-cloud/src/lib/group/public-api.ts +++ b/lib/process-services-cloud/src/lib/group/public-api.ts @@ -19,4 +19,3 @@ export * from './components/group-cloud.component'; export * from './models/identity-group.model'; export * from './group-cloud.module'; export * from './services/identity-group.service'; -export * from './services/identity-group-service.token'; diff --git a/lib/process-services-cloud/src/lib/group/services/identity-group-service.token.ts b/lib/process-services-cloud/src/lib/group/services/identity-group-service.token.ts deleted file mode 100644 index 3ac8d00088f..00000000000 --- a/lib/process-services-cloud/src/lib/group/services/identity-group-service.token.ts +++ /dev/null @@ -1,21 +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. - */ - -import { InjectionToken } from '@angular/core'; -import { IdentityGroupServiceInterface } from './identity-group.service.interface'; - -export const IDENTITY_GROUP_SERVICE_TOKEN = new InjectionToken('IdentityGroup'); diff --git a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts index 3e56235da11..56b620ce9b0 100644 --- a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts @@ -22,21 +22,20 @@ import { ProcessServiceCloudTestingModule } from '../../testing/process-service- import { DebugElement, SimpleChange } from '@angular/core'; import { By } from '@angular/platform-browser'; import { of } from 'rxjs'; -import { IdentityUserServiceInterface } from '../services/identity-user.service.interface'; -import { IDENTITY_USER_SERVICE_TOKEN } from '../services/identity-user-service.token'; import { mockFoodUsers, mockKielbasaSausage, mockShepherdsPie, mockYorkshirePudding, mockPreselectedFoodUsers } from '../mock/people-cloud.mock'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatChipHarness } from '@angular/material/chips/testing'; import { MatInputHarness } from '@angular/material/input/testing'; import { MatFormFieldHarness } from '@angular/material/form-field/testing'; +import { IdentityUserService } from '@alfresco/adf-process-services-cloud'; describe('PeopleCloudComponent', () => { let loader: HarnessLoader; let component: PeopleCloudComponent; let fixture: ComponentFixture; let element: HTMLElement; - let identityUserService: IdentityUserServiceInterface; + let identityUserService: IdentityUserService; let searchSpy: jasmine.Spy; /** @@ -88,7 +87,7 @@ describe('PeopleCloudComponent', () => { component = fixture.componentInstance; element = fixture.nativeElement; - identityUserService = fixture.debugElement.injector.get(IDENTITY_USER_SERVICE_TOKEN); + identityUserService = fixture.debugElement.injector.get(IdentityUserService); loader = TestbedHarnessEnvironment.loader(fixture); }); diff --git a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.ts b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.ts index faffc50b497..f4c96da4fd8 100644 --- a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.ts @@ -22,7 +22,6 @@ import { DestroyRef, ElementRef, EventEmitter, - Inject, inject, Input, OnChanges, @@ -38,8 +37,6 @@ import { FullNamePipe, InitialUsernamePipe } from '@alfresco/adf-core'; import { animate, state, style, transition, trigger } from '@angular/animations'; import { ComponentSelectionMode } from '../../types'; import { IdentityUserModel } from '../models/identity-user.model'; -import { IdentityUserServiceInterface } from '../services/identity-user.service.interface'; -import { IDENTITY_USER_SERVICE_TOKEN } from '../services/identity-user-service.token'; import { MatFormFieldAppearance, MatFormFieldModule, SubscriptSizing } from '@angular/material/form-field'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { CommonModule } from '@angular/common'; @@ -69,7 +66,7 @@ import { IdentityUserService } from '../services/identity-user.service'; MatChipsModule, MatInputModule ], - providers: [FullNamePipe, { provide: IDENTITY_USER_SERVICE_TOKEN, useExisting: IdentityUserService }], + providers: [FullNamePipe], templateUrl: './people-cloud.component.html', styleUrls: ['./people-cloud.component.scss'], animations: [ @@ -220,10 +217,7 @@ export class PeopleCloudComponent implements OnInit, OnChanges, AfterViewInit { private readonly destroyRef = inject(DestroyRef); - constructor( - @Inject(IDENTITY_USER_SERVICE_TOKEN) - private identityUserService: IdentityUserServiceInterface - ) {} + constructor(private identityUserService: IdentityUserService) {} ngOnInit(): void { this.initSearch(); diff --git a/lib/process-services-cloud/src/lib/people/public-api.ts b/lib/process-services-cloud/src/lib/people/public-api.ts index bbcc54c77cb..ddd5f8667db 100644 --- a/lib/process-services-cloud/src/lib/people/public-api.ts +++ b/lib/process-services-cloud/src/lib/people/public-api.ts @@ -19,4 +19,3 @@ export * from './components/people-cloud.component'; export * from './people-cloud.module'; export * from './models/identity-user.model'; export * from './services/identity-user.service'; -export * from './services/identity-user-service.token'; diff --git a/lib/process-services-cloud/src/lib/people/services/identity-user-service.token.ts b/lib/process-services-cloud/src/lib/people/services/identity-user-service.token.ts deleted file mode 100644 index 7bf1e6c32e0..00000000000 --- a/lib/process-services-cloud/src/lib/people/services/identity-user-service.token.ts +++ /dev/null @@ -1,21 +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. - */ - -import { InjectionToken } from '@angular/core'; -import { IdentityUserServiceInterface } from './identity-user.service.interface'; - -export const IDENTITY_USER_SERVICE_TOKEN = new InjectionToken('identity-user-service-token'); diff --git a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts index b6f505cc6ec..9e36cfbb84d 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts @@ -47,7 +47,6 @@ import { DateCloudFilterType } from '../../../models/date-cloud-filter.model'; import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud.model'; import { PeopleCloudComponent } from '../../../people/components/people-cloud.component'; import { IdentityUserServiceMock } from '../../../people/mock/people-cloud.mock'; -import { IDENTITY_USER_SERVICE_TOKEN } from '../../../people/services/identity-user-service.token'; import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service'; import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service'; import { NotificationCloudService } from '../../../services/notification-cloud.service'; @@ -62,6 +61,7 @@ import { PROCESS_FILTER_ACTION_SAVE_DEFAULT } from './edit-process-filter-cloud.component'; import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud.component'; +import { IdentityUserService } from '@alfresco/adf-process-services-cloud'; describe('EditProcessFilterCloudComponent', () => { let loader: HarnessLoader; @@ -123,7 +123,7 @@ describe('EditProcessFilterCloudComponent', () => { { provide: DateAdapter, useClass: DateFnsAdapter }, { provide: NotificationCloudService, useValue: { makeGQLQuery: () => of([]) } }, { provide: MAT_DATE_FORMATS, useValue: ADF_DATE_FORMATS }, - { provide: IDENTITY_USER_SERVICE_TOKEN, useExisting: IdentityUserServiceMock } + { provide: IdentityUserService, useExisting: IdentityUserServiceMock } ], declarations: [DateRangeFilterComponent] }); From 90c3d703dac6d97ada608d2ee98be9b59e13ca11 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 12:53:37 -0500 Subject: [PATCH 11/30] cleanup --- .../people/mock/identity-user.service.mock.ts | 72 ----- .../people/mock/jwt-helper.service.spec.ts | 22 -- .../src/lib/people/mock/people-cloud.mock.ts | 37 ++- .../services/identity-user.service.spec.ts | 253 +++++++++++------- .../people/services/identity-user.service.ts | 3 +- ...dit-process-filter-cloud.component.spec.ts | 2 +- 6 files changed, 179 insertions(+), 210 deletions(-) delete mode 100644 lib/process-services-cloud/src/lib/people/mock/identity-user.service.mock.ts delete mode 100644 lib/process-services-cloud/src/lib/people/mock/jwt-helper.service.spec.ts diff --git a/lib/process-services-cloud/src/lib/people/mock/identity-user.service.mock.ts b/lib/process-services-cloud/src/lib/people/mock/identity-user.service.mock.ts deleted file mode 100644 index 2f82917b535..00000000000 --- a/lib/process-services-cloud/src/lib/people/mock/identity-user.service.mock.ts +++ /dev/null @@ -1,72 +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. - */ - -import { HttpErrorResponse } from '@angular/common/http'; -import { IdentityUserFilterInterface } from '../services/identity-user-filter.interface'; - -export const mockSearchUserEmptyFilters: IdentityUserFilterInterface = { - roles: [], - groups: [], - withinApplication: '' -}; - -export const mockSearchUserByGroups: IdentityUserFilterInterface = { - roles: [], - groups: ['fake-group-1', 'fake-group-2'], - withinApplication: '' -}; - -export const mockSearchUserByGroupsAndRoles: IdentityUserFilterInterface = { - roles: ['fake-role-1', 'fake-role-2'], - groups: ['fake-group-1', 'fake-group-2'], - withinApplication: '' -}; - -export const mockSearchUserByGroupsAndRolesAndApp: IdentityUserFilterInterface = { - roles: ['fake-role-1', 'fake-role-2'], - groups: ['fake-group-1', 'fake-group-2'], - withinApplication: 'fake-app-name' -}; - -export const mockSearchUserByRoles: IdentityUserFilterInterface = { - roles: ['fake-role-1', 'fake-role-2'], - groups: [], - withinApplication: '' -}; - -export const mockSearchUserByRolesAndApp: IdentityUserFilterInterface = { - roles: ['fake-role-1', 'fake-role-2'], - groups: [], - withinApplication: 'fake-app-name' -}; - -export const mockSearchUserByApp: IdentityUserFilterInterface = { - roles: [], - groups: [], - withinApplication: 'fake-app-name' -}; - -export const mockSearchUserByAppAndGroups: IdentityUserFilterInterface = { - roles: [], - groups: ['fake-group-1', 'fake-group-2'], - withinApplication: 'fake-app-name' -}; - -export const mockHttpErrorResponse = new HttpErrorResponse({ - error: 'Mock Error', - status: 404, statusText: 'Not Found' -}); diff --git a/lib/process-services-cloud/src/lib/people/mock/jwt-helper.service.spec.ts b/lib/process-services-cloud/src/lib/people/mock/jwt-helper.service.spec.ts deleted file mode 100644 index 5a6557383b0..00000000000 --- a/lib/process-services-cloud/src/lib/people/mock/jwt-helper.service.spec.ts +++ /dev/null @@ -1,22 +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. - */ - -export const mockToken = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ' + - 'zdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiZmFtaWx5X25hbWUiOiJEb2UiLCJnaXZ' + - 'lbl9uYW1lIjoiSm9obiIsImFkbWluIjp0cnVlLCJlbWFpbCI6ImpvaG5Eb2VAZ21haWwuY29tIiwicHJ' + - 'lZmVycmVkX3VzZXJuYW1lIjoiam9obkRvZTEiLCJqdGkiOiI2MmQ3YjA4NS1hNTJjLTRjZmEtYjA2Zi1' + - 'hODFhN2IwNjRjZDIiLCJpYXQiOjE1NDM0MTA0NzcsImV4cCI6MTU0MzQxNTIxM30.pSP86kmX3keuU5E3ndaOUq2TzKdJRsuMnBdFz3Y-UEU'; diff --git a/lib/process-services-cloud/src/lib/people/mock/people-cloud.mock.ts b/lib/process-services-cloud/src/lib/people/mock/people-cloud.mock.ts index 1c53f95dc88..1ecf814696c 100644 --- a/lib/process-services-cloud/src/lib/people/mock/people-cloud.mock.ts +++ b/lib/process-services-cloud/src/lib/people/mock/people-cloud.mock.ts @@ -19,11 +19,29 @@ import { Injectable } from '@angular/core'; import { Observable, EMPTY, of } from 'rxjs'; import { IdentityUserModel } from '../models/identity-user.model'; import { IdentityUserFilterInterface } from '../services/identity-user-filter.interface'; -import { IdentityUserServiceInterface } from '../services/identity-user.service.interface'; +import { IdentityUserService } from '@alfresco/adf-process-services-cloud'; -export const mockYorkshirePudding: IdentityUserModel = { id: 'yorkshire', username: 'Yorkshire Pudding', firstName: 'Yorkshire', lastName: 'Pudding', email: 'pudding@food.com' }; -export const mockShepherdsPie: IdentityUserModel = { id: 'shepherds', username: 'Shepherds Pie', firstName: 'Shepherds', lastName: 'Pie', email: 'shepherds@food.com'}; -export const mockKielbasaSausage: IdentityUserModel = { id: 'kielbasa', username: 'Kielbasa Sausage', firstName: 'Kielbasa', lastName: 'Sausage', email: 'sausage@food.com' }; +export const mockYorkshirePudding: IdentityUserModel = { + id: 'yorkshire', + username: 'Yorkshire Pudding', + firstName: 'Yorkshire', + lastName: 'Pudding', + email: 'pudding@food.com' +}; +export const mockShepherdsPie: IdentityUserModel = { + id: 'shepherds', + username: 'Shepherds Pie', + firstName: 'Shepherds', + lastName: 'Pie', + email: 'shepherds@food.com' +}; +export const mockKielbasaSausage: IdentityUserModel = { + id: 'kielbasa', + username: 'Kielbasa Sausage', + firstName: 'Kielbasa', + lastName: 'Sausage', + email: 'sausage@food.com' +}; export const mockFoodUsers: IdentityUserModel[] = [mockYorkshirePudding, mockShepherdsPie, mockKielbasaSausage]; @@ -32,11 +50,8 @@ export const mockPreselectedFoodUsers = [ { ...mockKielbasaSausage, readonly: false } ]; -@Injectable({ - providedIn: 'root' -}) -export class IdentityUserServiceMock implements IdentityUserServiceInterface { - +@Injectable() +export class IdentityUserServiceMock extends IdentityUserService { queryParams: { search: string; application?: string; roles?: string[]; groups?: string[] }; getCurrentUserInfo(): IdentityUserModel { @@ -48,8 +63,6 @@ export class IdentityUserServiceMock implements IdentityUserServiceInterface { return EMPTY; } - return of(mockFoodUsers.filter(group => - group.username.toUpperCase().includes(name.toUpperCase()) - )); + return of(mockFoodUsers.filter((group) => group.username.toUpperCase().includes(name.toUpperCase()))); } } diff --git a/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts b/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts index edb188785ed..1da1846a53b 100644 --- a/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts +++ b/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts @@ -18,15 +18,6 @@ import { TestBed } from '@angular/core/testing'; import { IdentityUserService } from './identity-user.service'; import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; -import { - mockSearchUserByApp, - mockSearchUserByAppAndGroups, - mockSearchUserByGroups, - mockSearchUserByGroupsAndRoles, - mockSearchUserByGroupsAndRolesAndApp, - mockSearchUserByRoles, - mockSearchUserByRolesAndApp -} from '../mock/identity-user.service.mock'; import { mockFoodUsers } from '../mock/people-cloud.mock'; import { AdfHttpClient } from '@alfresco/adf-core/api'; import { mockHttpErrorResponse } from '../../group/mock/identity-group.service.mock'; @@ -83,154 +74,214 @@ describe('IdentityUserService', () => { requestSpy.and.returnValue(Promise.resolve(mockFoodUsers)); const searchSpy = spyOn(service, 'search').and.callThrough(); - service.search('fake', mockSearchUserByRoles).subscribe((res) => { - expect(res).toBeDefined(); - expect(searchSpy).toHaveBeenCalled(); - expect(service.queryParams).toEqual({ - search: 'fake', - role: 'fake-role-1,fake-role-2' + service + .search('fake', { + roles: ['fake-role-1', 'fake-role-2'], + groups: [], + withinApplication: '' + }) + .subscribe((res) => { + expect(res).toBeDefined(); + expect(searchSpy).toHaveBeenCalled(); + expect(service.queryParams).toEqual({ + search: 'fake', + role: 'fake-role-1,fake-role-2' + }); + done(); }); - done(); - }); }); it('should not fetch users by roles if error occurred', (done) => { requestSpy.and.returnValue(Promise.reject(mockHttpErrorResponse)); - service.search('fake', mockSearchUserByRoles).subscribe( - () => { - fail('expected an error, not users'); - }, - (error) => { - expect(error.status).toEqual(404); - expect(error.statusText).toEqual('Not Found'); - expect(error.error).toEqual('Mock Error'); - done(); - } - ); + service + .search('fake', { + roles: ['fake-role-1', 'fake-role-2'], + groups: [], + withinApplication: '' + }) + .subscribe( + () => { + fail('expected an error, not users'); + }, + (error) => { + expect(error.status).toEqual(404); + expect(error.statusText).toEqual('Not Found'); + expect(error.error).toEqual('Mock Error'); + done(); + } + ); }); it('should fetch users by groups', (done) => { requestSpy.and.returnValue(Promise.resolve(mockFoodUsers)); const searchSpy = spyOn(service, 'search').and.callThrough(); - service.search('fake', mockSearchUserByGroups).subscribe((res) => { - expect(res).toBeDefined(); - expect(searchSpy).toHaveBeenCalled(); - expect(service.queryParams).toEqual({ - search: 'fake', - group: 'fake-group-1,fake-group-2' + service + .search('fake', { + roles: [], + groups: ['fake-group-1', 'fake-group-2'], + withinApplication: '' + }) + .subscribe((res) => { + expect(res).toBeDefined(); + expect(searchSpy).toHaveBeenCalled(); + expect(service.queryParams).toEqual({ + search: 'fake', + group: 'fake-group-1,fake-group-2' + }); + done(); }); - done(); - }); }); it('should fetch users by roles with groups', (done) => { requestSpy.and.returnValue(Promise.resolve(mockFoodUsers)); const searchSpy = spyOn(service, 'search').and.callThrough(); - service.search('fake', mockSearchUserByGroupsAndRoles).subscribe((res) => { - expect(res).toBeDefined(); - expect(searchSpy).toHaveBeenCalled(); - expect(service.queryParams).toEqual({ - search: 'fake', - role: 'fake-role-1,fake-role-2', - group: 'fake-group-1,fake-group-2' + service + .search('fake', { + roles: ['fake-role-1', 'fake-role-2'], + groups: ['fake-group-1', 'fake-group-2'], + withinApplication: '' + }) + .subscribe((res) => { + expect(res).toBeDefined(); + expect(searchSpy).toHaveBeenCalled(); + expect(service.queryParams).toEqual({ + search: 'fake', + role: 'fake-role-1,fake-role-2', + group: 'fake-group-1,fake-group-2' + }); + done(); }); - done(); - }); }); it('should fetch users by roles with groups and appName', (done) => { requestSpy.and.returnValue(Promise.resolve(mockFoodUsers)); const searchSpy = spyOn(service, 'search').and.callThrough(); - service.search('fake', mockSearchUserByGroupsAndRolesAndApp).subscribe((res) => { - expect(res).toBeDefined(); - expect(searchSpy).toHaveBeenCalled(); - expect(service.queryParams).toEqual({ - search: 'fake', - role: 'fake-role-1,fake-role-2', - application: 'fake-app-name', - group: 'fake-group-1,fake-group-2' + service + .search('fake', { + roles: ['fake-role-1', 'fake-role-2'], + groups: ['fake-group-1', 'fake-group-2'], + withinApplication: 'fake-app-name' + }) + .subscribe((res) => { + expect(res).toBeDefined(); + expect(searchSpy).toHaveBeenCalled(); + expect(service.queryParams).toEqual({ + search: 'fake', + role: 'fake-role-1,fake-role-2', + application: 'fake-app-name', + group: 'fake-group-1,fake-group-2' + }); + done(); }); - done(); - }); }); it('should not fetch users by groups if error occurred', (done) => { requestSpy.and.returnValue(Promise.reject(mockHttpErrorResponse)); - service.search('fake', mockSearchUserByGroups).subscribe( - () => { - fail('expected an error, not users'); - }, - (error) => { - expect(error.status).toEqual(404); - expect(error.statusText).toEqual('Not Found'); - expect(error.error).toEqual('Mock Error'); - done(); - } - ); + service + .search('fake', { + roles: [], + groups: ['fake-group-1', 'fake-group-2'], + withinApplication: '' + }) + .subscribe( + () => { + fail('expected an error, not users'); + }, + (error) => { + expect(error.status).toEqual(404); + expect(error.statusText).toEqual('Not Found'); + expect(error.error).toEqual('Mock Error'); + done(); + } + ); }); it('should fetch users within app', (done) => { requestSpy.and.returnValue(Promise.resolve(mockFoodUsers)); - service.search('fake', mockSearchUserByApp).subscribe((res) => { - expect(res).toBeDefined(); - expect(service.queryParams).toEqual({ - search: 'fake', - application: 'fake-app-name' + service + .search('fake', { + roles: [], + groups: [], + withinApplication: 'fake-app-name' + }) + .subscribe((res) => { + expect(res).toBeDefined(); + expect(service.queryParams).toEqual({ + search: 'fake', + application: 'fake-app-name' + }); + done(); }); - done(); - }); }); it('should fetch users within app with roles', (done) => { requestSpy.and.returnValue(Promise.resolve(mockFoodUsers)); - service.search('fake', mockSearchUserByRolesAndApp).subscribe((res) => { - expect(res).toBeDefined(); - expect(service.queryParams).toEqual({ - search: 'fake', - application: 'fake-app-name', - role: 'fake-role-1,fake-role-2' + service + .search('fake', { + roles: ['fake-role-1', 'fake-role-2'], + groups: [], + withinApplication: 'fake-app-name' + }) + .subscribe((res) => { + expect(res).toBeDefined(); + expect(service.queryParams).toEqual({ + search: 'fake', + application: 'fake-app-name', + role: 'fake-role-1,fake-role-2' + }); + done(); }); - done(); - }); }); it('should fetch users within app with groups', (done) => { requestSpy.and.returnValue(Promise.resolve(mockFoodUsers)); const searchSpy = spyOn(service, 'search').and.callThrough(); - service.search('fake', mockSearchUserByAppAndGroups).subscribe((res) => { - expect(res).toBeDefined(); - expect(searchSpy).toHaveBeenCalled(); - expect(service.queryParams).toEqual({ - search: 'fake', - application: 'fake-app-name', - group: 'fake-group-1,fake-group-2' + service + .search('fake', { + roles: [], + groups: ['fake-group-1', 'fake-group-2'], + withinApplication: 'fake-app-name' + }) + .subscribe((res) => { + expect(res).toBeDefined(); + expect(searchSpy).toHaveBeenCalled(); + expect(service.queryParams).toEqual({ + search: 'fake', + application: 'fake-app-name', + group: 'fake-group-1,fake-group-2' + }); + done(); }); - done(); - }); }); it('should not fetch users within app if error occurred', (done) => { requestSpy.and.returnValue(Promise.reject(mockHttpErrorResponse)); - service.search('fake', mockSearchUserByApp).subscribe( - () => { - fail('expected an error, not users'); - }, - (error) => { - expect(error.status).toEqual(404); - expect(error.statusText).toEqual('Not Found'); - expect(error.error).toEqual('Mock Error'); - done(); - } - ); + service + .search('fake', { + roles: [], + groups: [], + withinApplication: 'fake-app-name' + }) + .subscribe( + () => { + fail('expected an error, not users'); + }, + (error) => { + expect(error.status).toEqual(404); + expect(error.statusText).toEqual('Not Found'); + expect(error.error).toEqual('Mock Error'); + done(); + } + ); }); }); }); diff --git a/lib/process-services-cloud/src/lib/people/services/identity-user.service.ts b/lib/process-services-cloud/src/lib/people/services/identity-user.service.ts index 385fdfcac39..1c40af59d2a 100644 --- a/lib/process-services-cloud/src/lib/people/services/identity-user.service.ts +++ b/lib/process-services-cloud/src/lib/people/services/identity-user.service.ts @@ -18,7 +18,6 @@ import { Injectable } from '@angular/core'; import { AppConfigService, JwtHelperService, OAuth2Service } from '@alfresco/adf-core'; import { EMPTY, Observable } from 'rxjs'; -import { IdentityUserServiceInterface } from './identity-user.service.interface'; import { IdentityUserModel } from '../models/identity-user.model'; import { IdentityUserFilterInterface } from './identity-user-filter.interface'; @@ -27,7 +26,7 @@ const IDENTITY_MICRO_SERVICE_INGRESS = 'identity-adapter-service'; @Injectable({ providedIn: 'root' }) -export class IdentityUserService implements IdentityUserServiceInterface { +export class IdentityUserService { queryParams: { search: string; application?: string; roles?: string[]; groups?: string[] }; constructor(private jwtHelperService: JwtHelperService, private oAuth2Service: OAuth2Service, private appConfigService: AppConfigService) {} diff --git a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts index 9e36cfbb84d..1d5c707a907 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts @@ -123,7 +123,7 @@ describe('EditProcessFilterCloudComponent', () => { { provide: DateAdapter, useClass: DateFnsAdapter }, { provide: NotificationCloudService, useValue: { makeGQLQuery: () => of([]) } }, { provide: MAT_DATE_FORMATS, useValue: ADF_DATE_FORMATS }, - { provide: IdentityUserService, useExisting: IdentityUserServiceMock } + { provide: IdentityUserService, useClass: IdentityUserServiceMock } ], declarations: [DateRangeFilterComponent] }); From b37fdd70ed5e4bb6279517426f6bebc2787e3e7a Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 13:01:28 -0500 Subject: [PATCH 12/30] cleanup --- .../src/lib/group/mock/group-cloud.mock.ts | 11 +- .../group/mock/identity-group.service.mock.ts | 39 ----- .../identity-group.service.interface.ts | 24 --- .../services/identity-group.service.spec.ts | 148 ++++++++++-------- .../group/services/identity-group.service.ts | 23 ++- .../services/identity-user.service.spec.ts | 8 +- 6 files changed, 107 insertions(+), 146 deletions(-) delete mode 100644 lib/process-services-cloud/src/lib/group/mock/identity-group.service.mock.ts delete mode 100644 lib/process-services-cloud/src/lib/group/services/identity-group.service.interface.ts diff --git a/lib/process-services-cloud/src/lib/group/mock/group-cloud.mock.ts b/lib/process-services-cloud/src/lib/group/mock/group-cloud.mock.ts index 1d0838ee099..a562a63efbf 100644 --- a/lib/process-services-cloud/src/lib/group/mock/group-cloud.mock.ts +++ b/lib/process-services-cloud/src/lib/group/mock/group-cloud.mock.ts @@ -18,19 +18,16 @@ import { Injectable } from '@angular/core'; import { Observable, EMPTY, of } from 'rxjs'; import { IdentityGroupModel } from '../models/identity-group.model'; -import { IdentityGroupFilterInterface } from '../services/identity-group-filter.interface'; -import { IdentityGroupServiceInterface } from '../services/identity-group.service.interface'; +import { IdentityGroupService } from '@alfresco/adf-process-services-cloud'; export const mockVegetableAubergine: IdentityGroupModel = { id: 'aubergine', name: 'Vegetable Aubergine' }; export const mockMeatChicken: IdentityGroupModel = { id: 'chicken', name: 'Meat Chicken' }; export const mockFoodGroups = [mockVegetableAubergine, mockMeatChicken]; -@Injectable({ - providedIn: 'root' -}) -export class IdentityGroupServiceMock implements IdentityGroupServiceInterface { - search(name: string, _filters?: IdentityGroupFilterInterface): Observable { +@Injectable() +export class IdentityGroupServiceMock extends IdentityGroupService { + search(name: string): Observable { if (name.trim() === '') { return EMPTY; } diff --git a/lib/process-services-cloud/src/lib/group/mock/identity-group.service.mock.ts b/lib/process-services-cloud/src/lib/group/mock/identity-group.service.mock.ts deleted file mode 100644 index 772a22faa9d..00000000000 --- a/lib/process-services-cloud/src/lib/group/mock/identity-group.service.mock.ts +++ /dev/null @@ -1,39 +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. - */ - -import { HttpErrorResponse } from '@angular/common/http'; -import { IdentityGroupFilterInterface } from '../services/identity-group-filter.interface'; - -export const mockSearchGroupByRoles: IdentityGroupFilterInterface = { - roles: ['fake-role-1', 'fake-role-2'], - withinApplication: '' -}; - -export const mockSearchGroupByRolesAndApp: IdentityGroupFilterInterface = { - roles: ['fake-role-1', 'fake-role-2'], - withinApplication: 'fake-app-name' -}; - -export const mockSearchGroupByApp: IdentityGroupFilterInterface = { - roles: [], - withinApplication: 'fake-app-name' -}; - -export const mockHttpErrorResponse = new HttpErrorResponse({ - error: 'Mock Error', - status: 404, statusText: 'Not Found' -}); diff --git a/lib/process-services-cloud/src/lib/group/services/identity-group.service.interface.ts b/lib/process-services-cloud/src/lib/group/services/identity-group.service.interface.ts deleted file mode 100644 index bb1a822b325..00000000000 --- a/lib/process-services-cloud/src/lib/group/services/identity-group.service.interface.ts +++ /dev/null @@ -1,24 +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. - */ - -import { Observable } from 'rxjs'; -import { IdentityGroupModel } from '../models/identity-group.model'; -import { IdentityGroupFilterInterface } from './identity-group-filter.interface'; - -export interface IdentityGroupServiceInterface { - search(name: string, filters?: IdentityGroupFilterInterface): Observable; -} diff --git a/lib/process-services-cloud/src/lib/group/services/identity-group.service.spec.ts b/lib/process-services-cloud/src/lib/group/services/identity-group.service.spec.ts index 192c49ef787..33dc34443b9 100644 --- a/lib/process-services-cloud/src/lib/group/services/identity-group.service.spec.ts +++ b/lib/process-services-cloud/src/lib/group/services/identity-group.service.spec.ts @@ -18,15 +18,16 @@ import { TestBed } from '@angular/core/testing'; import { TranslateModule } from '@ngx-translate/core'; import { IdentityGroupService } from './identity-group.service'; -import { - mockHttpErrorResponse, - mockSearchGroupByApp, - mockSearchGroupByRoles, - mockSearchGroupByRolesAndApp -} from '../mock/identity-group.service.mock'; import { mockFoodGroups } from '../mock/group-cloud.mock'; import { AdfHttpClient } from '@alfresco/adf-core/api'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpErrorResponse } from '@angular/common/http'; + +const mockHttpErrorResponse = new HttpErrorResponse({ + error: 'Mock Error', + status: 404, + statusText: 'Not Found' +}); describe('IdentityGroupService', () => { let service: IdentityGroupService; @@ -81,86 +82,111 @@ describe('IdentityGroupService', () => { requestSpy.and.returnValue(Promise.resolve(mockFoodGroups)); const searchSpy = spyOn(service, 'search').and.callThrough(); - service.search('fake', mockSearchGroupByRoles).subscribe((res) => { - expect(res).toBeDefined(); - expect(searchSpy).toHaveBeenCalled(); - expect(service.queryParams).toEqual({ - search: 'fake', - role: 'fake-role-1,fake-role-2' + service + .search('fake', { + roles: ['fake-role-1', 'fake-role-2'], + withinApplication: '' + }) + .subscribe((res) => { + expect(res).toBeDefined(); + expect(searchSpy).toHaveBeenCalled(); + expect(service.queryParams).toEqual({ + search: 'fake', + role: 'fake-role-1,fake-role-2' + }); + done(); }); - done(); - }); }); it('should not fetch groups by roles if error occurred', (done) => { requestSpy.and.returnValue(Promise.reject(mockHttpErrorResponse)); const searchSpy = spyOn(service, 'search').and.callThrough(); - service.search('fake', mockSearchGroupByRoles).subscribe( - () => { - fail('expected an error, not groups'); - }, - (error) => { - expect(searchSpy).toHaveBeenCalled(); - expect(service.queryParams).toEqual({ - search: 'fake', - role: 'fake-role-1,fake-role-2' - }); - expect(error.status).toEqual(404); - expect(error.statusText).toEqual('Not Found'); - expect(error.error).toEqual('Mock Error'); - done(); - } - ); + service + .search('fake', { + roles: ['fake-role-1', 'fake-role-2'], + withinApplication: '' + }) + .subscribe( + () => { + fail('expected an error, not groups'); + }, + (error) => { + expect(searchSpy).toHaveBeenCalled(); + expect(service.queryParams).toEqual({ + search: 'fake', + role: 'fake-role-1,fake-role-2' + }); + expect(error.status).toEqual(404); + expect(error.statusText).toEqual('Not Found'); + expect(error.error).toEqual('Mock Error'); + done(); + } + ); }); it('should fetch groups within app', (done) => { requestSpy.and.returnValue(Promise.resolve(mockFoodGroups)); - service.search('fake', mockSearchGroupByApp).subscribe((res) => { - expect(res).toBeDefined(); - expect(service.queryParams).toEqual({ - search: 'fake', - application: 'fake-app-name' + service + .search('fake', { + roles: [], + withinApplication: 'fake-app-name' + }) + .subscribe((res) => { + expect(res).toBeDefined(); + expect(service.queryParams).toEqual({ + search: 'fake', + application: 'fake-app-name' + }); + done(); }); - done(); - }); }); it('should fetch groups within app with roles', (done) => { requestSpy.and.returnValue(Promise.resolve(mockFoodGroups)); - service.search('fake', mockSearchGroupByRolesAndApp).subscribe((res) => { - expect(res).toBeDefined(); - expect(service.queryParams).toEqual({ - search: 'fake', - application: 'fake-app-name', - role: 'fake-role-1,fake-role-2' + service + .search('fake', { + roles: ['fake-role-1', 'fake-role-2'], + withinApplication: 'fake-app-name' + }) + .subscribe((res) => { + expect(res).toBeDefined(); + expect(service.queryParams).toEqual({ + search: 'fake', + application: 'fake-app-name', + role: 'fake-role-1,fake-role-2' + }); + done(); }); - done(); - }); }); it('should not fetch groups within app if error occurred', (done) => { requestSpy.and.returnValue(Promise.reject(mockHttpErrorResponse)); const searchSpy = spyOn(service, 'search').and.callThrough(); - service.search('fake', mockSearchGroupByApp).subscribe( - () => { - fail('expected an error, not groups'); - }, - (error) => { - expect(searchSpy).toHaveBeenCalled(); - expect(service.queryParams).toEqual({ - search: 'fake', - application: 'fake-app-name' - }); - expect(error.status).toEqual(404); - expect(error.statusText).toEqual('Not Found'); - expect(error.error).toEqual('Mock Error'); - done(); - } - ); + service + .search('fake', { + roles: [], + withinApplication: 'fake-app-name' + }) + .subscribe( + () => { + fail('expected an error, not groups'); + }, + (error) => { + expect(searchSpy).toHaveBeenCalled(); + expect(service.queryParams).toEqual({ + search: 'fake', + application: 'fake-app-name' + }); + expect(error.status).toEqual(404); + expect(error.statusText).toEqual('Not Found'); + expect(error.error).toEqual('Mock Error'); + done(); + } + ); }); }); }); diff --git a/lib/process-services-cloud/src/lib/group/services/identity-group.service.ts b/lib/process-services-cloud/src/lib/group/services/identity-group.service.ts index 67170e2a865..64c84cf39bb 100644 --- a/lib/process-services-cloud/src/lib/group/services/identity-group.service.ts +++ b/lib/process-services-cloud/src/lib/group/services/identity-group.service.ts @@ -18,21 +18,16 @@ import { Injectable } from '@angular/core'; import { AppConfigService, OAuth2Service } from '@alfresco/adf-core'; import { EMPTY, Observable } from 'rxjs'; -import { IdentityGroupServiceInterface } from './identity-group.service.interface'; import { IdentityGroupFilterInterface } from './identity-group-filter.interface'; import { IdentityGroupModel } from '../models/identity-group.model'; const IDENTITY_MICRO_SERVICE_INGRESS = 'identity-adapter-service'; @Injectable({ providedIn: 'root' }) -export class IdentityGroupService implements IdentityGroupServiceInterface { +export class IdentityGroupService { + queryParams: { search: string; application?: string; roles?: string[] }; - queryParams: { search: string; application?: string; roles?: string [] }; - - constructor( - private oAuth2Service: OAuth2Service, - private appConfigService: AppConfigService - ) {} + constructor(private oAuth2Service: OAuth2Service, private appConfigService: AppConfigService) {} public search(name: string, filters?: IdentityGroupFilterInterface): Observable { if (name.trim() === '') { @@ -52,13 +47,13 @@ export class IdentityGroupService implements IdentityGroupServiceInterface { return this.invokeIdentityGroupApi(); } - private searchGroupsWithGlobalRoles(name: string, roles: string []): Observable { + private searchGroupsWithGlobalRoles(name: string, roles: string[]): Observable { this.buildQueryParam(name, roles); return this.invokeIdentityGroupApi(); } - private searchGroupsWithinApp(name: string, applicationName: string, roles?: string []): Observable { + private searchGroupsWithinApp(name: string, applicationName: string, roles?: string[]): Observable { this.buildQueryParam(name, roles, applicationName); return this.invokeIdentityGroupApi(); @@ -69,13 +64,13 @@ export class IdentityGroupService implements IdentityGroupServiceInterface { return this.oAuth2Service.get({ url, queryParams: this.queryParams }); } - private buildQueryParam(name: string, roles?: string [], applicationName?: string) { + private buildQueryParam(name: string, roles?: string[], applicationName?: string) { this.queryParams = { search: name }; this.addOptionalValueToQueryParam('application', applicationName); this.addOptionalCommaValueToQueryParam('role', roles); } - private addOptionalCommaValueToQueryParam(key: string, values: string []) { + private addOptionalCommaValueToQueryParam(key: string, values: string[]) { if (values?.length > 0) { const valuesNotEmpty = this.filterOutEmptyValue(values); if (valuesNotEmpty?.length > 0) { @@ -90,8 +85,8 @@ export class IdentityGroupService implements IdentityGroupServiceInterface { } } - private filterOutEmptyValue(roles: string []): string [] { - return roles.filter( role => role.trim() ? true : false); + private filterOutEmptyValue(roles: string[]): string[] { + return roles.filter((role) => (role.trim() ? true : false)); } private get identityHost(): string { diff --git a/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts b/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts index 1da1846a53b..04fd50b7350 100644 --- a/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts +++ b/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts @@ -20,7 +20,13 @@ import { IdentityUserService } from './identity-user.service'; import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { mockFoodUsers } from '../mock/people-cloud.mock'; import { AdfHttpClient } from '@alfresco/adf-core/api'; -import { mockHttpErrorResponse } from '../../group/mock/identity-group.service.mock'; +import { HttpErrorResponse } from '@angular/common/http'; + +const mockHttpErrorResponse = new HttpErrorResponse({ + error: 'Mock Error', + status: 404, + statusText: 'Not Found' +}); describe('IdentityUserService', () => { let service: IdentityUserService; From 70c77de7c2e9ebd2085cbecaf9a6f812601aacfd Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 13:06:33 -0500 Subject: [PATCH 13/30] cleanup --- docs/core/services/identity-group.service.md | 9 ++++---- .../identity-group-filter.interface.ts | 21 ------------------- .../group/services/identity-group.service.ts | 6 +++++- 3 files changed, 9 insertions(+), 27 deletions(-) delete mode 100644 lib/process-services-cloud/src/lib/group/services/identity-group-filter.interface.ts diff --git a/docs/core/services/identity-group.service.md b/docs/core/services/identity-group.service.md index 3d955de0a12..533a79cec39 100644 --- a/docs/core/services/identity-group.service.md +++ b/docs/core/services/identity-group.service.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2019-07-13 --- -# [Identity Group service](../../../lib/process-services-cloud/src/lib/group/services/identity-group.service.ts "Defined in identity-group.service.ts") +# Identity Group service Performs CRUD operations on identity groups. @@ -13,11 +13,10 @@ Performs CRUD operations on identity groups. ### Methods -- **search**(name: `string`, filters?: [`IdentityGroupFilterInterface`](../../../lib/process-services-cloud/src/lib/group/services/identity-group-filter.interface.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupModel`](../../../lib/process-services-cloud/src/lib/group/models/identity-group.model.ts)`[]>`
- +- **search**(name: `string`, filters?: `IdentityGroupFilterInterface`)): `Observable` - _name:_ `string` - - - _filters:_ [`IdentityGroupFilterInterface`](../../../lib/process-services-cloud/src/lib/group/services/identity-group-filter.interface.ts) - (Optional) - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityGroupModel`](../../../lib/process-services-cloud/src/lib/group/models/identity-group.model.ts)`[]>` - + - _filters:_ `IdentityGroupFilterInterface - (Optional) + - **Returns** `Observable` - ## See also diff --git a/lib/process-services-cloud/src/lib/group/services/identity-group-filter.interface.ts b/lib/process-services-cloud/src/lib/group/services/identity-group-filter.interface.ts deleted file mode 100644 index c465af11007..00000000000 --- a/lib/process-services-cloud/src/lib/group/services/identity-group-filter.interface.ts +++ /dev/null @@ -1,21 +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. - */ - -export interface IdentityGroupFilterInterface { - roles?: string[]; - withinApplication?: string; -} diff --git a/lib/process-services-cloud/src/lib/group/services/identity-group.service.ts b/lib/process-services-cloud/src/lib/group/services/identity-group.service.ts index 64c84cf39bb..de6f7506666 100644 --- a/lib/process-services-cloud/src/lib/group/services/identity-group.service.ts +++ b/lib/process-services-cloud/src/lib/group/services/identity-group.service.ts @@ -18,11 +18,15 @@ import { Injectable } from '@angular/core'; import { AppConfigService, OAuth2Service } from '@alfresco/adf-core'; import { EMPTY, Observable } from 'rxjs'; -import { IdentityGroupFilterInterface } from './identity-group-filter.interface'; import { IdentityGroupModel } from '../models/identity-group.model'; const IDENTITY_MICRO_SERVICE_INGRESS = 'identity-adapter-service'; +export interface IdentityGroupFilterInterface { + roles?: string[]; + withinApplication?: string; +} + @Injectable({ providedIn: 'root' }) export class IdentityGroupService { queryParams: { search: string; application?: string; roles?: string[] }; From 82f4d390a9d4bae862560a851e5ef2aceb1d9052 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 13:13:11 -0500 Subject: [PATCH 14/30] cleanup --- docs/core/services/identity-user.service.md | 14 +++++------ .../src/lib/people/mock/people-cloud.mock.ts | 3 +-- .../identity-user-filter.interface.ts | 22 ---------------- .../identity-user.service.interface.ts | 25 ------------------- .../people/services/identity-user.service.ts | 7 +++++- 5 files changed, 13 insertions(+), 58 deletions(-) delete mode 100644 lib/process-services-cloud/src/lib/people/services/identity-user-filter.interface.ts delete mode 100644 lib/process-services-cloud/src/lib/people/services/identity-user.service.interface.ts diff --git a/docs/core/services/identity-user.service.md b/docs/core/services/identity-user.service.md index 83f20e4369f..bc014322a2d 100644 --- a/docs/core/services/identity-user.service.md +++ b/docs/core/services/identity-user.service.md @@ -5,7 +5,7 @@ Status: Active Last reviewed: 2019-07-12 --- -# [Identity user service](../../../lib/process-services-cloud/src/lib/people/services/identity-user.service.ts "Defined in identity-user.service.ts") +# Identity User Service Gets OAuth2 personal details and roles for users and performs CRUD operations on identity users. @@ -13,14 +13,12 @@ Gets OAuth2 personal details and roles for users and performs CRUD operations on ### Methods -- **getCurrentUserInfo**(): [`IdentityUserModel`](../../../lib/process-services-cloud/src/lib/people/models/identity-user.model.ts)
- Gets the name and other basic details of the current user. - - **Returns** [`IdentityUserModel`](../../../lib/process-services-cloud/src/lib/people/models/identity-user.model.ts) - The user's details -- **search**(name: `string`, filters?: [`IdentityUserFilterInterface`](../../../lib/process-services-cloud/src/lib/people/services/identity-user-filter.interface.ts)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserModel`](../../../lib/process-services-cloud/src/lib/people/models/identity-user.model.ts)`[]>`
- Search users based on name input and filters. +- **getCurrentUserInfo**(): `IdentityUserModel` - Gets the name and other basic details of the current user. + - **Returns** `IdentityUserMode` - The user's details +- **search**(name: `string`, filters?: `IdentityUserFilterInterface`)): `Observable` - Search users based on name input and filters. - _name:_ `string` - Search query string - - _filters:_ [`IdentityUserFilterInterface`](../../../lib/process-services-cloud/src/lib/people/services/identity-user-filter.interface.ts) - (Optional) - - **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`IdentityUserModel`](../../../lib/process-services-cloud/src/lib/people/models/identity-user.model.ts)`[]>` - List of users + - _filters:_ `IdentityUserFilterInterface` - (Optional) + - **Returns** `Observable` - List of users ## See also diff --git a/lib/process-services-cloud/src/lib/people/mock/people-cloud.mock.ts b/lib/process-services-cloud/src/lib/people/mock/people-cloud.mock.ts index 1ecf814696c..d8e8b34f86b 100644 --- a/lib/process-services-cloud/src/lib/people/mock/people-cloud.mock.ts +++ b/lib/process-services-cloud/src/lib/people/mock/people-cloud.mock.ts @@ -18,7 +18,6 @@ import { Injectable } from '@angular/core'; import { Observable, EMPTY, of } from 'rxjs'; import { IdentityUserModel } from '../models/identity-user.model'; -import { IdentityUserFilterInterface } from '../services/identity-user-filter.interface'; import { IdentityUserService } from '@alfresco/adf-process-services-cloud'; export const mockYorkshirePudding: IdentityUserModel = { @@ -58,7 +57,7 @@ export class IdentityUserServiceMock extends IdentityUserService { return mockKielbasaSausage; } - search(name: string, _filters?: IdentityUserFilterInterface): Observable { + search(name: string): Observable { if (name.trim() === '') { return EMPTY; } diff --git a/lib/process-services-cloud/src/lib/people/services/identity-user-filter.interface.ts b/lib/process-services-cloud/src/lib/people/services/identity-user-filter.interface.ts deleted file mode 100644 index 08163eb4b22..00000000000 --- a/lib/process-services-cloud/src/lib/people/services/identity-user-filter.interface.ts +++ /dev/null @@ -1,22 +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. - */ - -export interface IdentityUserFilterInterface { - roles?: string[]; - withinApplication?: string; - groups?: string[]; -} diff --git a/lib/process-services-cloud/src/lib/people/services/identity-user.service.interface.ts b/lib/process-services-cloud/src/lib/people/services/identity-user.service.interface.ts deleted file mode 100644 index 7424e05d7eb..00000000000 --- a/lib/process-services-cloud/src/lib/people/services/identity-user.service.interface.ts +++ /dev/null @@ -1,25 +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. - */ - -import { Observable } from 'rxjs'; -import { IdentityUserModel } from '../models/identity-user.model'; -import { IdentityUserFilterInterface } from './identity-user-filter.interface'; - -export interface IdentityUserServiceInterface { - getCurrentUserInfo(): IdentityUserModel; - search(name: string, filters?: IdentityUserFilterInterface): Observable; -} diff --git a/lib/process-services-cloud/src/lib/people/services/identity-user.service.ts b/lib/process-services-cloud/src/lib/people/services/identity-user.service.ts index 1c40af59d2a..7c78d19e925 100644 --- a/lib/process-services-cloud/src/lib/people/services/identity-user.service.ts +++ b/lib/process-services-cloud/src/lib/people/services/identity-user.service.ts @@ -19,10 +19,15 @@ import { Injectable } from '@angular/core'; import { AppConfigService, JwtHelperService, OAuth2Service } from '@alfresco/adf-core'; import { EMPTY, Observable } from 'rxjs'; import { IdentityUserModel } from '../models/identity-user.model'; -import { IdentityUserFilterInterface } from './identity-user-filter.interface'; const IDENTITY_MICRO_SERVICE_INGRESS = 'identity-adapter-service'; +export interface IdentityUserFilterInterface { + roles?: string[]; + withinApplication?: string; + groups?: string[]; +} + @Injectable({ providedIn: 'root' }) From a13d2f2d3d966f19faa84f012c7fe470d3b5bc1b Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 13:38:27 -0500 Subject: [PATCH 15/30] date range filter --- .../src/lib/app/app-list-cloud.module.ts | 8 ----- .../date-range-filter.component.spec.ts | 2 +- .../date-range-filter.component.stories.ts | 3 +- .../date-range-filter.component.ts | 10 ++++-- .../src/lib/common/process-common.module.ts | 32 ------------------- ...dit-process-filter-cloud.component.spec.ts | 6 ++-- .../process-filters-cloud.module.ts | 4 +-- .../task-filters/task-filters-cloud.module.ts | 4 +-- 8 files changed, 17 insertions(+), 52 deletions(-) delete mode 100644 lib/process-services-cloud/src/lib/common/process-common.module.ts diff --git a/lib/process-services-cloud/src/lib/app/app-list-cloud.module.ts b/lib/process-services-cloud/src/lib/app/app-list-cloud.module.ts index 5fff515a52b..ec236e049e9 100644 --- a/lib/process-services-cloud/src/lib/app/app-list-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/app/app-list-cloud.module.ts @@ -15,15 +15,7 @@ * limitations under the License. */ -import { NgModule } from '@angular/core'; import { AppDetailsCloudComponent } from './components/app-details-cloud/app-details-cloud.component'; import { AppListCloudComponent } from './components/app-list-cloud/app-list-cloud.component'; export const APP_LIST_CLOUD_DIRECTIVES = [AppListCloudComponent, AppDetailsCloudComponent] as const; - -/** @deprecated use `...APP_LIST_CLOUD_DIRECTIVES` instead */ -@NgModule({ - imports: [...APP_LIST_CLOUD_DIRECTIVES], - exports: [...APP_LIST_CLOUD_DIRECTIVES] -}) -export class AppListCloudModule {} diff --git a/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.spec.ts b/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.spec.ts index bb36ba0dc30..9753db9287a 100644 --- a/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.spec.ts +++ b/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.spec.ts @@ -37,7 +37,7 @@ describe('DateRangeFilterComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [ProcessServiceCloudTestingModule, DateRangeFilterComponent] }); fixture = TestBed.createComponent(DateRangeFilterComponent); component = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.stories.ts b/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.stories.ts index e93720b746b..cc70f31ae16 100644 --- a/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.stories.ts +++ b/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.stories.ts @@ -18,7 +18,6 @@ import { applicationConfig, Meta, moduleMetadata, StoryFn } from '@storybook/angular'; import { ProcessServicesCloudStoryModule } from '../../testing/process-services-cloud-story.module'; import { mockFilterProperty } from '../mock/date-range-filter.mock'; -import { ProcessCommonModule } from '../process-common.module'; import { DateRangeFilterComponent } from './date-range-filter.component'; import { importProvidersFrom } from '@angular/core'; @@ -27,7 +26,7 @@ export default { title: 'Process Services Cloud/Process Common/Date Range Filter', decorators: [ moduleMetadata({ - imports: [ProcessCommonModule] + imports: [DateRangeFilterComponent] }), applicationConfig({ providers: [importProvidersFrom(ProcessServicesCloudStoryModule)] diff --git a/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.ts b/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.ts index fced08a9c0e..03773142bf6 100644 --- a/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.ts +++ b/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.ts @@ -16,13 +16,17 @@ */ import { Component, Input, EventEmitter, Output, OnInit } from '@angular/core'; -import { MatSelectChange } from '@angular/material/select'; +import { MatSelectChange, MatSelectModule } from '@angular/material/select'; import { ProcessFilterProperties, ProcessFilterOptions } from '../../process/process-filters/models/process-filter-cloud.model'; -import { FormGroup, FormControl } from '@angular/forms'; +import { FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms'; import { DateRangeFilter, DateCloudFilterType } from '../../models/date-cloud-filter.model'; import { endOfDay, isValid, startOfDay } from 'date-fns'; import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import { ADF_DATE_FORMATS, AdfDateFnsAdapter } from '@alfresco/adf-core'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatFormFieldModule } from '@angular/material/form-field'; interface DateRangeFormProps { from: FormControl; @@ -31,6 +35,8 @@ interface DateRangeFormProps { @Component({ selector: 'adf-cloud-date-range-filter', + standalone: true, + imports: [CommonModule, TranslateModule, MatDatepickerModule, MatFormFieldModule, ReactiveFormsModule, MatSelectModule], styleUrls: ['./date-range-filter.component.scss'], templateUrl: './date-range-filter.component.html', providers: [ diff --git a/lib/process-services-cloud/src/lib/common/process-common.module.ts b/lib/process-services-cloud/src/lib/common/process-common.module.ts deleted file mode 100644 index d4a019b861f..00000000000 --- a/lib/process-services-cloud/src/lib/common/process-common.module.ts +++ /dev/null @@ -1,32 +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. - */ - -import { NgModule } from '@angular/core'; -import { CoreModule } from '@alfresco/adf-core'; -import { DateRangeFilterComponent } from './date-range-filter/date-range-filter.component'; -import { MaterialModule } from '../material.module'; -import { CommonModule } from '@angular/common'; -import { DateRangeFilterService } from './date-range-filter/date-range-filter.service'; -import { ReactiveFormsModule } from '@angular/forms'; - -@NgModule({ - declarations: [DateRangeFilterComponent], - imports: [CommonModule, CoreModule, MaterialModule, ReactiveFormsModule], - exports: [DateRangeFilterComponent], - providers: [DateRangeFilterService] -}) -export class ProcessCommonModule {} diff --git a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts index 1d5c707a907..3a18dc27150 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.spec.ts @@ -115,7 +115,8 @@ describe('EditProcessFilterCloudComponent', () => { ReactiveFormsModule, MatChipsModule, MatProgressBarModule, - PeopleCloudComponent + PeopleCloudComponent, + DateRangeFilterComponent ], providers: [ { provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }, @@ -124,8 +125,7 @@ describe('EditProcessFilterCloudComponent', () => { { provide: NotificationCloudService, useValue: { makeGQLQuery: () => of([]) } }, { provide: MAT_DATE_FORMATS, useValue: ADF_DATE_FORMATS }, { provide: IdentityUserService, useClass: IdentityUserServiceMock } - ], - declarations: [DateRangeFilterComponent] + ] }); fixture = TestBed.createComponent(EditProcessFilterCloudComponent); component = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts index 3033f0f24b8..7524f57e74e 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/process-filters-cloud.module.ts @@ -25,8 +25,8 @@ import { HttpClientModule } from '@angular/common/http'; import { EditProcessFilterCloudComponent } from './components/edit-process-filter-cloud.component'; import { ProcessFilterDialogCloudComponent } from './components/process-filter-dialog-cloud.component'; import { APP_LIST_CLOUD_DIRECTIVES } from './../../app/app-list-cloud.module'; -import { ProcessCommonModule } from '../../common/process-common.module'; import { PeopleCloudComponent } from '../../people/components/people-cloud.component'; +import { DateRangeFilterComponent } from '../../common/date-range-filter/date-range-filter.component'; @NgModule({ imports: [ @@ -37,7 +37,7 @@ import { PeopleCloudComponent } from '../../people/components/people-cloud.compo MaterialModule, ...APP_LIST_CLOUD_DIRECTIVES, CoreModule, - ProcessCommonModule, + DateRangeFilterComponent, PeopleCloudComponent ], declarations: [ProcessFiltersCloudComponent, EditProcessFilterCloudComponent, ProcessFilterDialogCloudComponent], diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index f98fc8658f2..a1bfd448b8a 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -22,7 +22,6 @@ import { TaskFiltersCloudComponent } from './components/task-filters/task-filter import { MaterialModule } from '../../material.module'; import { CoreModule } from '@alfresco/adf-core'; import { HttpClientModule } from '@angular/common/http'; -import { ProcessCommonModule } from '../../common/process-common.module'; import { EditServiceTaskFilterCloudComponent } from './components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component'; import { EditTaskFilterCloudComponent } from './components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component'; import { TaskFilterDialogCloudComponent } from './components/task-filter-dialog/task-filter-dialog-cloud.component'; @@ -32,6 +31,7 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { APP_LIST_CLOUD_DIRECTIVES } from '../../app/app-list-cloud.module'; import { GroupCloudComponent } from '../../group/components/group-cloud.component'; import { PeopleCloudComponent } from '../../people/components/people-cloud.component'; +import { DateRangeFilterComponent } from '../../common/date-range-filter/date-range-filter.component'; @NgModule({ imports: [ @@ -43,7 +43,7 @@ import { PeopleCloudComponent } from '../../people/components/people-cloud.compo ...APP_LIST_CLOUD_DIRECTIVES, CoreModule, GroupCloudComponent, - ProcessCommonModule, + DateRangeFilterComponent, PeopleCloudComponent, MatProgressSpinnerModule, TaskFilterDialogCloudComponent, From a73f4a5bdb8bdcaa8fa4e956e835cf7c015a18e4 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 13:50:58 -0500 Subject: [PATCH 16/30] service task filters --- .../service-task-filters-cloud.component.spec.ts | 2 +- .../service-task-filters-cloud.component.ts | 8 +++++++- .../lib/task/task-filters/task-filters-cloud.module.ts | 10 +++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts index 9e24ef48d43..33ffb032630 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts @@ -36,7 +36,7 @@ describe('ServiceTaskFiltersCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule], + imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, ServiceTaskFiltersCloudComponent], providers: [{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); fixture = TestBed.createComponent(ServiceTaskFiltersCloudComponent); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.ts index 578f102ff36..2fbc3580652 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.ts @@ -20,11 +20,17 @@ import { Observable } from 'rxjs'; import { FilterParamsModel, ServiceTaskFilterCloudModel } from '../../models/filter-cloud.model'; import { BaseTaskFiltersCloudComponent } from '../base-task-filters-cloud.component'; import { ServiceTaskFilterCloudService } from '../../services/service-task-filter-cloud.service'; -import { TranslationService } from '@alfresco/adf-core'; +import { IconComponent, TranslationService } from '@alfresco/adf-core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { MatListModule } from '@angular/material/list'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; @Component({ selector: 'adf-cloud-service-task-filters', + standalone: true, + imports: [CommonModule, TranslateModule, MatListModule, IconComponent, MatProgressSpinnerModule], templateUrl: './service-task-filters-cloud.component.html', styleUrls: ['./service-task-filters-cloud.component.scss'], encapsulation: ViewEncapsulation.None diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index a1bfd448b8a..8212dce3cdb 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -47,14 +47,10 @@ import { DateRangeFilterComponent } from '../../common/date-range-filter/date-ra PeopleCloudComponent, MatProgressSpinnerModule, TaskFilterDialogCloudComponent, - TaskFiltersCloudComponent - ], - declarations: [ - ServiceTaskFiltersCloudComponent, - EditTaskFilterCloudComponent, - EditServiceTaskFilterCloudComponent, - TaskAssignmentFilterCloudComponent + TaskFiltersCloudComponent, + ServiceTaskFiltersCloudComponent ], + declarations: [EditTaskFilterCloudComponent, EditServiceTaskFilterCloudComponent, TaskAssignmentFilterCloudComponent], exports: [TaskFiltersCloudComponent, ServiceTaskFiltersCloudComponent, EditTaskFilterCloudComponent, EditServiceTaskFilterCloudComponent] }) export class TaskFiltersCloudModule {} From b09c415ddf431ef7d01e818b71ff1f9436726b40 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 14:00:35 -0500 Subject: [PATCH 17/30] task filters --- .../edit-task-filter-cloud.component.spec.ts | 8 ++++- .../edit-task-filter-cloud.component.ts | 35 +++++++++++++++++++ .../task-assignment-filter.component.html | 1 - .../task-assignment-filter.component.spec.ts | 2 +- .../task-assignment-filter.component.ts | 11 ++++-- .../task-filters/task-filters-cloud.module.ts | 6 ++-- 6 files changed, 55 insertions(+), 8 deletions(-) diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts index e97bf73ebdf..c1f3aaa714d 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts @@ -74,7 +74,13 @@ describe('EditTaskFilterCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, PeopleCloudComponent, MatIconTestingModule], + imports: [ + ProcessServiceCloudTestingModule, + TaskFiltersCloudModule, + PeopleCloudComponent, + MatIconTestingModule, + EditTaskFilterCloudComponent + ], providers: [MatDialog, { provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); fixture = TestBed.createComponent(EditTaskFilterCloudComponent); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.ts index 8e9a04ef747..599010715e9 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.ts @@ -24,9 +24,44 @@ import { DateCloudFilterType } from '../../../../../models/date-cloud-filter.mod import { BaseEditTaskFilterCloudComponent, DropdownOption } from '../base-edit-task-filter-cloud.component'; import { set } from 'date-fns'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { MatExpansionModule } from '@angular/material/expansion'; +import { MatButtonModule } from '@angular/material/button'; +import { IconComponent } from '@alfresco/adf-core'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatSelectModule } from '@angular/material/select'; +import { MatInputModule } from '@angular/material/input'; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatIconModule } from '@angular/material/icon'; +import { MatCheckboxModule } from '@angular/material/checkbox'; +import { DateRangeFilterComponent } from '../../../../../common/date-range-filter/date-range-filter.component'; +import { PeopleCloudComponent } from '../../../../../people/components/people-cloud.component'; +import { TaskAssignmentFilterCloudComponent } from '../../task-assignment-filter/task-assignment-filter.component'; @Component({ selector: 'adf-cloud-edit-task-filter', + standalone: true, + imports: [ + CommonModule, + TranslateModule, + MatExpansionModule, + MatButtonModule, + IconComponent, + MatProgressSpinnerModule, + MatFormFieldModule, + ReactiveFormsModule, + MatSelectModule, + MatInputModule, + MatDatepickerModule, + MatIconModule, + MatCheckboxModule, + DateRangeFilterComponent, + PeopleCloudComponent, + TaskAssignmentFilterCloudComponent + ], templateUrl: './edit-task-filter-cloud.component.html', styleUrls: ['./edit-task-filter-cloud.component.scss'], encapsulation: ViewEncapsulation.None diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.html b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.html index 49fec783f61..a5950086570 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.html +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.html @@ -21,7 +21,6 @@ { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, GroupCloudComponent, TaskFiltersCloudModule] + imports: [ProcessServiceCloudTestingModule, GroupCloudComponent, TaskFiltersCloudModule, TaskAssignmentFilterCloudComponent] }); }); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.ts index 390529ffab8..74a9c45cae7 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.ts @@ -16,21 +16,26 @@ */ import { Component, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges } from '@angular/core'; -import { MatSelectChange } from '@angular/material/select'; +import { MatSelectChange, MatSelectModule } from '@angular/material/select'; import { AssignmentType, TaskFilterProperties, TaskStatusFilter } from '../../models/filter-cloud.model'; import { IdentityUserModel } from '../../../../people/models/identity-user.model'; import { IdentityUserService } from '../../../../people/services/identity-user.service'; import { IdentityGroupModel } from '../../../../group/models/identity-group.model'; import { DropdownOption } from '../edit-task-filters/base-edit-task-filter-cloud.component'; -import { FormControl } from '@angular/forms'; +import { FormControl, FormsModule } from '@angular/forms'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { GroupCloudComponent } from '../../../../group/components/group-cloud.component'; +import { PeopleCloudComponent } from '../../../../people/components/people-cloud.component'; @Component({ selector: 'adf-cloud-task-assignment-filter', + standalone: true, + imports: [CommonModule, GroupCloudComponent, TranslateModule, MatSelectModule, FormsModule, PeopleCloudComponent], templateUrl: './task-assignment-filter.component.html', styleUrls: ['./task-assignment-filter.component.scss'] }) export class TaskAssignmentFilterCloudComponent implements OnInit, OnChanges { - @Input() appName: string; @Input() taskFilterProperty: TaskFilterProperties; diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index 8212dce3cdb..d420f4409ed 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -48,9 +48,11 @@ import { DateRangeFilterComponent } from '../../common/date-range-filter/date-ra MatProgressSpinnerModule, TaskFilterDialogCloudComponent, TaskFiltersCloudComponent, - ServiceTaskFiltersCloudComponent + ServiceTaskFiltersCloudComponent, + EditTaskFilterCloudComponent, + TaskAssignmentFilterCloudComponent ], - declarations: [EditTaskFilterCloudComponent, EditServiceTaskFilterCloudComponent, TaskAssignmentFilterCloudComponent], + declarations: [EditServiceTaskFilterCloudComponent], exports: [TaskFiltersCloudComponent, ServiceTaskFiltersCloudComponent, EditTaskFilterCloudComponent, EditServiceTaskFilterCloudComponent] }) export class TaskFiltersCloudModule {} From 0de3998fd02026faee8723b289b0c31801383a41 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 14:21:31 -0500 Subject: [PATCH 18/30] task filters --- ...t-service-task-filter-cloud.component.html | 2 +- ...ervice-task-filter-cloud.component.spec.ts | 2 +- ...dit-service-task-filter-cloud.component.ts | 35 +++++++++++++++++++ .../task-filters/task-filters-cloud.module.ts | 4 +-- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.html b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.html index c679e221968..921c5d73bda 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.html +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.html @@ -84,7 +84,7 @@ >{{taskFilterProperty.label | translate}}
- { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, MatIconTestingModule], + imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, MatIconTestingModule, EditServiceTaskFilterCloudComponent], providers: [MatDialog, { provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); fixture = TestBed.createComponent(EditServiceTaskFilterCloudComponent); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.ts index 9f112eb47e5..b4c2225e892 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.ts @@ -21,9 +21,44 @@ import { ServiceTaskFilterCloudModel, TaskFilterAction, TaskFilterProperties } f import { ServiceTaskFilterCloudService } from '../../../services/service-task-filter-cloud.service'; import { BaseEditTaskFilterCloudComponent, DropdownOption } from '../base-edit-task-filter-cloud.component'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +import { CommonModule } from '@angular/common'; +import { TranslateModule } from '@ngx-translate/core'; +import { MatExpansionModule } from '@angular/material/expansion'; +import { MatButtonModule } from '@angular/material/button'; +import { IconComponent } from '@alfresco/adf-core'; +import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; +import { ReactiveFormsModule } from '@angular/forms'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatSelectModule } from '@angular/material/select'; +import { MatInputModule } from '@angular/material/input'; +import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatIconModule } from '@angular/material/icon'; +import { MatCheckboxModule } from '@angular/material/checkbox'; +import { DateRangeFilterComponent } from '../../../../../common/date-range-filter/date-range-filter.component'; +import { PeopleCloudComponent } from '../../../../../people/components/people-cloud.component'; +import { TaskAssignmentFilterCloudComponent } from '../../task-assignment-filter/task-assignment-filter.component'; @Component({ selector: 'adf-cloud-edit-service-task-filter', + standalone: true, + imports: [ + CommonModule, + TranslateModule, + MatExpansionModule, + MatButtonModule, + IconComponent, + MatProgressSpinnerModule, + ReactiveFormsModule, + MatFormFieldModule, + MatSelectModule, + MatInputModule, + MatDatepickerModule, + MatIconModule, + MatCheckboxModule, + DateRangeFilterComponent, + PeopleCloudComponent, + TaskAssignmentFilterCloudComponent + ], templateUrl: './edit-service-task-filter-cloud.component.html', styleUrls: ['./edit-service-task-filter-cloud.component.scss'], encapsulation: ViewEncapsulation.None diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index d420f4409ed..a4bbd23d7e8 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -50,9 +50,9 @@ import { DateRangeFilterComponent } from '../../common/date-range-filter/date-ra TaskFiltersCloudComponent, ServiceTaskFiltersCloudComponent, EditTaskFilterCloudComponent, - TaskAssignmentFilterCloudComponent + TaskAssignmentFilterCloudComponent, + EditServiceTaskFilterCloudComponent ], - declarations: [EditServiceTaskFilterCloudComponent], exports: [TaskFiltersCloudComponent, ServiceTaskFiltersCloudComponent, EditTaskFilterCloudComponent, EditServiceTaskFilterCloudComponent] }) export class TaskFiltersCloudModule {} From 1a69385a3032a5d7740b8ef014b35d35a4362cbd Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 14:26:13 -0500 Subject: [PATCH 19/30] task filters --- .../src/lib/task/task-cloud.module.ts | 6 +-- ...ervice-task-filter-cloud.component.spec.ts | 3 +- .../edit-task-filter-cloud.component.spec.ts | 9 +--- ...rvice-task-filters-cloud.component.spec.ts | 3 +- .../task-filters/task-filters-cloud.module.ts | 42 ++++++------------- 5 files changed, 18 insertions(+), 45 deletions(-) diff --git a/lib/process-services-cloud/src/lib/task/task-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-cloud.module.ts index 2a168c02f98..49469480a79 100644 --- a/lib/process-services-cloud/src/lib/task/task-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-cloud.module.ts @@ -17,13 +17,13 @@ import { NgModule } from '@angular/core'; import { TaskListCloudModule } from './task-list/task-list-cloud.module'; -import { TaskFiltersCloudModule } from './task-filters/task-filters-cloud.module'; +import { TASK_FILTERS_CLOUD_DIRECTIVES } from './task-filters/task-filters-cloud.module'; import { TASK_DIRECTIVES } from './directives/task-directive.module'; import { TaskFormModule } from './task-form/task-form.module'; import { TaskHeaderCloudComponent } from './task-header/components/task-header-cloud.component'; @NgModule({ - imports: [TaskListCloudModule, TaskFiltersCloudModule, TaskHeaderCloudComponent, ...TASK_DIRECTIVES, TaskFormModule], - exports: [TaskListCloudModule, TaskFiltersCloudModule, TaskHeaderCloudComponent, ...TASK_DIRECTIVES, TaskFormModule] + imports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_DIRECTIVES, TaskFormModule], + exports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_DIRECTIVES, TaskFormModule] }) export class TaskCloudModule {} diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.spec.ts index 96e8c30ce68..cc451c74018 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.spec.ts @@ -24,7 +24,6 @@ import { LocalPreferenceCloudService } from '../../../../../services/local-prefe import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; import { AppsProcessCloudService } from '../../../../../app/services/apps-process-cloud.service'; import { fakeApplicationInstance, fakeApplicationInstanceWithEnvironment } from '../../../../../app/mock/app-model.mock'; -import { TaskFiltersCloudModule } from '../../../task-filters-cloud.module'; import { ServiceTaskFilterCloudService } from '../../../services/service-task-filter-cloud.service'; import { TaskCloudService } from '../../../../services/task-cloud.service'; import { fakeServiceFilter } from '../../../mock/task-filters-cloud.mock'; @@ -54,7 +53,7 @@ describe('EditServiceTaskFilterCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, MatIconTestingModule, EditServiceTaskFilterCloudComponent], + imports: [ProcessServiceCloudTestingModule, MatIconTestingModule, EditServiceTaskFilterCloudComponent], providers: [MatDialog, { provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); fixture = TestBed.createComponent(EditServiceTaskFilterCloudComponent); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts index c1f3aaa714d..642c48fca14 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts @@ -25,7 +25,6 @@ import { LocalPreferenceCloudService } from '../../../../../services/local-prefe import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; import { AppsProcessCloudService } from '../../../../../app/services/apps-process-cloud.service'; import { fakeApplicationInstance } from '../../../../../app/mock/app-model.mock'; -import { TaskFiltersCloudModule } from '../../../task-filters-cloud.module'; import { EditTaskFilterCloudComponent } from './edit-task-filter-cloud.component'; import { TaskFilterCloudService } from '../../../services/task-filter-cloud.service'; import { TaskCloudService } from '../../../../services/task-cloud.service'; @@ -74,13 +73,7 @@ describe('EditTaskFilterCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - ProcessServiceCloudTestingModule, - TaskFiltersCloudModule, - PeopleCloudComponent, - MatIconTestingModule, - EditTaskFilterCloudComponent - ], + imports: [ProcessServiceCloudTestingModule, PeopleCloudComponent, MatIconTestingModule, EditTaskFilterCloudComponent], providers: [MatDialog, { provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); fixture = TestBed.createComponent(EditTaskFilterCloudComponent); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts index 33ffb032630..eeb29a76740 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts @@ -22,7 +22,6 @@ import { TASK_FILTERS_SERVICE_TOKEN } from '../../../../services/cloud-token.ser import { LocalPreferenceCloudService } from '../../../../services/local-preference-cloud.service'; import { By } from '@angular/platform-browser'; import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; -import { TaskFiltersCloudModule } from '../../task-filters-cloud.module'; import { fakeGlobalServiceFilters } from '../../mock/task-filters-cloud.mock'; import { ServiceTaskFilterCloudService } from '../../services/service-task-filter-cloud.service'; import { ServiceTaskFiltersCloudComponent } from './service-task-filters-cloud.component'; @@ -36,7 +35,7 @@ describe('ServiceTaskFiltersCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, ServiceTaskFiltersCloudComponent], + imports: [ProcessServiceCloudTestingModule, ServiceTaskFiltersCloudComponent], providers: [{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); fixture = TestBed.createComponent(ServiceTaskFiltersCloudComponent); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts index a4bbd23d7e8..3e58a5bb64c 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/task-filters-cloud.module.ts @@ -16,43 +16,25 @@ */ import { NgModule } from '@angular/core'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { CommonModule } from '@angular/common'; import { TaskFiltersCloudComponent } from './components/task-filters/task-filters-cloud.component'; -import { MaterialModule } from '../../material.module'; -import { CoreModule } from '@alfresco/adf-core'; -import { HttpClientModule } from '@angular/common/http'; import { EditServiceTaskFilterCloudComponent } from './components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component'; import { EditTaskFilterCloudComponent } from './components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component'; import { TaskFilterDialogCloudComponent } from './components/task-filter-dialog/task-filter-dialog-cloud.component'; import { ServiceTaskFiltersCloudComponent } from './components/service-task-filters/service-task-filters-cloud.component'; import { TaskAssignmentFilterCloudComponent } from './components/task-assignment-filter/task-assignment-filter.component'; -import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; -import { APP_LIST_CLOUD_DIRECTIVES } from '../../app/app-list-cloud.module'; -import { GroupCloudComponent } from '../../group/components/group-cloud.component'; -import { PeopleCloudComponent } from '../../people/components/people-cloud.component'; -import { DateRangeFilterComponent } from '../../common/date-range-filter/date-range-filter.component'; +export const TASK_FILTERS_CLOUD_DIRECTIVES = [ + TaskFilterDialogCloudComponent, + TaskFiltersCloudComponent, + ServiceTaskFiltersCloudComponent, + EditTaskFilterCloudComponent, + TaskAssignmentFilterCloudComponent, + EditServiceTaskFilterCloudComponent +] as const; + +/** @deprecated use ...TASK_FILTERS_CLOUD_DIRECTIVES instead */ @NgModule({ - imports: [ - FormsModule, - ReactiveFormsModule, - HttpClientModule, - CommonModule, - MaterialModule, - ...APP_LIST_CLOUD_DIRECTIVES, - CoreModule, - GroupCloudComponent, - DateRangeFilterComponent, - PeopleCloudComponent, - MatProgressSpinnerModule, - TaskFilterDialogCloudComponent, - TaskFiltersCloudComponent, - ServiceTaskFiltersCloudComponent, - EditTaskFilterCloudComponent, - TaskAssignmentFilterCloudComponent, - EditServiceTaskFilterCloudComponent - ], - exports: [TaskFiltersCloudComponent, ServiceTaskFiltersCloudComponent, EditTaskFilterCloudComponent, EditServiceTaskFilterCloudComponent] + imports: [...TASK_FILTERS_CLOUD_DIRECTIVES], + exports: [...TASK_FILTERS_CLOUD_DIRECTIVES] }) export class TaskFiltersCloudModule {} From b207a6da9560fa88bdedcd8fb2ca8983f3f5d33b Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 14:32:51 -0500 Subject: [PATCH 20/30] task filters --- .../task-assignment-filter.component.spec.ts | 3 +-- .../task-filter-dialog-cloud.component.spec.ts | 3 +-- .../task-filters/task-filters-cloud.component.spec.ts | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts index 7981da35369..4b225ce24ba 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts @@ -17,7 +17,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TaskAssignmentFilterCloudComponent } from './task-assignment-filter.component'; -import { TaskFiltersCloudModule } from '../../task-filters-cloud.module'; import { AssignmentType, TaskStatusFilter } from '../../models/filter-cloud.model'; import { IdentityUserService } from '../../../../people/services/identity-user.service'; import { By } from '@angular/platform-browser'; @@ -58,7 +57,7 @@ describe('TaskAssignmentFilterComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, GroupCloudComponent, TaskFiltersCloudModule, TaskAssignmentFilterCloudComponent] + imports: [ProcessServiceCloudTestingModule, GroupCloudComponent, TaskAssignmentFilterCloudComponent] }); }); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts index 3d369020011..d8036c88b0f 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts @@ -18,7 +18,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { TaskFilterDialogCloudComponent } from './task-filter-dialog-cloud.component'; -import { TaskFiltersCloudModule } from '../../task-filters-cloud.module'; import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; describe('TaskFilterDialogCloudComponent', () => { @@ -36,7 +35,7 @@ describe('TaskFilterDialogCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, TaskFilterDialogCloudComponent], + imports: [ProcessServiceCloudTestingModule, TaskFilterDialogCloudComponent], providers: [ { provide: MatDialogRef, useValue: mockDialogRef }, { provide: MAT_DIALOG_DATA, useValue: mockDialogData } diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts index 1a8d115893d..1268087acad 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts @@ -25,7 +25,6 @@ import { LocalPreferenceCloudService } from '../../../../services/local-preferen import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { defaultTaskFiltersMock, fakeGlobalFilter, taskNotifications } from '../../mock/task-filters-cloud.mock'; import { TaskFilterCloudService } from '../../services/task-filter-cloud.service'; -import { TaskFiltersCloudModule } from '../../task-filters-cloud.module'; import { TaskFiltersCloudComponent } from './task-filters-cloud.component'; import { TaskListCloudService } from '../../../task-list/services/task-list-cloud.service'; import { HarnessLoader } from '@angular/cdk/testing'; @@ -47,7 +46,7 @@ describe('TaskFiltersCloudComponent', () => { const configureTestingModule = (searchApiMethod: 'GET' | 'POST') => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudModule, TaskFiltersCloudComponent], + imports: [ProcessServiceCloudTestingModule, TaskFiltersCloudComponent], providers: [{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); taskFilterService = TestBed.inject(TaskFilterCloudService); From ef73b2b9017d36a3946bdfe54b17fdf7098d9290 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 14:46:51 -0500 Subject: [PATCH 21/30] task filters --- .../src/lib/process-services-cloud.module.ts | 6 +++--- .../src/lib/task/task-cloud.module.ts | 6 +++--- .../src/lib/task/task-filters/public-api.ts | 9 ++++----- .../src/lib/task/task-form/public-api.ts | 2 +- .../src/lib/task/task-form/task-form.module.ts | 18 +++++------------- 5 files changed, 16 insertions(+), 25 deletions(-) diff --git a/lib/process-services-cloud/src/lib/process-services-cloud.module.ts b/lib/process-services-cloud/src/lib/process-services-cloud.module.ts index c23fac64795..4a994895eec 100644 --- a/lib/process-services-cloud/src/lib/process-services-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process-services-cloud.module.ts @@ -21,7 +21,7 @@ import { APP_LIST_CLOUD_DIRECTIVES } from './app/app-list-cloud.module'; import { TaskCloudModule } from './task/task-cloud.module'; import { ProcessCloudModule } from './process/process-cloud.module'; import { FORM_CLOUD_DIRECTIVES } from './form/form-cloud.module'; -import { TaskFormModule } from './task/task-form/task-form.module'; +import { TASK_FORM_CLOUD_DIRECTIVES } from './task/task-form/task-form.module'; import { LocalPreferenceCloudService, PreferenceCloudServiceInterface, @@ -45,7 +45,7 @@ import { PeopleCloudComponent } from './people/components/people-cloud.component GroupCloudComponent, PeopleCloudComponent, ...FORM_CLOUD_DIRECTIVES, - TaskFormModule, + ...TASK_FORM_CLOUD_DIRECTIVES, ApolloModule, RichTextEditorComponent ], @@ -56,7 +56,7 @@ import { PeopleCloudComponent } from './people/components/people-cloud.component TaskCloudModule, GroupCloudComponent, ...FORM_CLOUD_DIRECTIVES, - TaskFormModule, + ...TASK_FORM_CLOUD_DIRECTIVES, PeopleCloudComponent, RichTextEditorComponent ] diff --git a/lib/process-services-cloud/src/lib/task/task-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-cloud.module.ts index 49469480a79..7dd035f19c2 100644 --- a/lib/process-services-cloud/src/lib/task/task-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-cloud.module.ts @@ -19,11 +19,11 @@ import { NgModule } from '@angular/core'; import { TaskListCloudModule } from './task-list/task-list-cloud.module'; import { TASK_FILTERS_CLOUD_DIRECTIVES } from './task-filters/task-filters-cloud.module'; import { TASK_DIRECTIVES } from './directives/task-directive.module'; -import { TaskFormModule } from './task-form/task-form.module'; +import { TASK_FORM_CLOUD_DIRECTIVES } from './task-form/task-form.module'; import { TaskHeaderCloudComponent } from './task-header/components/task-header-cloud.component'; @NgModule({ - imports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_DIRECTIVES, TaskFormModule], - exports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_DIRECTIVES, TaskFormModule] + imports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_DIRECTIVES, ...TASK_FORM_CLOUD_DIRECTIVES], + exports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_DIRECTIVES, ...TASK_FORM_CLOUD_DIRECTIVES] }) export class TaskCloudModule {} diff --git a/lib/process-services-cloud/src/lib/task/task-filters/public-api.ts b/lib/process-services-cloud/src/lib/task/task-filters/public-api.ts index 3a296f94b9a..5eace95e185 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/public-api.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/public-api.ts @@ -15,14 +15,13 @@ * limitations under the License. */ -export * from './components/task-filters/task-filters-cloud.component'; -export * from './components/service-task-filters/service-task-filters-cloud.component'; export * from './components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component'; export * from './components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component'; - +export * from './components/service-task-filters/service-task-filters-cloud.component'; +export * from './components/task-assignment-filter/task-assignment-filter.component'; +export * from './components/task-filter-dialog/task-filter-dialog-cloud.component'; +export * from './components/task-filters/task-filters-cloud.component'; export * from './models/filter-cloud.model'; - export * from './services/task-filter-cloud.service'; export * from './services/service-task-filter-cloud.service'; - export * from './task-filters-cloud.module'; diff --git a/lib/process-services-cloud/src/lib/task/task-form/public-api.ts b/lib/process-services-cloud/src/lib/task/task-form/public-api.ts index ed10ea7e25d..b65e4a47e89 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/public-api.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/public-api.ts @@ -17,5 +17,5 @@ export * from './components/task-form-cloud/task-form-cloud.component'; export * from './components/user-task-cloud/user-task-cloud.component'; - +export * from './components/user-task-cloud-buttons/user-task-cloud-buttons.component'; export * from './task-form.module'; diff --git a/lib/process-services-cloud/src/lib/task/task-form/task-form.module.ts b/lib/process-services-cloud/src/lib/task/task-form/task-form.module.ts index d965183ac7c..78eaeca792c 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/task-form.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/task-form.module.ts @@ -16,23 +16,15 @@ */ import { NgModule } from '@angular/core'; -import { FORM_CLOUD_DIRECTIVES } from '../../form/form-cloud.module'; -import { TASK_DIRECTIVES } from '../directives/task-directive.module'; import { TaskFormCloudComponent } from './components/task-form-cloud/task-form-cloud.component'; -import { TaskScreenCloudComponent } from '../../screen/components/screen-cloud/screen-cloud.component'; import { UserTaskCloudComponent } from './components/user-task-cloud/user-task-cloud.component'; import { UserTaskCloudButtonsComponent } from './components/user-task-cloud-buttons/user-task-cloud-buttons.component'; -/** @deprecated use standalone component imports instead */ +export const TASK_FORM_CLOUD_DIRECTIVES = [UserTaskCloudButtonsComponent, TaskFormCloudComponent, UserTaskCloudComponent] as const; + +/** @deprecated use standalone component imports instead (...TASK_FORM_CLOUD_DIRECTIVES) */ @NgModule({ - imports: [ - ...FORM_CLOUD_DIRECTIVES, - ...TASK_DIRECTIVES, - TaskScreenCloudComponent, - UserTaskCloudButtonsComponent, - TaskFormCloudComponent, - UserTaskCloudComponent - ], - exports: [TaskFormCloudComponent, UserTaskCloudComponent] + imports: [...TASK_FORM_CLOUD_DIRECTIVES], + exports: [...TASK_FORM_CLOUD_DIRECTIVES] }) export class TaskFormModule {} From 2b39ee9392976d7f3479a8ce02224106afff0988 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 14:54:36 -0500 Subject: [PATCH 22/30] cleanup [ci:force] --- .../mock/process-cloud.service.mock.ts | 8 ++--- .../services/process-cloud.interface.ts | 31 ------------------- .../process/services/process-cloud.service.ts | 3 +- 3 files changed, 4 insertions(+), 38 deletions(-) delete mode 100644 lib/process-services-cloud/src/lib/process/services/process-cloud.interface.ts diff --git a/lib/process-services-cloud/src/lib/process/mock/process-cloud.service.mock.ts b/lib/process-services-cloud/src/lib/process/mock/process-cloud.service.mock.ts index d70fc00dbd1..dbc4b1dd1b6 100644 --- a/lib/process-services-cloud/src/lib/process/mock/process-cloud.service.mock.ts +++ b/lib/process-services-cloud/src/lib/process/mock/process-cloud.service.mock.ts @@ -23,12 +23,10 @@ import { ApplicationVersionModel } from '../../models/application-version.model' import { processInstancePlaceholdersCloudMock, processInstanceDetailsCloudMock } from './process-instance-details-cloud.mock'; import { fakeProcessDefinitions } from '../start-process/mock/start-process.component.mock'; import { mockAppVersions } from '../process-filters/mock/process-filters-cloud.mock'; -import { ProcessCloudInterface } from '../services/process-cloud.interface'; +import { ProcessCloudService } from '@alfresco/adf-process-services-cloud'; -@Injectable({ - providedIn: 'root' -}) -export class ProcessCloudServiceMock implements ProcessCloudInterface { +@Injectable() +export class ProcessCloudServiceMock extends ProcessCloudService { dataChangesDetected = new Subject(); getProcessInstanceById(appName: string, processInstanceId: string): Observable { diff --git a/lib/process-services-cloud/src/lib/process/services/process-cloud.interface.ts b/lib/process-services-cloud/src/lib/process/services/process-cloud.interface.ts deleted file mode 100644 index 768b870ddd5..00000000000 --- a/lib/process-services-cloud/src/lib/process/services/process-cloud.interface.ts +++ /dev/null @@ -1,31 +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. - */ - -import { Observable, Subject } from 'rxjs'; -import { ProcessInstanceCloud } from '../start-process/models/process-instance-cloud.model'; -import { ProcessDefinitionCloud } from '../../models/process-definition-cloud.model'; -import { ApplicationVersionModel } from '../../models/application-version.model'; - -export interface ProcessCloudInterface { - - dataChangesDetected: Subject; - - getProcessInstanceById(appName: string, processInstanceId: string): Observable; - getProcessDefinitions(appName: string): Observable; - getApplicationVersions(appName: string): Observable; - cancelProcess(appName: string, processInstanceId: string): Observable; -} diff --git a/lib/process-services-cloud/src/lib/process/services/process-cloud.service.ts b/lib/process-services-cloud/src/lib/process/services/process-cloud.service.ts index a6670ea93e0..a6be97c4c56 100644 --- a/lib/process-services-cloud/src/lib/process/services/process-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/process/services/process-cloud.service.ts @@ -22,12 +22,11 @@ import { ProcessInstanceCloud } from '../start-process/models/process-instance-c import { BaseCloudService } from '../../services/base-cloud.service'; import { ProcessDefinitionCloud } from '../../models/process-definition-cloud.model'; import { ApplicationVersionModel, ApplicationVersionResponseModel } from '../../models/application-version.model'; -import { ProcessCloudInterface } from './process-cloud.interface'; @Injectable({ providedIn: 'root' }) -export class ProcessCloudService extends BaseCloudService implements ProcessCloudInterface { +export class ProcessCloudService extends BaseCloudService { dataChangesDetected = new Subject(); /** From 706ffbaca0641ef6cbc5e3e8988fcda7a235f6de Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 14:56:28 -0500 Subject: [PATCH 23/30] cleanup [ci:force] --- .../components/task-filters-cloud.component.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/process-services-cloud/components/task-filters-cloud.component.md b/docs/process-services-cloud/components/task-filters-cloud.component.md index 09a895440cf..d7580e5deab 100644 --- a/docs/process-services-cloud/components/task-filters-cloud.component.md +++ b/docs/process-services-cloud/components/task-filters-cloud.component.md @@ -5,7 +5,7 @@ Status: Experimental Last reviewed: 2019-01-08 --- -# [Task Filters Cloud component](../../../lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts "Defined in task-filters-cloud.component.ts") +# Task Filters Cloud component Shows all available filters. @@ -39,13 +39,13 @@ Shows all available filters. ### Events -| Name | Type | Description | -|----------------------|---------------------------------------|-------------------------------------------------------------------------| -| error | `EventEmitter` | Emitted when an error occurs during loading. | -| filterClicked | `EventEmitter` | Emitted when a filter is being clicked from the UI. | -| filterCounterUpdated | `EventEmitter` | Emitted when filter counters are updated. | -| filterSelected | `EventEmitter`` | Emitted when a filter is being selected based on the filterParam input. | -| success | `EventEmitter` | Emitted when the list is loaded. | +| Name | Type | Description | +|----------------------|--------------------------------------|-------------------------------------------------------------------------| +| error | `EventEmitter` | Emitted when an error occurs during loading. | +| filterClicked | `EventEmitter` | Emitted when a filter is being clicked from the UI. | +| filterCounterUpdated | `EventEmitter` | Emitted when filter counters are updated. | +| filterSelected | `EventEmitter` | Emitted when a filter is being selected based on the filterParam input. | +| success | `EventEmitter` | Emitted when the list is loaded. | ## Details @@ -80,9 +80,7 @@ If you want to disable notification bubbles as task filters change you can chang ```json { - ... "notifications": true - ... } ``` From d2039102a8664b0106a4ed2792454b1bbbd87d7c Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 15:15:49 -0500 Subject: [PATCH 24/30] cleanup [ci:force] --- .../components/task-list/task-list-cloud.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts index 39d4dcbaca1..bb0da5e47dd 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts @@ -96,7 +96,7 @@ describe('TaskListCloudComponent', () => { const configureTestingModule = (searchApiMethod: 'GET' | 'POST') => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule], + imports: [ProcessServiceCloudTestingModule, TaskListCloudComponent], providers: [ { provide: TASK_LIST_CLOUD_TOKEN, From 8b58bb60e970591d9656f1d9f45954dd8a8d05c3 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 15:52:23 -0500 Subject: [PATCH 25/30] cleanup [ci:force] --- .../task-filters/task-filters-cloud.component.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts index a491a1379d0..f9daf4474ce 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.ts @@ -97,8 +97,8 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp getFilters(appName: string): void { this.filters$ = this.taskFilterCloudService.getTaskListFilters(appName); - this.filters$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe( - (res) => { + this.filters$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({ + next: (res) => { this.resetFilter(); this.filters = res || []; this.initFilterCounters(); @@ -106,10 +106,10 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp this.updateFilterCounters(); this.success.emit(res); }, - (err: any) => { + error: (err) => { this.error.emit(err); } - ); + }); } /** @@ -160,8 +160,8 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp this.taskFilterCloudService .getTaskNotificationSubscription(this.appName) .pipe(debounceTime(1000)) - .subscribe((result: TaskCloudEngineEvent[]) => { - result.map((taskEvent: TaskCloudEngineEvent) => { + .subscribe((result) => { + result.forEach((taskEvent) => { this.checkFilterCounter(taskEvent.entity); }); @@ -172,7 +172,7 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp } checkFilterCounter(filterNotification: TaskDetailsCloudModel) { - this.filters.map((filter) => { + this.filters.forEach((filter) => { if (this.isFilterPresent(filter, filterNotification)) { this.addToUpdatedCounters(filter.key); } @@ -234,6 +234,7 @@ export class TaskFiltersCloudComponent extends BaseTaskFiltersCloudComponent imp } /** + * @deprecated unused method * Select as default task filter the first in the list */ public selectDefaultTaskFilter() { From c0a79fcd69b155444a297f27fad323915130a526 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Wed, 8 Jan 2025 17:04:12 -0500 Subject: [PATCH 26/30] update libs [ci:force] --- package-lock.json | 58 +++++++++++++++++++++++++++++++++++------------ package.json | 2 +- 2 files changed, 45 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index 879a980753d..ca29f266511 100644 --- a/package-lock.json +++ b/package-lock.json @@ -95,7 +95,7 @@ "@types/superagent": "^4.1.22", "@typescript-eslint/eslint-plugin": "5.59.8", "@typescript-eslint/parser": "5.62.0", - "@typescript-eslint/typescript-estree": "8.14.0", + "@typescript-eslint/typescript-estree": "8.19.1", "ajv": "^8.12.0", "commander": "12.0.0", "css-loader": "^7.1.2", @@ -11804,18 +11804,20 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.14.0", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.19.1.tgz", + "integrity": "sha512-jk/TZwSMJlxlNnqhy0Eod1PNEvCkpY6MXOXE/WLlblZ6ibb32i2We4uByoKPv1d0OD2xebDv4hbs3fm11SMw8Q==", "dev": true, - "license": "BSD-2-Clause", + "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.14.0", - "@typescript-eslint/visitor-keys": "8.14.0", + "@typescript-eslint/types": "8.19.1", + "@typescript-eslint/visitor-keys": "8.19.1", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", - "ts-api-utils": "^1.3.0" + "ts-api-utils": "^2.0.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -11824,14 +11826,14 @@ "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } + "peerDependencies": { + "typescript": ">=4.8.4 <5.8.0" } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/@typescript-eslint/types": { - "version": "8.14.0", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.19.1.tgz", + "integrity": "sha512-JBVHMLj7B1K1v1051ZaMMgLW4Q/jre5qGK0Ew6UgXz1Rqh+/xPzV1aW581OM00X6iOfyr1be+QyW8LOUf19BbA==", "dev": true, "license": "MIT", "engines": { @@ -11843,12 +11845,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree/node_modules/@typescript-eslint/visitor-keys": { - "version": "8.14.0", + "version": "8.19.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.19.1.tgz", + "integrity": "sha512-fzmjU8CHK853V/avYZAvuVut3ZTfwN5YtMaoi+X9Y9MA9keaWNHC3zEQ9zvyX/7Hj+5JkNyK1l7TOR2hevHB6Q==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.14.0", - "eslint-visitor-keys": "^3.4.3" + "@typescript-eslint/types": "8.19.1", + "eslint-visitor-keys": "^4.2.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -11866,6 +11870,19 @@ "balanced-match": "^1.0.0" } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/@typescript-eslint/typescript-estree/node_modules/fast-glob": { "version": "3.3.2", "dev": true, @@ -11906,6 +11923,19 @@ "node": ">=10" } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/ts-api-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", + "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/@typescript-eslint/utils": { "version": "5.62.0", "dev": true, diff --git a/package.json b/package.json index 97e29fc44be..6c1be59667c 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "@types/superagent": "^4.1.22", "@typescript-eslint/eslint-plugin": "5.59.8", "@typescript-eslint/parser": "5.62.0", - "@typescript-eslint/typescript-estree": "8.14.0", + "@typescript-eslint/typescript-estree": "8.19.1", "ajv": "^8.12.0", "commander": "12.0.0", "css-loader": "^7.1.2", From ede6b7699fe12938fa53ebbb80808d19495efb58 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 10 Jan 2025 09:21:00 -0500 Subject: [PATCH 27/30] cleanup [ci:force] --- .../mocks/task-details-cloud.mock.ts | 24 ------------------- .../base-task-list-cloud.component.ts | 8 ++++++- .../models/tasks-cloud-preferences.ts | 23 ------------------ .../src/lib/task/task-list/public-api.ts | 1 - 4 files changed, 7 insertions(+), 49 deletions(-) delete mode 100644 lib/process-services-cloud/src/lib/task/task-list/models/tasks-cloud-preferences.ts diff --git a/lib/process-services-cloud/src/lib/task/task-header/mocks/task-details-cloud.mock.ts b/lib/process-services-cloud/src/lib/task/task-header/mocks/task-details-cloud.mock.ts index a7d6748abb5..cc62339f642 100644 --- a/lib/process-services-cloud/src/lib/task/task-header/mocks/task-details-cloud.mock.ts +++ b/lib/process-services-cloud/src/lib/task/task-header/mocks/task-details-cloud.mock.ts @@ -162,30 +162,6 @@ export const completedTaskDetailsCloudMock: TaskDetailsCloudModel = { standalone: false }; -export const cancelledTaskDetailsCloudMock: TaskDetailsCloudModel = { - appName: 'mock-app-name', - appVersion: 1, - id: 'mock-task-id', - assignee: 'CancelledTaskAssignee', - name: 'This is a new task', - description: 'This is the description ', - createdDate: new Date(1545048055900), - dueDate: new Date(1545091200000), - claimedDate: null, - priority: 5, - category: null, - processDefinitionId: null, - processInstanceId: null, - status: 'CANCELLED', - owner: 'ownerUser', - parentTaskId: null, - formKey: null, - lastModified: new Date(1545048055900), - lastModifiedTo: null, - lastModifiedFrom: null, - standalone: true -}; - export const suspendedTaskDetailsCloudMock: TaskDetailsCloudModel = { appName: 'mock-app-name', appVersion: 1, diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts index a86b5b0a9dd..d0da5d4db8f 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/base-task-list-cloud.component.ts @@ -49,9 +49,15 @@ import { TaskListCloudSortingModel } from '../../../models/task-list-sorting.mod import { map, take } from 'rxjs/operators'; import { TaskCloudService } from '../../services/task-cloud.service'; import { PreferenceCloudServiceInterface } from '../../../services/preference-cloud.interface'; -import { TasksListCloudPreferences } from '../models/tasks-cloud-preferences'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +// eslint-disable-next-line no-shadow +export enum TasksListCloudPreferences { + columnOrder = 'tasks-list-cloud-columns-order', + columnsVisibility = 'tasks-list-cloud-columns-visibility', + columnsWidths = 'tasks-list-cloud-columns-widths' +} + const taskPresetsCloudDefaultModel = { default: [ { diff --git a/lib/process-services-cloud/src/lib/task/task-list/models/tasks-cloud-preferences.ts b/lib/process-services-cloud/src/lib/task/task-list/models/tasks-cloud-preferences.ts deleted file mode 100644 index bc5cbcc4109..00000000000 --- a/lib/process-services-cloud/src/lib/task/task-list/models/tasks-cloud-preferences.ts +++ /dev/null @@ -1,23 +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. - */ - -// eslint-disable-next-line no-shadow -export enum TasksListCloudPreferences { - columnOrder = 'tasks-list-cloud-columns-order', - columnsVisibility = 'tasks-list-cloud-columns-visibility', - columnsWidths = 'tasks-list-cloud-columns-widths' -} diff --git a/lib/process-services-cloud/src/lib/task/task-list/public-api.ts b/lib/process-services-cloud/src/lib/task/task-list/public-api.ts index d18dd7d0442..8a83a21b06d 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/public-api.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/public-api.ts @@ -19,7 +19,6 @@ export * from './components/task-list/task-list-cloud.component'; export * from './components/service-task-list/service-task-list-cloud.component'; export * from './models/service-task-cloud.model'; -export * from './models/tasks-cloud-preferences'; export * from './services/task-list-cloud.service'; export * from './services/service-task-list-cloud.service'; From 329bd337df94e61396f3c92643b6997b1772de79 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 10 Jan 2025 10:38:37 -0500 Subject: [PATCH 28/30] move internal directives to private space, cleanup unnecessary docs [ci:force] --- docs/README.md | 8 ----- .../directives/claim-task-cloud.directive.md | 32 ------------------- .../directives/complete-task.directive.md | 32 ------------------- .../unclaim-task-cloud.directive.md | 32 ------------------- .../src/lib/task/directives/public-api.ts | 22 ------------- .../task/directives/task-directive.module.ts | 30 ----------------- .../src/lib/task/public-api.ts | 1 - .../src/lib/task/task-cloud.module.ts | 5 ++- .../claim-task-cloud.directive.spec.ts | 24 ++++++++++---- .../claim-task}/claim-task-cloud.directive.ts | 4 +-- .../unclaim-task-cloud.directive.spec.ts | 6 ++-- .../unclaim-task-cloud.directive.ts | 2 +- .../user-task-cloud-buttons.component.ts | 4 +-- .../complete-task.directive.spec.ts | 6 ++-- .../complete-task}/complete-task.directive.ts | 2 +- .../user-task-cloud.component.ts | 2 +- 16 files changed, 32 insertions(+), 180 deletions(-) delete mode 100644 docs/process-services-cloud/directives/claim-task-cloud.directive.md delete mode 100644 docs/process-services-cloud/directives/complete-task.directive.md delete mode 100644 docs/process-services-cloud/directives/unclaim-task-cloud.directive.md delete mode 100644 lib/process-services-cloud/src/lib/task/directives/public-api.ts delete mode 100644 lib/process-services-cloud/src/lib/task/directives/task-directive.module.ts rename lib/process-services-cloud/src/lib/task/{directives => task-form/components/user-task-cloud-buttons/claim-task}/claim-task-cloud.directive.spec.ts (89%) rename lib/process-services-cloud/src/lib/task/{directives => task-form/components/user-task-cloud-buttons/claim-task}/claim-task-cloud.directive.ts (94%) rename lib/process-services-cloud/src/lib/task/{directives => task-form/components/user-task-cloud-buttons/unclaim-task}/unclaim-task-cloud.directive.spec.ts (96%) rename lib/process-services-cloud/src/lib/task/{directives => task-form/components/user-task-cloud-buttons/unclaim-task}/unclaim-task-cloud.directive.ts (97%) rename lib/process-services-cloud/src/lib/task/{directives => task-form/components/user-task-cloud/complete-task}/complete-task.directive.spec.ts (96%) rename lib/process-services-cloud/src/lib/task/{directives => task-form/components/user-task-cloud/complete-task}/complete-task.directive.ts (97%) diff --git a/docs/README.md b/docs/README.md index c042392623c..0b42a6d5e19 100644 --- a/docs/README.md +++ b/docs/README.md @@ -494,14 +494,6 @@ Status: Experimental | [Source](<>) | | [Task Header Cloud Component](process-services-cloud/components/task-header-cloud.component.md) ![Experimental](docassets/images/ExperimentalIcon.png) | Shows all the information related to a task. | [Source](../lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.ts) | | [Task List Cloud component](process-services-cloud/components/task-list-cloud.component.md) ![Experimental](docassets/images/ExperimentalIcon.png) | Renders a list containing all the tasks matched by the parameters specified. | [Source](../lib/process-services-cloud/src/lib/task/task-list/components/task-list-cloud.component.ts) | -### Directives - -| Name | Description | Source link | -| ---- | ----------- | ----------- | -| [Claim Task Cloud Directive](process-services-cloud/directives/claim-task-cloud.directive.md) ![Experimental](docassets/images/ExperimentalIcon.png) | Claims a task | [Source](../lib/process-services-cloud/src/lib/task/directives/claim-task-cloud.directive.ts) | -| [Complete Task Directive](process-services-cloud/directives/complete-task.directive.md) ![Experimental](docassets/images/ExperimentalIcon.png) | Completes a task. | [Source](../lib/process-services-cloud/src/lib/task/directives/complete-task.directive.ts) | -| [Unclaim Task Cloud Directive](process-services-cloud/directives/unclaim-task-cloud.directive.md) ![Experimental](docassets/images/ExperimentalIcon.png) | Unclaims a task | [Source](../lib/process-services-cloud/src/lib/task/directives/unclaim-task-cloud.directive.ts) | - ### Services | Name | Description | Source link | diff --git a/docs/process-services-cloud/directives/claim-task-cloud.directive.md b/docs/process-services-cloud/directives/claim-task-cloud.directive.md deleted file mode 100644 index a53863da05d..00000000000 --- a/docs/process-services-cloud/directives/claim-task-cloud.directive.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -Title: Claim Task Cloud Directive -Added: v3.9.0 -Status: Experimental -Last reviewed: 2020-06-09 ---- - -# [Claim task Cloud directive](../../../lib/process-services-cloud/src/lib/task/directives/claim-task-cloud.directive.ts "Defined in claim-task-cloud.directive.ts") - -Claims a task - -## Basic Usage - -```html - -``` - -## Class members - -### Properties - -| Name | Type | Default value | Description | -| ---- | ---- | ------------- | ----------- | -| appName | `string` | "" | (Required) The name of the application. | -| taskId | `string` | | (Required) The id of the task. | - -### Events - -| Name | Type | Description | -| ---- | ---- | ----------- | -| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the task cannot be completed. | -| success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the task is completed. | diff --git a/docs/process-services-cloud/directives/complete-task.directive.md b/docs/process-services-cloud/directives/complete-task.directive.md deleted file mode 100644 index bc7587b2a7b..00000000000 --- a/docs/process-services-cloud/directives/complete-task.directive.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -Title: Complete Task Directive -Added: v3.1.0 -Status: Experimental -Last reviewed: 2019-03-19 ---- - -# [Complete task directive](../../../lib/process-services-cloud/src/lib/task/directives/complete-task.directive.ts "Defined in complete-task.directive.ts") - -Completes a task. - -## Basic Usage - -```html - -``` - -## Class members - -### Properties - -| Name | Type | Default value | Description | -| ---- | ---- | ------------- | ----------- | -| appName | `string` | "" | (Required) The name of the application. | -| taskId | `string` | | (Required) The id of the task. | - -### Events - -| Name | Type | Description | -| ---- | ---- | ----------- | -| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the task cannot be completed. | -| success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the task is completed. | diff --git a/docs/process-services-cloud/directives/unclaim-task-cloud.directive.md b/docs/process-services-cloud/directives/unclaim-task-cloud.directive.md deleted file mode 100644 index 7c32de34c23..00000000000 --- a/docs/process-services-cloud/directives/unclaim-task-cloud.directive.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -Title: Unclaim Task Cloud Directive -Added: v3.9.0 -Status: Experimental -Last reviewed: 2020-06-09 ---- - -# [Unclaim Task Cloud directive](../../../lib/process-services-cloud/src/lib/task/directives/unclaim-task-cloud.directive.ts "Defined in unclaim-task-cloud.directive.ts") - -Unclaims a task - -## Basic Usage - -```html - -``` - -## Class members - -### Properties - -| Name | Type | Default value | Description | -| ---- | ---- | ------------- | ----------- | -| appName | `string` | "" | (Required) The name of the application. | -| taskId | `string` | "" | (Required) The id of the task. | - -### Events - -| Name | Type | Description | -| ---- | ---- | ----------- | -| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the task cannot be completed. | -| success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`` | Emitted when the task is completed. | diff --git a/lib/process-services-cloud/src/lib/task/directives/public-api.ts b/lib/process-services-cloud/src/lib/task/directives/public-api.ts deleted file mode 100644 index 12186ff4f90..00000000000 --- a/lib/process-services-cloud/src/lib/task/directives/public-api.ts +++ /dev/null @@ -1,22 +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. - */ - -export * from './claim-task-cloud.directive'; -export * from './unclaim-task-cloud.directive'; -export * from './complete-task.directive'; - -export * from './task-directive.module'; diff --git a/lib/process-services-cloud/src/lib/task/directives/task-directive.module.ts b/lib/process-services-cloud/src/lib/task/directives/task-directive.module.ts deleted file mode 100644 index 4fa8e56bfa7..00000000000 --- a/lib/process-services-cloud/src/lib/task/directives/task-directive.module.ts +++ /dev/null @@ -1,30 +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. - */ - -import { NgModule } from '@angular/core'; -import { CompleteTaskDirective } from './complete-task.directive'; -import { ClaimTaskCloudDirective } from './claim-task-cloud.directive'; -import { UnClaimTaskCloudDirective } from './unclaim-task-cloud.directive'; - -export const TASK_DIRECTIVES = [CompleteTaskDirective, ClaimTaskCloudDirective, UnClaimTaskCloudDirective] as const; - -/** @deprecated */ -@NgModule({ - imports: [...TASK_DIRECTIVES], - exports: [...TASK_DIRECTIVES] -}) -export class TaskDirectiveModule {} diff --git a/lib/process-services-cloud/src/lib/task/public-api.ts b/lib/process-services-cloud/src/lib/task/public-api.ts index f66c5695ad5..102fb374e65 100644 --- a/lib/process-services-cloud/src/lib/task/public-api.ts +++ b/lib/process-services-cloud/src/lib/task/public-api.ts @@ -22,6 +22,5 @@ export * from './models/task.model'; export * from './models/start-task-cloud-request.model'; export * from './task-header/public-api'; export * from './task-form/public-api'; -export * from './directives/public-api'; export * from './services/task-cloud.service'; export * from './task-cloud.module'; diff --git a/lib/process-services-cloud/src/lib/task/task-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-cloud.module.ts index 7dd035f19c2..b146c1eb8b4 100644 --- a/lib/process-services-cloud/src/lib/task/task-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-cloud.module.ts @@ -18,12 +18,11 @@ import { NgModule } from '@angular/core'; import { TaskListCloudModule } from './task-list/task-list-cloud.module'; import { TASK_FILTERS_CLOUD_DIRECTIVES } from './task-filters/task-filters-cloud.module'; -import { TASK_DIRECTIVES } from './directives/task-directive.module'; import { TASK_FORM_CLOUD_DIRECTIVES } from './task-form/task-form.module'; import { TaskHeaderCloudComponent } from './task-header/components/task-header-cloud.component'; @NgModule({ - imports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_DIRECTIVES, ...TASK_FORM_CLOUD_DIRECTIVES], - exports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_DIRECTIVES, ...TASK_FORM_CLOUD_DIRECTIVES] + imports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_FORM_CLOUD_DIRECTIVES], + exports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_FORM_CLOUD_DIRECTIVES] }) export class TaskCloudModule {} diff --git a/lib/process-services-cloud/src/lib/task/directives/claim-task-cloud.directive.spec.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/claim-task/claim-task-cloud.directive.spec.ts similarity index 89% rename from lib/process-services-cloud/src/lib/task/directives/claim-task-cloud.directive.spec.ts rename to lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/claim-task/claim-task-cloud.directive.spec.ts index e35c8f467f0..5f59d05afa0 100644 --- a/lib/process-services-cloud/src/lib/task/directives/claim-task-cloud.directive.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/claim-task/claim-task-cloud.directive.spec.ts @@ -17,16 +17,18 @@ import { Component, ContentChildren, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { TaskCloudService } from '../services/task-cloud.service'; +import { TaskCloudService } from '../../../../services/task-cloud.service'; import { of, throwError } from 'rxjs'; import { ClaimTaskCloudDirective } from './claim-task-cloud.directive'; -import { taskClaimCloudMock } from '../task-header/mocks/fake-claim-task.mock'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; +import { taskClaimCloudMock } from '../../../../task-header/mocks/fake-claim-task.mock'; +import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; import { By } from '@angular/platform-browser'; describe('ClaimTaskCloudDirective', () => { @Component({ selector: 'adf-cloud-claim-test-component', + standalone: true, + imports: [ClaimTaskCloudDirective], template: '' }) class TestComponent { @@ -46,8 +48,8 @@ describe('ClaimTaskCloudDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule], - declarations: [TestComponent] + imports: [ProcessServiceCloudTestingModule, TestComponent], + declarations: [] }); taskCloudService = TestBed.inject(TaskCloudService); fixture = TestBed.createComponent(TestComponent); @@ -95,6 +97,8 @@ describe('ClaimTaskCloudDirective', () => { describe('Claim Task Directive validation errors', () => { @Component({ selector: 'adf-cloud-claim-no-fields-validation-component', + standalone: true, + imports: [ClaimTaskCloudDirective], template: '' }) class ClaimTestMissingInputDirectiveComponent { @@ -108,6 +112,8 @@ describe('Claim Task Directive validation errors', () => { @Component({ selector: 'adf-cloud-claim-no-taskid-validation-component', + standalone: true, + imports: [ClaimTaskCloudDirective], template: '' }) class ClaimTestMissingTaskIdDirectiveComponent { @@ -119,6 +125,8 @@ describe('Claim Task Directive validation errors', () => { @Component({ selector: 'adf-cloud-claim-undefined-appname-component', + standalone: true, + imports: [ClaimTaskCloudDirective], template: '' }) class ClaimTestInvalidAppNameUndefinedDirectiveComponent { @@ -131,6 +139,8 @@ describe('Claim Task Directive validation errors', () => { @Component({ selector: 'adf-cloud-claim-null-appname-component', + standalone: true, + imports: [ClaimTaskCloudDirective], template: '' }) class ClaimTestInvalidAppNameNullDirectiveComponent { @@ -145,8 +155,8 @@ describe('Claim Task Directive validation errors', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule], - declarations: [ + imports: [ + ProcessServiceCloudTestingModule, ClaimTestMissingTaskIdDirectiveComponent, ClaimTestInvalidAppNameUndefinedDirectiveComponent, ClaimTestInvalidAppNameNullDirectiveComponent, diff --git a/lib/process-services-cloud/src/lib/task/directives/claim-task-cloud.directive.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/claim-task/claim-task-cloud.directive.ts similarity index 94% rename from lib/process-services-cloud/src/lib/task/directives/claim-task-cloud.directive.ts rename to lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/claim-task/claim-task-cloud.directive.ts index 66e7a444818..b0e4caa9aa7 100644 --- a/lib/process-services-cloud/src/lib/task/directives/claim-task-cloud.directive.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/claim-task/claim-task-cloud.directive.ts @@ -16,8 +16,8 @@ */ import { Directive, Input, HostListener, Output, EventEmitter, OnInit, ElementRef, Renderer2 } from '@angular/core'; -import { IdentityUserService } from '../../people/services/identity-user.service'; -import { TaskCloudService } from '../services/task-cloud.service'; +import { IdentityUserService } from '../../../../../people/services/identity-user.service'; +import { TaskCloudService } from '../../../../services/task-cloud.service'; @Directive({ // eslint-disable-next-line @angular-eslint/directive-selector diff --git a/lib/process-services-cloud/src/lib/task/directives/unclaim-task-cloud.directive.spec.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/unclaim-task/unclaim-task-cloud.directive.spec.ts similarity index 96% rename from lib/process-services-cloud/src/lib/task/directives/unclaim-task-cloud.directive.spec.ts rename to lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/unclaim-task/unclaim-task-cloud.directive.spec.ts index ccf90c50ee3..be77b8aef8d 100644 --- a/lib/process-services-cloud/src/lib/task/directives/unclaim-task-cloud.directive.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/unclaim-task/unclaim-task-cloud.directive.spec.ts @@ -17,11 +17,11 @@ import { Component, ContentChildren, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { TaskCloudService } from '../services/task-cloud.service'; +import { TaskCloudService } from '../../../../services/task-cloud.service'; import { of, throwError } from 'rxjs'; import { UnClaimTaskCloudDirective } from './unclaim-task-cloud.directive'; -import { taskClaimCloudMock } from '../task-header/mocks/fake-claim-task.mock'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; +import { taskClaimCloudMock } from '../../../../task-header/mocks/fake-claim-task.mock'; +import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; import { By } from '@angular/platform-browser'; describe('UnClaimTaskCloudDirective', () => { diff --git a/lib/process-services-cloud/src/lib/task/directives/unclaim-task-cloud.directive.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/unclaim-task/unclaim-task-cloud.directive.ts similarity index 97% rename from lib/process-services-cloud/src/lib/task/directives/unclaim-task-cloud.directive.ts rename to lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/unclaim-task/unclaim-task-cloud.directive.ts index 9ba5e7ca8cb..9462ad6c029 100644 --- a/lib/process-services-cloud/src/lib/task/directives/unclaim-task-cloud.directive.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/unclaim-task/unclaim-task-cloud.directive.ts @@ -16,7 +16,7 @@ */ import { Directive, Input, HostListener, Output, EventEmitter, OnInit, ElementRef, Renderer2 } from '@angular/core'; -import { TaskCloudService } from '../services/task-cloud.service'; +import { TaskCloudService } from '../../../../services/task-cloud.service'; @Directive({ // eslint-disable-next-line @angular-eslint/directive-selector diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/user-task-cloud-buttons.component.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/user-task-cloud-buttons.component.ts index 2e250a36529..799ae4d189a 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/user-task-cloud-buttons.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/user-task-cloud-buttons.component.ts @@ -19,8 +19,8 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; import { CommonModule } from '@angular/common'; import { TranslateModule } from '@ngx-translate/core'; import { MatButtonModule } from '@angular/material/button'; -import { UnClaimTaskCloudDirective } from '../../../directives/unclaim-task-cloud.directive'; -import { ClaimTaskCloudDirective } from '../../../directives/claim-task-cloud.directive'; +import { UnClaimTaskCloudDirective } from './unclaim-task/unclaim-task-cloud.directive'; +import { ClaimTaskCloudDirective } from './claim-task/claim-task-cloud.directive'; @Component({ selector: 'adf-cloud-user-task-cloud-buttons', diff --git a/lib/process-services-cloud/src/lib/task/directives/complete-task.directive.spec.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/complete-task/complete-task.directive.spec.ts similarity index 96% rename from lib/process-services-cloud/src/lib/task/directives/complete-task.directive.spec.ts rename to lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/complete-task/complete-task.directive.spec.ts index c7ac6a913e4..cf42f9a8557 100644 --- a/lib/process-services-cloud/src/lib/task/directives/complete-task.directive.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/complete-task/complete-task.directive.spec.ts @@ -19,9 +19,9 @@ import { Component, ViewChild, ContentChildren } from '@angular/core'; import { CompleteTaskDirective } from './complete-task.directive'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of, throwError } from 'rxjs'; -import { taskCompleteCloudMock } from '../task-header/mocks/fake-complete-task.mock'; -import { TaskCloudService } from '../services/task-cloud.service'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; +import { taskCompleteCloudMock } from '../../../../task-header/mocks/fake-complete-task.mock'; +import { TaskCloudService } from '../../../../services/task-cloud.service'; +import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; import { By } from '@angular/platform-browser'; describe('CompleteTaskDirective', () => { diff --git a/lib/process-services-cloud/src/lib/task/directives/complete-task.directive.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/complete-task/complete-task.directive.ts similarity index 97% rename from lib/process-services-cloud/src/lib/task/directives/complete-task.directive.ts rename to lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/complete-task/complete-task.directive.ts index 07fc1224502..1a21f1572d0 100644 --- a/lib/process-services-cloud/src/lib/task/directives/complete-task.directive.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/complete-task/complete-task.directive.ts @@ -16,7 +16,7 @@ */ import { Directive, Input, HostListener, Output, EventEmitter, OnInit, ElementRef, Renderer2 } from '@angular/core'; -import { TaskCloudService } from '../services/task-cloud.service'; +import { TaskCloudService } from '../../../../services/task-cloud.service'; @Directive({ // eslint-disable-next-line @angular-eslint/directive-selector diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts index d95febce870..b4a175d8176 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.ts @@ -29,7 +29,7 @@ import { TranslateModule } from '@ngx-translate/core'; import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; import { TaskScreenCloudComponent } from '../../../../screen/components/screen-cloud/screen-cloud.component'; -import { CompleteTaskDirective } from '../../../directives/complete-task.directive'; +import { CompleteTaskDirective } from './complete-task/complete-task.directive'; const TaskTypes = { Form: 'form', From 850477afa8d9953a73c74628929ede2f4de213e9 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 10 Jan 2025 10:57:38 -0500 Subject: [PATCH 29/30] improved testing, reduce interfaces [ci:force] --- .../lib/task/mock/task-cloud.service.mock.ts | 42 ++++++++-------- .../services/task-cloud.service.interface.ts | 48 ------------------- .../lib/task/services/task-cloud.service.ts | 12 +++-- 3 files changed, 26 insertions(+), 76 deletions(-) delete mode 100644 lib/process-services-cloud/src/lib/task/services/task-cloud.service.interface.ts diff --git a/lib/process-services-cloud/src/lib/task/mock/task-cloud.service.mock.ts b/lib/process-services-cloud/src/lib/task/mock/task-cloud.service.mock.ts index 4f046874e46..93f3070a0f1 100644 --- a/lib/process-services-cloud/src/lib/task/mock/task-cloud.service.mock.ts +++ b/lib/process-services-cloud/src/lib/task/mock/task-cloud.service.mock.ts @@ -16,23 +16,23 @@ */ import { Injectable } from '@angular/core'; -import { AppConfigService, CardViewArrayItem } from '@alfresco/adf-core'; +import { CardViewArrayItem } from '@alfresco/adf-core'; import { from, Observable, of, Subject, throwError } from 'rxjs'; import { DEFAULT_TASK_PRIORITIES, TaskPriorityOption } from '../models/task.model'; import { TaskDetailsCloudModel, TASK_ASSIGNED_STATE, TASK_CREATED_STATE } from '../models/task-details-cloud.model'; import { taskDetailsContainer } from '../task-header/mocks/task-details-cloud.mock'; import { ProcessDefinitionCloud } from '../../models/process-definition-cloud.model'; -import { StartTaskCloudRequestModel } from '../models/start-task-cloud-request.model'; -import { TaskCloudServiceInterface } from '../services/task-cloud.service.interface'; +import { TaskCloudService } from '@alfresco/adf-process-services-cloud'; +import { AdfHttpClient } from '@alfresco/adf-core/api'; -@Injectable({ - providedIn: 'root' -}) -export class TaskCloudServiceMock implements TaskCloudServiceInterface { +@Injectable() +export class TaskCloudServiceMock extends TaskCloudService { currentUserMock = 'AssignedTaskUser'; dataChangesDetected$ = new Subject(); - constructor(private appConfigService: AppConfigService) {} + constructor(adfHttpClient: AdfHttpClient) { + super(adfHttpClient); + } getTaskById(_appName: string, taskId: string): Observable { return of(taskDetailsContainer[taskId]); @@ -80,7 +80,7 @@ export class TaskCloudServiceMock implements TaskCloudServiceInterface { return isClickable; } - updateTask(_appName: string, taskId: string, _payload: any): Observable { + updateTask(_appName: string, taskId: string): Observable { return of(taskDetailsContainer[taskId]); } @@ -92,12 +92,8 @@ export class TaskCloudServiceMock implements TaskCloudServiceInterface { return taskDetails && taskDetails.status === TASK_CREATED_STATE; } - private isAssignedToMe(assignee: string): boolean { - if (assignee === this.currentUserMock) { - return true; - } - - return false; + protected isAssignedToMe(assignee: string): boolean { + return assignee === this.currentUserMock; } completeTask(appName: string, taskId: string): Observable { @@ -106,7 +102,7 @@ export class TaskCloudServiceMock implements TaskCloudServiceInterface { return from([]); } else { - return throwError('AppName/TaskId not configured'); + return throwError(() => new Error('AppName/TaskId not configured')); } } @@ -115,13 +111,13 @@ export class TaskCloudServiceMock implements TaskCloudServiceInterface { return taskDetails && taskDetails.status === TASK_ASSIGNED_STATE && taskDetails.assignee === currentUser; } - claimTask(appName: string, taskId: string, _assignee: string): Observable { + claimTask(appName: string, taskId: string): Observable { if ((appName || appName === '') && taskId) { window.alert('Claim task mock'); return from([]); } else { - return throwError('AppName/TaskId not configured'); + return throwError(() => new Error('AppName/TaskId not configured')); } } @@ -131,11 +127,11 @@ export class TaskCloudServiceMock implements TaskCloudServiceInterface { return from([]); } else { - return throwError('AppName/TaskId not configured'); + return throwError(() => new Error('AppName/TaskId not configured')); } } - createNewTask(_startTaskRequest: StartTaskCloudRequestModel, _appName: string): Observable { + createNewTask(): Observable { window.alert('Create new task mock'); return from([]); @@ -147,17 +143,17 @@ export class TaskCloudServiceMock implements TaskCloudServiceInterface { return from([]); } else { - return throwError('AppName not configured'); + return throwError(() => new Error('AppName not configured')); } } - assign(appName: string, taskId: string, _assignee: string): Observable { + assign(appName: string, taskId: string): Observable { if (appName && taskId) { window.alert('Assign mock'); return from([]); } else { - return throwError('AppName/TaskId not configured'); + return throwError(() => new Error('AppName/TaskId not configured')); } } } diff --git a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.interface.ts b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.interface.ts deleted file mode 100644 index c661ab36c06..00000000000 --- a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.interface.ts +++ /dev/null @@ -1,48 +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. - */ - -import { CardViewArrayItem } from '@alfresco/adf-core'; -import { Observable, Subject } from 'rxjs'; -import { ProcessDefinitionCloud } from '../../models/process-definition-cloud.model'; -import { TaskPriorityOption } from '../models/task.model'; -import { StartTaskCloudRequestModel } from '../models/start-task-cloud-request.model'; -import { TaskDetailsCloudModel } from '../models/task-details-cloud.model'; -export interface TaskCloudServiceInterface { - dataChangesDetected$: Subject; - priorities: TaskPriorityOption[]; - - completeTask(appName: string, taskId: string): Observable; - canCompleteTask(taskDetails: TaskDetailsCloudModel): boolean; - isTaskEditable(taskDetails: TaskDetailsCloudModel): boolean; - isAssigneePropertyClickable( - taskDetails: TaskDetailsCloudModel, - candidateUsers: CardViewArrayItem[], - candidateGroups: CardViewArrayItem[] - ): boolean; - canClaimTask(taskDetails: TaskDetailsCloudModel): boolean; - canUnclaimTask(taskDetails: TaskDetailsCloudModel): boolean; - claimTask(appName: string, taskId: string, assignee: string): Observable; - unclaimTask(appName: string, taskId: string): Observable; - getTaskById(appName: string, taskId: string): Observable; - createNewTask(startTaskRequest: StartTaskCloudRequestModel, appName: string): Observable; - updateTask(appName: string, taskId: string, payload: any): Observable; - getCandidateUsers(appName: string, taskId: string): Observable; - getCandidateGroups(appName: string, taskId: string): Observable; - getProcessDefinitions(appName: string): Observable; - assign(appName: string, taskId: string, assignee: string): Observable; - getPriorityLabel(priority: number): string; -} diff --git a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts index 17f78bca0ea..fa4e74751c4 100644 --- a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts +++ b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { Injectable } from '@angular/core'; +import { inject, Injectable } from '@angular/core'; import { CardViewArrayItem, TranslationService } from '@alfresco/adf-core'; import { throwError, Observable, of, Subject } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -31,17 +31,19 @@ import { BaseCloudService } from '../../services/base-cloud.service'; import { StartTaskCloudRequestModel } from '../models/start-task-cloud-request.model'; import { ProcessDefinitionCloud } from '../../models/process-definition-cloud.model'; import { DEFAULT_TASK_PRIORITIES, TaskPriorityOption } from '../models/task.model'; -import { TaskCloudServiceInterface } from './task-cloud.service.interface'; import { IdentityUserService } from '../../people/services/identity-user.service'; import { AdfHttpClient } from '@alfresco/adf-core/api'; @Injectable({ providedIn: 'root' }) -export class TaskCloudService extends BaseCloudService implements TaskCloudServiceInterface { +export class TaskCloudService extends BaseCloudService { + private translateService = inject(TranslationService); + private identityUserService = inject(IdentityUserService); + dataChangesDetected$ = new Subject(); - constructor(private translateService: TranslationService, private identityUserService: IdentityUserService, adfHttpClient: AdfHttpClient) { + constructor(adfHttpClient: AdfHttpClient) { super(adfHttpClient); } @@ -293,7 +295,7 @@ export class TaskCloudService extends BaseCloudService implements TaskCloudServi return this.appConfigService.get('adf-cloud-priority-values') || DEFAULT_TASK_PRIORITIES; } - private isAssignedToMe(assignee: string): boolean { + protected isAssignedToMe(assignee: string): boolean { const currentUser = this.identityUserService.getCurrentUserInfo().username; return assignee === currentUser; } From fbf613efee29ee6b231558b5782300b7b768f512 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Fri, 10 Jan 2025 11:20:16 -0500 Subject: [PATCH 30/30] mark deprecated and unused code [ci:force] --- .../no-task-details/no-task-detail-template.directive.ts | 1 + .../lib/task-list/components/task-audit/task-audit.directive.ts | 1 + .../task-list/components/task-details/task-details.component.ts | 1 + 3 files changed, 3 insertions(+) diff --git a/lib/process-services/src/lib/task-list/components/no-task-details/no-task-detail-template.directive.ts b/lib/process-services/src/lib/task-list/components/no-task-details/no-task-detail-template.directive.ts index 0c50fbc19c6..7cd132dfbca 100644 --- a/lib/process-services/src/lib/task-list/components/no-task-details/no-task-detail-template.directive.ts +++ b/lib/process-services/src/lib/task-list/components/no-task-details/no-task-detail-template.directive.ts @@ -19,6 +19,7 @@ import { AfterContentInit, ContentChild, Directive, TemplateRef } from '@angular import { TaskDetailsComponent } from '../task-details/task-details.component'; /** + * @deprecated no longer used anywhere, and can be safely removed * Directive selectors without adf- prefix will be deprecated on 3.0.0 */ @Directive({ diff --git a/lib/process-services/src/lib/task-list/components/task-audit/task-audit.directive.ts b/lib/process-services/src/lib/task-list/components/task-audit/task-audit.directive.ts index b458ced07c8..aa5ec711982 100644 --- a/lib/process-services/src/lib/task-list/components/task-audit/task-audit.directive.ts +++ b/lib/process-services/src/lib/task-list/components/task-audit/task-audit.directive.ts @@ -24,6 +24,7 @@ import { TaskListService } from '../../services/tasklist.service'; const JSON_FORMAT: string = 'json'; const PDF_FORMAT: string = 'pdf'; +/** @deprecated no longer used anywhere, and can be safely removed */ @Directive({ // eslint-disable-next-line @angular-eslint/directive-selector selector: 'button[adf-task-audit]', diff --git a/lib/process-services/src/lib/task-list/components/task-details/task-details.component.ts b/lib/process-services/src/lib/task-list/components/task-details/task-details.component.ts index 3b1fa89fc89..1e60c5070b7 100644 --- a/lib/process-services/src/lib/task-list/components/task-details/task-details.component.ts +++ b/lib/process-services/src/lib/task-list/components/task-details/task-details.component.ts @@ -58,6 +58,7 @@ import { MatButtonModule } from '@angular/material/button'; import { MatCardModule } from '@angular/material/card'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; +/** @deprecated no longer used anywhere, and can be safely removed */ @Component({ selector: 'adf-task-details', standalone: true,