mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
AAE-26215 Standalone process cloud components (#10553)
This commit is contained in:
parent
8b5dcf19b9
commit
0a17fb4f4c
docs
lib
process-services-cloud/src/lib
material.module.tsprocess-services-cloud.module.ts
process
process-cloud.module.tsprocess-filters-cloud.module.tspublic-api.ts
process-filters
components
edit-process-filter
edit-process-filter-cloud.component.htmledit-process-filter-cloud.component.scssedit-process-filter-cloud.component.spec.tsedit-process-filter-cloud.component.ts
process-filter-dialog
process-filter-dialog-cloud.component.htmlprocess-filter-dialog-cloud.component.scssprocess-filter-dialog-cloud.component.spec.tsprocess-filter-dialog-cloud.component.ts
process-filters
process-list
components
process-list-cloud.component.htmlprocess-list-cloud.component.spec.tsprocess-list-cloud.component.ts
mock
process-list-cloud.module.tsstart-process/mock
task
process-services/src/lib/task-list
@ -445,7 +445,6 @@ for more information about installing and using the source code.
|
||||
| ---- | ----------- | ----------- |
|
||||
| [Claim Task Directive](process-services/directives/claim-task.directive.md)  | Claims a task | [Source](../lib/process-services/src/lib/task-list/components/task-form/claim-task.directive.ts) |
|
||||
| [Process Audit Directive](process-services/directives/process-audit.directive.md) | Fetches the Process Audit information in PDF or JSON format. | [Source](../lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.ts) |
|
||||
| [Task Audit Directive](process-services/directives/task-audit.directive.md) | Fetches the Task Audit information in PDF or JSON format. | [Source](../lib/process-services/src/lib/task-list/components/task-audit/task-audit.directive.ts) |
|
||||
| [Unclaim Task Directive](process-services/directives/unclaim-task.directive.md)  | Unclaims a task | [Source](../lib/process-services/src/lib/task-list/components/task-form/unclaim-task.directive.ts) |
|
||||
|
||||
### Services
|
||||
@ -475,7 +474,7 @@ for more information about installing and using the source code.
|
||||
| Name | Description | Source link |
|
||||
| ---- | ----------- | ----------- |
|
||||
| [App List Cloud Component](process-services-cloud/components/app-list-cloud.component.md)  | Shows all deployed cloud application instances. | [Source](../lib/process-services-cloud/src/lib/app/components/app-list-cloud.component.ts) |
|
||||
| [Edit Process Filter Cloud component](process-services-cloud/components/edit-process-filter-cloud.component.md)  | Shows/edits process filter details. | [Source](../lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.ts) |
|
||||
| [Edit Process Filter Cloud component](process-services-cloud/components/edit-process-filter-cloud.component.md)  | Shows/edits process filter details. | [Source](../lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter/edit-process-filter-cloud.component.ts) |
|
||||
| [Edit Task Filter Cloud component](process-services-cloud/components/edit-task-filter-cloud.component.md)  | Edits task filter details. | [Source](../lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter-cloud.component.ts) |
|
||||
| [Form cloud custom outcomes component](process-services-cloud/components/form-cloud-custom-outcome.component.md) | Supplies custom outcome buttons to be included in Form cloud component. | [Source](../lib/process-services-cloud/src/lib/form/components/form-cloud-custom-outcomes.component.ts) |
|
||||
| [Form cloud component](process-services-cloud/components/form-cloud.component.md) | Shows a form from Process Services. | [Source](../lib/process-services-cloud/src/lib/form/components/form-cloud.component.ts) |
|
||||
@ -485,7 +484,7 @@ for more information about installing and using the source code.
|
||||
|
||||
Added: v3.0.0
|
||||
Status: Experimental | [Source](<>) |
|
||||
| [Process Filters Cloud Component](process-services-cloud/components/process-filters-cloud.component.md)  | Lists all available process filters and allows to select a filter. | [Source](../lib/process-services-cloud/src/lib/process/process-filters/components/process-filters-cloud.component.ts) |
|
||||
| [Process Filters Cloud Component](process-services-cloud/components/process-filters-cloud.component.md)  | Lists all available process filters and allows to select a filter. | [Source](../lib/process-services-cloud/src/lib/process/process-filters/components/process-filters/process-filters-cloud.component.ts) |
|
||||
| [Process Header Cloud Component](process-services-cloud/components/process-header-cloud.component.md)  | Shows all the information related to a process instance. | [Source](../lib/process-services-cloud/src/lib/process/process-header/components/process-header-cloud.component.ts) |
|
||||
| [Process Instance List Cloud component](process-services-cloud/components/process-list-cloud.component.md)  | Renders a list containing all the process instances matched by the parameters specified. | [Source](../lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.ts) |
|
||||
| [Start Process Cloud Component](process-services-cloud/components/start-process-cloud.component.md)  | Starts a process. | [Source](../lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.ts) |
|
||||
|
Binary file not shown.
Before ![]() (image error) Size: 6.9 KiB |
@ -5,7 +5,7 @@ Status: Experimental
|
||||
Last reviewed: 2023-04-03
|
||||
---
|
||||
|
||||
# [Edit Process Filter Cloud component](../../../lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter-cloud.component.ts "Defined in edit-process-filter-cloud.component.ts")
|
||||
# Edit Process Filter Cloud component
|
||||
|
||||
Shows/edits process filter details.
|
||||
|
||||
@ -41,27 +41,27 @@ Shows/edits process filter details.
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| ---- | ---- | ------------- | ----------- |
|
||||
| actions | `string[]` | DEFAULT_ACTIONS | List of sort actions. |
|
||||
| appName | `string` | "" | The name of the application. |
|
||||
| environmentId | `string` | | [Environment](../../../lib/process-services-cloud/src/lib/common/interface/environment.interface.ts) ID of the application. |
|
||||
| environmentList | [`Environment`](../../../lib/process-services-cloud/src/lib/common/interface/environment.interface.ts)`[]` | \[] | List of environments. |
|
||||
| filterProperties | `string[]` | | List of process filter properties to display |
|
||||
| id | `string` | | Id of the process instance filter. |
|
||||
| role | `string` | "" | roles to filter the apps |
|
||||
| showFilterActions | `boolean` | true | Toggles editing of process filter actions. |
|
||||
| showProcessFilterName | `boolean` | true | Toggles the appearance of the process filter name . |
|
||||
| showTitle | `boolean` | true | Toggles editing of the process filter title. |
|
||||
| sortProperties | `string[]` | | List of sort properties to display. |
|
||||
| processFilter | [`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts) | | Process filter |
|
||||
| Name | Type | Default value | Description |
|
||||
|-----------------------|---------------------------|-----------------|-----------------------------------------------------|
|
||||
| actions | `string[]` | DEFAULT_ACTIONS | List of sort actions. |
|
||||
| appName | `string` | "" | The name of the application. |
|
||||
| environmentId | `string` | | Environment ID of the application. |
|
||||
| environmentList | `Environment[]` | \[] | List of environments. |
|
||||
| filterProperties | `string[]` | | List of process filter properties to display |
|
||||
| id | `string` | | Id of the process instance filter. |
|
||||
| role | `string` | "" | roles to filter the apps |
|
||||
| showFilterActions | `boolean` | true | Toggles editing of process filter actions. |
|
||||
| showProcessFilterName | `boolean` | true | Toggles the appearance of the process filter name . |
|
||||
| showTitle | `boolean` | true | Toggles editing of the process filter title. |
|
||||
| sortProperties | `string[]` | | List of sort properties to display. |
|
||||
| processFilter | `ProcessFilterCloudModel` | | Process filter |
|
||||
|
||||
### Events
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| action | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`ProcessFilterAction`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts)`>` | Emitted when a filter action occurs i.e Save, SaveAs, Delete. |
|
||||
| filterChange | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts)`>` | Emitted when a process instance filter property changes. |
|
||||
| Name | Type | Description |
|
||||
|--------------|-----------------------------------------|---------------------------------------------------------------|
|
||||
| action | `EventEmitter<ProcessFilterAction>` | Emitted when a filter action occurs i.e Save, SaveAs, Delete. |
|
||||
| filterChange | `EventEmitter<ProcessFilterCloudModel>` | Emitted when a process instance filter property changes. |
|
||||
|
||||
## Details
|
||||
|
||||
@ -72,8 +72,8 @@ Use the `appName` and `id` properties to choose which process filter to edit:
|
||||
```html
|
||||
<adf-cloud-edit-process-filter
|
||||
[id]="processFilterId"
|
||||
[appName]="appName">
|
||||
</adf-cloud-edit-process-filter>
|
||||
[appName]="appName"
|
||||
/>
|
||||
```
|
||||
|
||||
### Filter properties
|
||||
@ -82,18 +82,18 @@ You can supply various _filter properties_ to edit. These will determine
|
||||
which processes are found by a filter. The full set of properties is
|
||||
given below:
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| **_appName_** | Name of the app |
|
||||
| **_id_** | Process instance ID |
|
||||
| **_name_** | Process name. |
|
||||
| **_initiator_** | ID of the user who initiated the process |
|
||||
| **_status_** | Execution status of the process. |
|
||||
| **_processDefinitionId_** | Process definition ID |
|
||||
| **_processDefinitionKey_** | Process definition key |
|
||||
| **_lastModified_** | Date the process was last modified. If lastModified defined the component will show the range **_lastModifiedTo_**, **_lastModifiedFrom_** |
|
||||
| **_sort_** | Field on which the filter results will be sorted. Can be "id", "name", "status", "startDate". |
|
||||
| **_order_** | Sort ordering of the filter results (this doesn't participate in the filtering itself) |
|
||||
| Name | Description |
|
||||
|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| **_appName_** | Name of the app |
|
||||
| **_id_** | Process instance ID |
|
||||
| **_name_** | Process name. |
|
||||
| **_initiator_** | ID of the user who initiated the process |
|
||||
| **_status_** | Execution status of the process. |
|
||||
| **_processDefinitionId_** | Process definition ID |
|
||||
| **_processDefinitionKey_** | Process definition key |
|
||||
| **_lastModified_** | Date the process was last modified. If lastModified defined the component will show the range **_lastModifiedTo_**, **_lastModifiedFrom_** |
|
||||
| **_sort_** | Field on which the filter results will be sorted. Can be "id", "name", "status", "startDate". |
|
||||
| **_order_** | Sort ordering of the filter results (this doesn't participate in the filtering itself) |
|
||||
|
||||
By default, the **_status_**, **_sort_** and **_order_** properties are
|
||||
displayed in the editor. However, you can also choose which properties
|
||||
@ -118,14 +118,15 @@ export class SomeComponent implements OnInit {
|
||||
onAction($event: ProcessFilterAction) {
|
||||
console.log('Clicked action: ', $event);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<adf-cloud-edit-process-filter
|
||||
[id]="processFilterId"
|
||||
[appName]="applicationName"
|
||||
[filterProperties]="filterProperties">
|
||||
</adf-cloud-edit-process-filter>
|
||||
[filterProperties]="filterProperties"
|
||||
/>
|
||||
```
|
||||
|
||||
With this configuration, only the four listed properties will be shown.
|
||||
@ -146,7 +147,8 @@ export class SomeComponent implements OnInit {
|
||||
|
||||
sortProperties: string[] = [
|
||||
"startDate",
|
||||
"lastModified"];
|
||||
"lastModified"
|
||||
];
|
||||
|
||||
onFilterChange(filter: ProcessFilterCloudModel) {
|
||||
console.log('On filter change: ', filter);
|
||||
@ -155,14 +157,15 @@ export class SomeComponent implements OnInit {
|
||||
onAction($event: ProcessFilterAction) {
|
||||
console.log('Clicked action: ', $event);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<adf-cloud-edit-process-filter
|
||||
[id]="processFilterId"
|
||||
[appName]="applicationName"
|
||||
[sortProperties]="sortProperties">
|
||||
</adf-cloud-edit-process-filter>
|
||||
[sortProperties]="sortProperties"
|
||||
/>
|
||||
```
|
||||
|
||||
With this configuration, only the two listed sort properties will be shown.
|
||||
@ -171,11 +174,11 @@ With this configuration, only the two listed sort properties will be shown.
|
||||
|
||||
You can supply various _actions_ to apply on process filter.
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
| **_save_** | Save process filter. |
|
||||
| Name | Description |
|
||||
|--------------|-------------------------------|
|
||||
| **_save_** | Save process filter. |
|
||||
| **_saveAs_** | Creates a new process filter. |
|
||||
| **_delete_** | Delete process filter. |
|
||||
| **_delete_** | Delete process filter. |
|
||||
|
||||
By default, the **_save_**, **_saveAs_** and **_delete_** actions are
|
||||
displayed in the editor. However, you can also choose which actions to
|
||||
@ -194,14 +197,15 @@ export class SomeComponent implements OnInit {
|
||||
onAction($event: ProcessFilterAction) {
|
||||
console.log('Clicked action: ', $event);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```html
|
||||
<adf-cloud-edit-process-filter
|
||||
[id]="processFilterId"
|
||||
[appName]="applicationName"
|
||||
[actions]="actions">
|
||||
</adf-cloud-edit-process-filter>
|
||||
[actions]="actions"
|
||||
/>
|
||||
```
|
||||
|
||||
With this configuration, only the two actions will be shown.
|
||||
@ -211,7 +215,6 @@ With this configuration, only the two actions will be shown.
|
||||
Users can save a filter if they make any changes to it in an application using the **Save** icon. How it is saved is dictated by the Activiti version used:
|
||||
|
||||
- An Activiti 7 community version stores saved filters in the local browser storage. This restricts a user's custom filters to that single session.
|
||||
|
||||
- An Activiti Enterprise version uses the preference service to store saved filters. This allows for user's custom filters to be available between sessions and between devices.
|
||||
|
||||
## See also
|
||||
|
@ -5,7 +5,7 @@ Status: Experimental
|
||||
Last reviewed: 2019-01-08
|
||||
---
|
||||
|
||||
# [Process Filters Cloud Component](../../../lib/process-services-cloud/src/lib/process/process-filters/components/process-filters-cloud.component.ts "Defined in process-filters-cloud.component.ts")
|
||||
# Process Filters Cloud Component
|
||||
|
||||
Lists all available process filters and allows to select a filter.
|
||||
|
||||
@ -14,28 +14,28 @@ Lists all available process filters and allows to select a filter.
|
||||
```html
|
||||
<adf-cloud-process-filters
|
||||
[appName]="currentAppName"
|
||||
[showIcons]="true">
|
||||
</adf-cloud-process-filters>
|
||||
[showIcons]="true"
|
||||
/>
|
||||
```
|
||||
|
||||
## Class members
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| ---- | ---- | ------------- | ----------- |
|
||||
| appName | `string` | "" | (required) The application name |
|
||||
| filterParam | `UserTaskFilterRepresentation` | | (optional) The filter to be selected by default |
|
||||
| showIcons | `boolean` | false | (optional) Toggles showing an icon by the side of each filter |
|
||||
| Name | Type | Default value | Description |
|
||||
|-------------|--------------------------------|---------------|---------------------------------------------------------------|
|
||||
| appName | `string` | "" | (required) The application name |
|
||||
| filterParam | `UserTaskFilterRepresentation` | | (optional) The filter to be selected by default |
|
||||
| showIcons | `boolean` | false | (optional) Toggles showing an icon by the side of each filter |
|
||||
|
||||
### Events
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when any error occurs while loading the filters |
|
||||
| filterClicked | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts)`>` | Emitted when a filter is being clicked from the UI. |
|
||||
| filterSelected | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<`[`ProcessFilterCloudModel`](../../../lib/process-services-cloud/src/lib/process/process-filters/models/process-filter-cloud.model.ts)`>` | Emitted when a filter is being selected based on the filterParam input. |
|
||||
| success | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when filters are loaded successfully |
|
||||
| Name | Type | Description |
|
||||
|----------------|-----------------------------------------|-------------------------------------------------------------------------|
|
||||
| error | `EventEmitter<any>` | Emitted when any error occurs while loading the filters |
|
||||
| filterClicked | `EventEmitter<ProcessFilterCloudModel>` | Emitted when a filter is being clicked from the UI. |
|
||||
| filterSelected | `EventEmitter<ProcessFilterCloudModel>` | Emitted when a filter is being selected based on the filterParam input. |
|
||||
| success | `EventEmitter<any>` | Emitted when filters are loaded successfully |
|
||||
|
||||
## See also
|
||||
|
||||
|
@ -53,24 +53,3 @@ Shows the details of the task ID passed in as input.
|
||||
| taskCreated | `EventEmitter<TaskRepresentation>` | Emitted when a checklist task is created. |
|
||||
| taskDeleted | `EventEmitter<string>` | Emitted when a checklist task is deleted. |
|
||||
| unClaimedTask | `EventEmitter<string>` | Emitted when a task is unclaimed. |
|
||||
|
||||
## Details
|
||||
|
||||
### Custom 'empty Task Details' template
|
||||
|
||||
By default, the [Task Details component](task-details.component.md) shows "No Tasks" message when there are
|
||||
no details. You can change this by adding a custom HTML template as in the following
|
||||
example:
|
||||
|
||||
```html
|
||||
<adf-task-details [taskId]="taskId">
|
||||
<adf-no-task-details-template>
|
||||
<ng-template>
|
||||
<h1>Sorry, no tasks here</h1>
|
||||
<img src="example.jpg" alt="example">
|
||||
</ng-template>
|
||||
</adf-no-task-details-template>
|
||||
</adf-task-details>
|
||||
```
|
||||
|
||||
Note that you can use any HTML content in the template, including other Angular components.
|
||||
|
@ -1,42 +0,0 @@
|
||||
---
|
||||
Title: Task Audit Directive
|
||||
Added: v2.0.0
|
||||
Status: Active
|
||||
Last reviewed: 2019-01-14
|
||||
---
|
||||
|
||||
# [Task Audit Directive](../../../lib/process-services/src/lib/task-list/components/task-audit/task-audit.directive.ts "Defined in task-audit.directive.ts")
|
||||
|
||||
Fetches the Task Audit information in PDF or JSON format.
|
||||
|
||||

|
||||
|
||||
## Basic Usage
|
||||
|
||||
```html
|
||||
<button
|
||||
adf-task-audit
|
||||
[task-id]="taskId"
|
||||
[download]="download"
|
||||
mat-icon-button (clicked)="onAuditClick($event)" (error)="onAuditError($event)" >
|
||||
<mat-icon>assignment_ind</mat-icon>
|
||||
</button>
|
||||
```
|
||||
|
||||
## Class members
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Default value | Description |
|
||||
| ---- | ---- | ------------- | ----------- |
|
||||
| download | `boolean` | true | Enables downloading of the audit when the decorated element is clicked. |
|
||||
| fileName | `string` | "Audit" | Name of the downloaded file (for PDF downloads). |
|
||||
| format | `string` | "pdf" | Format of the audit information. Can be "pdf" or "json". |
|
||||
| taskId | `string` | | (**required**) The id of the task. |
|
||||
|
||||
### Events
|
||||
|
||||
| Name | Type | Description |
|
||||
| ---- | ---- | ----------- |
|
||||
| clicked | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when the decorated element is clicked. |
|
||||
| error | [`EventEmitter`](https://angular.io/api/core/EventEmitter)`<any>` | Emitted when an error occurs. |
|
@ -1,92 +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 { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import { MatNativeDateModule, MatRippleModule, MatOptionModule } from '@angular/material/core';
|
||||
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
||||
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { MatGridListModule } from '@angular/material/grid-list';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatTabsModule } from '@angular/material/tabs';
|
||||
|
||||
@NgModule({
|
||||
providers: [{ provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { floatLabel: 'never' } }],
|
||||
imports: [
|
||||
MatAutocompleteModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatDialogModule,
|
||||
MatCheckboxModule,
|
||||
MatDatepickerModule,
|
||||
MatGridListModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatListModule,
|
||||
MatOptionModule,
|
||||
MatRadioModule,
|
||||
MatSelectModule,
|
||||
MatSlideToggleModule,
|
||||
MatTableModule,
|
||||
MatTabsModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatNativeDateModule,
|
||||
MatRippleModule,
|
||||
MatChipsModule,
|
||||
MatMenuModule,
|
||||
MatExpansionModule
|
||||
],
|
||||
exports: [
|
||||
MatAutocompleteModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatDialogModule,
|
||||
MatCheckboxModule,
|
||||
MatDatepickerModule,
|
||||
MatGridListModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatListModule,
|
||||
MatOptionModule,
|
||||
MatRadioModule,
|
||||
MatSelectModule,
|
||||
MatSlideToggleModule,
|
||||
MatTableModule,
|
||||
MatTabsModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatNativeDateModule,
|
||||
MatRippleModule,
|
||||
MatChipsModule,
|
||||
MatMenuModule,
|
||||
MatExpansionModule
|
||||
]
|
||||
})
|
||||
export class MaterialModule {}
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
||||
import { CoreModule, FormRenderingService, provideTranslations } from '@alfresco/adf-core';
|
||||
import { FormRenderingService, provideTranslations } from '@alfresco/adf-core';
|
||||
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';
|
||||
@ -31,35 +31,22 @@ import {
|
||||
TASK_LIST_PREFERENCES_SERVICE_TOKEN
|
||||
} from './services/public-api';
|
||||
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';
|
||||
|
||||
export const PROCESS_SERVICES_CLOUD_DIRECTIVES = [
|
||||
...APP_LIST_CLOUD_DIRECTIVES,
|
||||
...FORM_CLOUD_DIRECTIVES,
|
||||
...TASK_FORM_CLOUD_DIRECTIVES,
|
||||
PeopleCloudComponent,
|
||||
RichTextEditorComponent
|
||||
] as const;
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CoreModule,
|
||||
...APP_LIST_CLOUD_DIRECTIVES,
|
||||
ProcessCloudModule,
|
||||
TaskCloudModule,
|
||||
GroupCloudComponent,
|
||||
PeopleCloudComponent,
|
||||
...FORM_CLOUD_DIRECTIVES,
|
||||
...TASK_FORM_CLOUD_DIRECTIVES,
|
||||
ApolloModule,
|
||||
RichTextEditorComponent
|
||||
],
|
||||
imports: [ProcessCloudModule, TaskCloudModule, GroupCloudComponent, ...PROCESS_SERVICES_CLOUD_DIRECTIVES],
|
||||
providers: [provideTranslations('adf-process-services-cloud', 'assets/adf-process-services-cloud')],
|
||||
exports: [
|
||||
...APP_LIST_CLOUD_DIRECTIVES,
|
||||
ProcessCloudModule,
|
||||
TaskCloudModule,
|
||||
GroupCloudComponent,
|
||||
...FORM_CLOUD_DIRECTIVES,
|
||||
...TASK_FORM_CLOUD_DIRECTIVES,
|
||||
PeopleCloudComponent,
|
||||
RichTextEditorComponent
|
||||
]
|
||||
exports: [ProcessCloudModule, TaskCloudModule, GroupCloudComponent, ...PROCESS_SERVICES_CLOUD_DIRECTIVES]
|
||||
})
|
||||
export class ProcessServicesCloudModule {
|
||||
static forRoot(
|
||||
|
@ -16,14 +16,16 @@
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ProcessFiltersCloudModule } from './process-filters/process-filters-cloud.module';
|
||||
import { PROCESS_FILTERS_CLOUD_DIRECTIVES } from './process-filters/process-filters-cloud.module';
|
||||
import { ProcessListCloudModule } from './process-list/process-list-cloud.module';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { StartProcessCloudComponent } from './start-process/components/start-process-cloud.component';
|
||||
import { ProcessHeaderCloudComponent } from './process-header/components/process-header-cloud.component';
|
||||
|
||||
export const PROCESS_CLOUD_DIRECTIVES = [StartProcessCloudComponent, ProcessHeaderCloudComponent] as const;
|
||||
|
||||
/** @deprecated use standalone components or PROCESS_CLOUD_DIRECTIVES instead */
|
||||
@NgModule({
|
||||
imports: [CoreModule, ProcessFiltersCloudModule, ProcessListCloudModule, StartProcessCloudComponent, ProcessHeaderCloudComponent],
|
||||
exports: [ProcessFiltersCloudModule, ProcessListCloudModule, StartProcessCloudComponent, ProcessHeaderCloudComponent]
|
||||
imports: [...PROCESS_FILTERS_CLOUD_DIRECTIVES, ProcessListCloudModule, ...PROCESS_CLOUD_DIRECTIVES],
|
||||
exports: [...PROCESS_FILTERS_CLOUD_DIRECTIVES, ProcessListCloudModule, ...PROCESS_CLOUD_DIRECTIVES]
|
||||
})
|
||||
export class ProcessCloudModule {}
|
||||
|
@ -8,7 +8,12 @@
|
||||
<span *ngIf="showTitle"> {{ 'ADF_CLOUD_EDIT_PROCESS_FILTER.TITLE' | translate}}</span>
|
||||
<div *ngIf="showFilterActions" class="adf-cloud-edit-process-filter-actions">
|
||||
<ng-container *ngIf="toggleFilterActions">
|
||||
<button *ngFor="let filterAction of processFilterActions" mat-icon-button [title]="filterAction.tooltip | translate" [attr.data-automation-id]="'adf-filter-action-' + filterAction.actionType" [disabled]="isDisabledAction(filterAction)" (click)="executeFilterActions($event, filterAction)">
|
||||
<button *ngFor="let filterAction of processFilterActions"
|
||||
mat-icon-button
|
||||
[title]="filterAction.tooltip | translate"
|
||||
[attr.data-automation-id]="'adf-filter-action-' + filterAction.actionType"
|
||||
[disabled]="isDisabledAction(filterAction)"
|
||||
(click)="executeFilterActions($event, filterAction)">
|
||||
<adf-icon [value]="filterAction.icon" />
|
||||
</button>
|
||||
</ng-container>
|
||||
@ -72,14 +77,16 @@
|
||||
[matDatepicker]="dateController"
|
||||
placeholder="{{processFilterProperty.label | translate}}"
|
||||
[attr.data-automation-id]="'adf-cloud-edit-process-property-' + processFilterProperty.key">
|
||||
<mat-datepicker-toggle matSuffix [for]="dateController" [attr.data-automation-id]="'adf-cloud-edit-process-property-date-toggle-' + processFilterProperty.key" />
|
||||
<mat-datepicker #dateController [attr.data-automation-id]="'adf-cloud-edit-process-property-date-picker-' + processFilterProperty.key" />
|
||||
<div class="adf-edit-process-filter-date-error-container">
|
||||
<div *ngIf="hasError(processFilterProperty)">
|
||||
<div class="adf-error-text">{{'ADF_CLOUD_EDIT_PROCESS_FILTER.ERROR.DATE' | translate}}</div>
|
||||
<mat-icon class="adf-error-icon">warning</mat-icon>
|
||||
<mat-datepicker-toggle
|
||||
matSuffix [for]="dateController"
|
||||
[attr.data-automation-id]="'adf-cloud-edit-process-property-date-toggle-' + processFilterProperty.key" />
|
||||
<mat-datepicker #dateController [attr.data-automation-id]="'adf-cloud-edit-process-property-date-picker-' + processFilterProperty.key" />
|
||||
<div class="adf-edit-process-filter-date-error-container">
|
||||
<div *ngIf="hasError(processFilterProperty)">
|
||||
<div class="adf-error-text">{{'ADF_CLOUD_EDIT_PROCESS_FILTER.ERROR.DATE' | translate}}</div>
|
||||
<mat-icon class="adf-error-icon">warning</mat-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-form-field>
|
||||
|
||||
<adf-cloud-date-range-filter *ngIf="processFilterProperty.type === 'date-range'"
|
@ -16,51 +16,41 @@
|
||||
*/
|
||||
|
||||
import { AlfrescoApiService } from '@alfresco/adf-content-services';
|
||||
import { ADF_DATE_FORMATS, FullNamePipe, NoopAuthModule, NoopTranslateModule, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { ADF_DATE_FORMATS, NoopAuthModule, NoopTranslateModule, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { DateFnsAdapter } from '@angular/material-date-fns-adapter';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';
|
||||
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatExpansionPanelHarness } from '@angular/material/expansion/testing';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconTestingModule } from '@angular/material/icon/testing';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||
import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatSelectHarness } from '@angular/material/select/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { endOfDay, format, isValid, startOfDay, subYears } from 'date-fns';
|
||||
import { enUS } from 'date-fns/locale';
|
||||
import { of } from 'rxjs';
|
||||
import { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service';
|
||||
import { DateRangeFilterComponent } from '../../../common/date-range-filter/date-range-filter.component';
|
||||
import { fakeEnvironmentList } from '../../../common/mock/environment.mock';
|
||||
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 { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
||||
import { NotificationCloudService } from '../../../services/notification-cloud.service';
|
||||
import { ProcessCloudService } from '../../services/process-cloud.service';
|
||||
import { mockAppVersions } from '../mock/process-filters-cloud.mock';
|
||||
import { ProcessFilterCloudModel } from '../models/process-filter-cloud.model';
|
||||
import { ProcessFilterCloudService } from '../services/process-filter-cloud.service';
|
||||
import { fakeApplicationInstance, fakeApplicationInstanceWithEnvironment } from './../../../app/mock/app-model.mock';
|
||||
import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service';
|
||||
import { fakeEnvironmentList } from '../../../../common/mock/environment.mock';
|
||||
import { DateCloudFilterType } from '../../../../models/date-cloud-filter.model';
|
||||
import { ProcessDefinitionCloud } from '../../../../models/process-definition-cloud.model';
|
||||
import { IdentityUserServiceMock } from '../../../../people/mock/people-cloud.mock';
|
||||
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';
|
||||
import { ProcessCloudService } from '../../../services/process-cloud.service';
|
||||
import { mockAppVersions } from '../../mock/process-filters-cloud.mock';
|
||||
import { ProcessFilterCloudModel } from '../../models/process-filter-cloud.model';
|
||||
import { ProcessFilterCloudService } from '../../services/process-filter-cloud.service';
|
||||
import { fakeApplicationInstance, fakeApplicationInstanceWithEnvironment } from '../../../../app/mock/app-model.mock';
|
||||
import {
|
||||
EditProcessFilterCloudComponent,
|
||||
PROCESS_FILTER_ACTION_RESTORE,
|
||||
PROCESS_FILTER_ACTION_SAVE_DEFAULT
|
||||
} from './edit-process-filter-cloud.component';
|
||||
import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud.component';
|
||||
import { ProcessFilterDialogCloudComponent } from '../process-filter-dialog/process-filter-dialog-cloud.component';
|
||||
import { IdentityUserService } from '@alfresco/adf-process-services-cloud';
|
||||
|
||||
describe('EditProcessFilterCloudComponent', () => {
|
||||
@ -106,17 +96,7 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
MatDialogModule,
|
||||
NoopTranslateModule,
|
||||
NoopAnimationsModule,
|
||||
MatSelectModule,
|
||||
MatDatepickerModule,
|
||||
MatAutocompleteModule,
|
||||
FullNamePipe,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
ReactiveFormsModule,
|
||||
MatChipsModule,
|
||||
MatProgressBarModule,
|
||||
PeopleCloudComponent,
|
||||
DateRangeFilterComponent
|
||||
EditProcessFilterCloudComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService },
|
@ -16,28 +16,40 @@
|
||||
*/
|
||||
|
||||
import { Component, DestroyRef, EventEmitter, inject, Input, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||
import { AbstractControl, FormBuilder, FormControl, FormGroup } from '@angular/forms';
|
||||
import { AbstractControl, FormBuilder, FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { DateAdapter } from '@angular/material/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { debounceTime, filter, finalize, switchMap, tap } from 'rxjs/operators';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service';
|
||||
import { AppsProcessCloudService } from '../../../../app/services/apps-process-cloud.service';
|
||||
import {
|
||||
ProcessFilterAction,
|
||||
ProcessFilterCloudModel,
|
||||
ProcessFilterOptions,
|
||||
ProcessFilterProperties,
|
||||
ProcessSortFilterProperty
|
||||
} from '../models/process-filter-cloud.model';
|
||||
import { DateFnsUtils, TranslationService, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
||||
import { ProcessFilterCloudService } from '../services/process-filter-cloud.service';
|
||||
import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud.component';
|
||||
import { ProcessCloudService } from '../../services/process-cloud.service';
|
||||
import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.model';
|
||||
import { IdentityUserModel } from '../../../people/models/identity-user.model';
|
||||
import { Environment } from '../../../common/interface/environment.interface';
|
||||
} from '../../models/process-filter-cloud.model';
|
||||
import { DateFnsUtils, IconComponent, TranslationService, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
||||
import { ProcessFilterCloudService } from '../../services/process-filter-cloud.service';
|
||||
import { ProcessFilterDialogCloudComponent } from '../process-filter-dialog/process-filter-dialog-cloud.component';
|
||||
import { ProcessCloudService } from '../../../services/process-cloud.service';
|
||||
import { DateCloudFilterType, DateRangeFilter } from '../../../../models/date-cloud-filter.model';
|
||||
import { IdentityUserModel } from '../../../../people/models/identity-user.model';
|
||||
import { Environment } from '../../../../common/interface/environment.interface';
|
||||
import { endOfDay, isValid, startOfDay } from 'date-fns';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { NgForOf, NgIf } from '@angular/common';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
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 { DateRangeFilterComponent } from '../../../../common/date-range-filter/date-range-filter.component';
|
||||
import { PeopleCloudComponent } from '../../../../people/components/people-cloud.component';
|
||||
|
||||
export const PROCESS_FILTER_ACTION_SAVE = 'save';
|
||||
export const PROCESS_FILTER_ACTION_SAVE_AS = 'saveAs';
|
||||
@ -68,6 +80,24 @@ interface ProcessFilterFormProps {
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-edit-process-filter',
|
||||
standalone: true,
|
||||
imports: [
|
||||
IconComponent,
|
||||
MatProgressSpinnerModule,
|
||||
TranslateModule,
|
||||
MatButtonModule,
|
||||
NgForOf,
|
||||
NgIf,
|
||||
MatExpansionModule,
|
||||
MatFormFieldModule,
|
||||
MatSelectModule,
|
||||
ReactiveFormsModule,
|
||||
MatInputModule,
|
||||
MatDatepickerModule,
|
||||
MatIconModule,
|
||||
DateRangeFilterComponent,
|
||||
PeopleCloudComponent
|
||||
],
|
||||
templateUrl: './edit-process-filter-cloud.component.html',
|
||||
styleUrls: ['./edit-process-filter-cloud.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
@ -4,11 +4,14 @@
|
||||
</span>
|
||||
<mat-card appearance="outlined" class="adf-process-filter-dialog-card">
|
||||
<mat-card-content class="adf-process-filter-dialog-card-content">
|
||||
<form [formGroup]="filterForm">
|
||||
<mat-form-field class="adf-process-filter-name" [floatLabel]="'auto'">
|
||||
<input matInput placeholder="{{ 'ADF_CLOUD_EDIT_PROCESS_FILTER.FILTER_NAME' | translate }}" [formControl]="filterForm.controls.name" id="adf-filter-name-id">
|
||||
</mat-form-field>
|
||||
</form>
|
||||
<form [formGroup]="filterForm">
|
||||
<mat-form-field class="adf-process-filter-name" [floatLabel]="'auto'">
|
||||
<input
|
||||
matInput
|
||||
placeholder="{{ 'ADF_CLOUD_EDIT_PROCESS_FILTER.FILTER_NAME' | translate }}"
|
||||
[formControl]="filterForm.controls.name" id="adf-filter-name-id">
|
||||
</mat-form-field>
|
||||
</form>
|
||||
</mat-card-content>
|
||||
<mat-card-actions class='adf-process-filter-dialog-actions'>
|
||||
<button mat-button (click)="onSaveClick()" id="adf-save-button-id" [disabled]="!filterForm.valid">
|
@ -18,8 +18,7 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud.component';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
import { ProcessFiltersCloudModule } from '../process-filters-cloud.module';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module';
|
||||
|
||||
describe('ProcessFilterDialogCloudComponent', () => {
|
||||
let component: ProcessFilterDialogCloudComponent;
|
||||
@ -36,7 +35,7 @@ describe('ProcessFilterDialogCloudComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessServiceCloudTestingModule, ProcessFiltersCloudModule],
|
||||
imports: [ProcessServiceCloudTestingModule, ProcessFilterDialogCloudComponent],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: mockDialogRef },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: mockDialogData }
|
@ -16,11 +16,17 @@
|
||||
*/
|
||||
|
||||
import { ChangeDetectionStrategy, Component, inject, ViewEncapsulation } from '@angular/core';
|
||||
import { FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-process-filter-dialog-cloud',
|
||||
standalone: true,
|
||||
imports: [TranslateModule, MatButtonModule, MatCardModule, MatInputModule, ReactiveFormsModule, MatDialogModule],
|
||||
templateUrl: './process-filter-dialog-cloud.component.html',
|
||||
styleUrls: ['./process-filter-dialog-cloud.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
@ -18,18 +18,16 @@
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { ProcessFilterCloudService } from '../services/process-filter-cloud.service';
|
||||
import { ProcessFilterCloudService } from '../../services/process-filter-cloud.service';
|
||||
import { ProcessFiltersCloudComponent } from './process-filters-cloud.component';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
||||
import { mockProcessFilters } from '../mock/process-filters-cloud.mock';
|
||||
import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../../services/cloud-token.service';
|
||||
import { LocalPreferenceCloudService } from '../../../../services/local-preference-cloud.service';
|
||||
import { mockProcessFilters } from '../../mock/process-filters-cloud.mock';
|
||||
import { AppConfigService, AppConfigServiceMock, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { ProcessListCloudService } from '../../../process/process-list/services/process-list-cloud.service';
|
||||
import { NotificationCloudService } from '../../../services/notification-cloud.service';
|
||||
import { ProcessListCloudService } from '../../../process-list/services/process-list-cloud.service';
|
||||
import { ApolloModule } from 'apollo-angular';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
|
||||
const ProcessFilterCloudServiceMock = {
|
||||
getProcessFilters: () => of(mockProcessFilters),
|
||||
@ -46,16 +44,18 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
|
||||
const configureTestingModule = (searchApiMethod: 'GET' | 'POST') => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopTranslateModule, NoopAnimationsModule, MatListModule],
|
||||
imports: [NoopTranslateModule, NoopAnimationsModule, ProcessFiltersCloudComponent],
|
||||
providers: [
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
{ provide: ProcessListCloudService, useValue: {
|
||||
getProcessCounter: () => of(10),
|
||||
getProcessListCounter: () => of(10)
|
||||
}},
|
||||
{
|
||||
provide: ProcessListCloudService,
|
||||
useValue: {
|
||||
getProcessCounter: () => of(10),
|
||||
getProcessListCounter: () => of(10)
|
||||
}
|
||||
},
|
||||
{ provide: ProcessFilterCloudService, useValue: ProcessFilterCloudServiceMock },
|
||||
NotificationCloudService,
|
||||
ApolloModule
|
||||
]
|
||||
});
|
@ -15,30 +15,25 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
Component,
|
||||
DestroyRef,
|
||||
EventEmitter,
|
||||
inject,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnInit,
|
||||
Output,
|
||||
SimpleChanges,
|
||||
ViewEncapsulation
|
||||
} from '@angular/core';
|
||||
import { Component, DestroyRef, EventEmitter, inject, Input, OnChanges, OnInit, Output, SimpleChanges, ViewEncapsulation } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ProcessFilterCloudService } from '../services/process-filter-cloud.service';
|
||||
import { ProcessFilterCloudModel } from '../models/process-filter-cloud.model';
|
||||
import { AppConfigService, TranslationService } from '@alfresco/adf-core';
|
||||
import { FilterParamsModel } from '../../../task/task-filters/models/filter-cloud.model';
|
||||
import { ProcessFilterCloudService } from '../../services/process-filter-cloud.service';
|
||||
import { ProcessFilterCloudModel } from '../../models/process-filter-cloud.model';
|
||||
import { AppConfigService, IconComponent, TranslationService } from '@alfresco/adf-core';
|
||||
import { FilterParamsModel } from '../../../../task/task-filters/models/filter-cloud.model';
|
||||
import { debounceTime, tap } from 'rxjs/operators';
|
||||
import { ProcessListCloudService } from '../../../process/process-list/services/process-list-cloud.service';
|
||||
import { ProcessFilterCloudAdapter } from '../../process-list/models/process-cloud-query-request.model';
|
||||
import { ProcessListCloudService } from '../../../process-list/services/process-list-cloud.service';
|
||||
import { ProcessFilterCloudAdapter } from '../../../process-list/models/process-cloud-query-request.model';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { AsyncPipe, NgForOf, NgIf } from '@angular/common';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatListModule } from '@angular/material/list';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-process-filters',
|
||||
standalone: true,
|
||||
imports: [TranslateModule, IconComponent, NgIf, MatProgressSpinnerModule, NgForOf, MatListModule, AsyncPipe],
|
||||
templateUrl: './process-filters-cloud.component.html',
|
||||
styleUrls: ['./process-filters-cloud.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
@ -326,6 +321,6 @@ export class ProcessFiltersCloudComponent implements OnInit, OnChanges {
|
||||
private fetchProcessFilterCounter(filter: ProcessFilterCloudModel): Observable<number> {
|
||||
return this.searchApiMethod === 'POST'
|
||||
? this.processListCloudService.getProcessListCounter(new ProcessFilterCloudAdapter(filter))
|
||||
: this.processListCloudService.getProcessCounter(filter.appName, filter.status)
|
||||
: this.processListCloudService.getProcessCounter(filter.appName, filter.status);
|
||||
}
|
||||
}
|
@ -16,31 +16,19 @@
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ProcessFiltersCloudComponent } from './components/process-filters-cloud.component';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
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 { PeopleCloudComponent } from '../../people/components/people-cloud.component';
|
||||
import { DateRangeFilterComponent } from '../../common/date-range-filter/date-range-filter.component';
|
||||
import { ProcessFiltersCloudComponent } from './components/process-filters/process-filters-cloud.component';
|
||||
import { EditProcessFilterCloudComponent } from './components/edit-process-filter/edit-process-filter-cloud.component';
|
||||
import { ProcessFilterDialogCloudComponent } from './components/process-filter-dialog/process-filter-dialog-cloud.component';
|
||||
|
||||
export const PROCESS_FILTERS_CLOUD_DIRECTIVES = [
|
||||
ProcessFiltersCloudComponent,
|
||||
EditProcessFilterCloudComponent,
|
||||
ProcessFilterDialogCloudComponent
|
||||
] as const;
|
||||
|
||||
/** @deprecated use standalone components or PROCESS_FILTERS_CLOUD_DIRECTIVES instead */
|
||||
@NgModule({
|
||||
imports: [
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
HttpClientModule,
|
||||
CommonModule,
|
||||
MaterialModule,
|
||||
...APP_LIST_CLOUD_DIRECTIVES,
|
||||
CoreModule,
|
||||
DateRangeFilterComponent,
|
||||
PeopleCloudComponent
|
||||
],
|
||||
declarations: [ProcessFiltersCloudComponent, EditProcessFilterCloudComponent, ProcessFilterDialogCloudComponent],
|
||||
exports: [ProcessFiltersCloudComponent, EditProcessFilterCloudComponent, ProcessFilterDialogCloudComponent]
|
||||
imports: [...PROCESS_FILTERS_CLOUD_DIRECTIVES],
|
||||
exports: [...PROCESS_FILTERS_CLOUD_DIRECTIVES]
|
||||
})
|
||||
export class ProcessFiltersCloudModule {}
|
||||
|
@ -15,9 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './components/process-filters-cloud.component';
|
||||
export * from './components/edit-process-filter-cloud.component';
|
||||
export * from './components/process-filter-dialog-cloud.component';
|
||||
export * from './components/process-filters/process-filters-cloud.component';
|
||||
export * from './components/edit-process-filter/edit-process-filter-cloud.component';
|
||||
export * from './components/process-filter-dialog/process-filter-dialog-cloud.component';
|
||||
export * from './models/process-filter-cloud.model';
|
||||
export * from './services/process-filter-cloud.service';
|
||||
export * from './process-filters-cloud.module';
|
||||
|
2
lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.html
2
lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.html
@ -1,4 +1,4 @@
|
||||
<adf-datatable #dataTable
|
||||
<adf-datatable
|
||||
[rows]="rows"
|
||||
[columns]="columns"
|
||||
[data]="dataAdapter"
|
||||
|
@ -23,28 +23,113 @@ import {
|
||||
ColumnsSelectorComponent,
|
||||
CustomEmptyContentTemplateDirective,
|
||||
DataColumn,
|
||||
DataColumnComponent,
|
||||
DataColumnListComponent,
|
||||
DataRowEvent,
|
||||
getDataColumnMock,
|
||||
ObjectDataColumn,
|
||||
ObjectDataRow,
|
||||
User
|
||||
} from '@alfresco/adf-core';
|
||||
import { ProcessListCloudService } from '../services/process-list-cloud.service';
|
||||
import { ProcessListCloudComponent } from './process-list-cloud.component';
|
||||
import { fakeCustomSchema, fakeProcessCloudList, processListSchemaMock } from '../mock/process-list-service.mock';
|
||||
import { of } from 'rxjs';
|
||||
import { shareReplay, skip } from 'rxjs/operators';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
import { ProcessListCloudSortingModel } from '../models/process-list-sorting.model';
|
||||
import { PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||
import { ProcessListCloudPreferences } from '../models/process-cloud-preferences';
|
||||
import { PROCESS_LIST_CUSTOM_VARIABLE_COLUMN } from '../../../models/data-column-custom-data';
|
||||
import { PROCESS_LIST_CUSTOM_VARIABLE_COLUMN, ProcessListDataColumnCustomData } from '../../../models/data-column-custom-data';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
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';
|
||||
|
||||
const fakeCustomSchema = [
|
||||
new ObjectDataColumn<ProcessListDataColumnCustomData>({
|
||||
key: 'fakeName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true
|
||||
}),
|
||||
new ObjectDataColumn<ProcessListDataColumnCustomData>({
|
||||
key: 'fakeTaskName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
})
|
||||
];
|
||||
|
||||
const fakeProcessCloudList = {
|
||||
list: {
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
appName: 'easy-peasy-japanesey',
|
||||
appVersion: 1,
|
||||
id: '69eddfa7-d781-11e8-ae24-0a58646001fa',
|
||||
name: 'starring',
|
||||
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',
|
||||
processDefinitionKey: 'BasicProcess',
|
||||
initiator: 'devopsuser',
|
||||
startDate: 1540381146275,
|
||||
businessKey: 'MyBusinessKey',
|
||||
status: 'RUNNING',
|
||||
lastModified: 1540381146276,
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
variables: [{ id: 'variableId', value: 'variableValue' }]
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
appName: 'easy-peasy-japanesey',
|
||||
appVersion: 1,
|
||||
id: '8b3f625f-d781-11e8-ae24-0a58646001fa',
|
||||
name: null,
|
||||
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',
|
||||
processDefinitionKey: 'BasicProcess',
|
||||
initiator: 'devopsuser',
|
||||
startDate: 1540381202174,
|
||||
businessKey: 'MyBusinessKey',
|
||||
status: 'RUNNING',
|
||||
lastModified: 1540381202174,
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
appName: 'easy-peasy-japanesey',
|
||||
appVersion: 2,
|
||||
id: '87c12637-d783-11e8-ae24-0a58646001fa',
|
||||
name: null,
|
||||
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',
|
||||
processDefinitionKey: 'BasicProcess',
|
||||
initiator: 'superadminuser',
|
||||
startDate: 1540382055307,
|
||||
businessKey: 'MyBusinessKey',
|
||||
status: 'RUNNING',
|
||||
lastModified: 1540382055308,
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null
|
||||
}
|
||||
}
|
||||
],
|
||||
pagination: {
|
||||
skipCount: 0,
|
||||
maxItems: 100,
|
||||
count: 3,
|
||||
hasMoreItems: false,
|
||||
totalItems: 3
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [DataColumnComponent, DataColumnListComponent, ProcessListCloudComponent],
|
||||
template: ` <adf-cloud-process-list #processListCloud>
|
||||
<data-columns>
|
||||
<data-column key="name" title="ADF_CLOUD_TASK_LIST.PROPERTIES.NAME" class="adf-full-width adf-name-column" [order]="3" />
|
||||
@ -66,6 +151,62 @@ class CustomTaskListComponent {
|
||||
}
|
||||
}
|
||||
|
||||
const processListSchemaMock = {
|
||||
presets: {
|
||||
default: [
|
||||
{
|
||||
key: 'id',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.ID'
|
||||
},
|
||||
{
|
||||
key: 'name',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.NAME'
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.STATUS'
|
||||
},
|
||||
{
|
||||
key: 'startDate',
|
||||
type: 'date',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.START_DATE',
|
||||
format: 'timeAgo'
|
||||
},
|
||||
{
|
||||
key: 'appName',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.APP_NAME'
|
||||
},
|
||||
{
|
||||
key: 'businessKey',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.BUSINESS_KEY'
|
||||
},
|
||||
{
|
||||
key: 'initiator',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.INITIATOR'
|
||||
},
|
||||
{
|
||||
key: 'lastModified',
|
||||
type: 'date',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.LAST_MODIFIED'
|
||||
},
|
||||
{
|
||||
key: 'processDefinitionId',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEF_ID'
|
||||
},
|
||||
{
|
||||
key: 'processDefinitionKey',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEF_KEY'
|
||||
}
|
||||
].map((column: { key: string; type: string; title: string; sortable: boolean; format: string }) => {
|
||||
column.sortable = true;
|
||||
if (!column.type) {
|
||||
column.type = 'text';
|
||||
}
|
||||
return column;
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
describe('ProcessListCloudComponent', () => {
|
||||
let loader: HarnessLoader;
|
||||
let component: ProcessListCloudComponent;
|
||||
@ -78,7 +219,7 @@ describe('ProcessListCloudComponent', () => {
|
||||
|
||||
const configureTestingModule = (searchApiMethod: 'GET' | 'POST') => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessServiceCloudTestingModule]
|
||||
imports: [ProcessServiceCloudTestingModule, ProcessListCloudComponent]
|
||||
});
|
||||
appConfig = TestBed.inject(AppConfigService);
|
||||
processListCloudService = TestBed.inject(ProcessListCloudService);
|
||||
@ -904,8 +1045,7 @@ describe('ProcessListCloudComponent: Injecting custom columns for task list - Cu
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessServiceCloudTestingModule],
|
||||
declarations: [CustomTaskListComponent]
|
||||
imports: [ProcessServiceCloudTestingModule, CustomTaskListComponent]
|
||||
});
|
||||
fixtureCustom = TestBed.createComponent(CustomTaskListComponent);
|
||||
fixtureCustom.detectChanges();
|
||||
@ -928,6 +1068,8 @@ describe('ProcessListCloudComponent: Injecting custom columns for task list - Cu
|
||||
|
||||
describe('ProcessListCloudComponent: Creating an empty custom template - EmptyTemplateComponent', () => {
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CustomEmptyContentTemplateDirective, ProcessListCloudComponent],
|
||||
template: `
|
||||
<adf-cloud-process-list #processListCloud>
|
||||
<adf-custom-empty-content-template>
|
||||
@ -949,9 +1091,14 @@ describe('ProcessListCloudComponent: Creating an empty custom template - EmptyTe
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessServiceCloudTestingModule, MatProgressSpinnerModule, CustomEmptyContentTemplateDirective],
|
||||
providers: [{ provide: PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN, useValue: preferencesService }],
|
||||
declarations: [EmptyTemplateComponent, ProcessListCloudComponent]
|
||||
imports: [
|
||||
ProcessServiceCloudTestingModule,
|
||||
MatProgressSpinnerModule,
|
||||
CustomEmptyContentTemplateDirective,
|
||||
ProcessListCloudComponent,
|
||||
EmptyTemplateComponent
|
||||
],
|
||||
providers: [{ provide: PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN, useValue: preferencesService }]
|
||||
});
|
||||
fixtureEmpty = TestBed.createComponent(EmptyTemplateComponent);
|
||||
fixtureEmpty.detectChanges();
|
||||
|
129
lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.ts
129
lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.ts
@ -30,6 +30,7 @@ import {
|
||||
} from '@angular/core';
|
||||
import {
|
||||
AppConfigService,
|
||||
ColumnsSelectorComponent,
|
||||
CustomEmptyContentTemplateDirective,
|
||||
CustomLoadingContentTemplateDirective,
|
||||
DataCellEvent,
|
||||
@ -38,6 +39,10 @@ import {
|
||||
DataRowEvent,
|
||||
DataTableComponent,
|
||||
DataTableSchema,
|
||||
EmptyContentComponent,
|
||||
LoadingContentTemplateDirective,
|
||||
MainMenuDataTableTemplateDirective,
|
||||
NoContentTemplateDirective,
|
||||
PaginatedComponent,
|
||||
PaginationModel,
|
||||
UserPreferencesService,
|
||||
@ -53,26 +58,40 @@ import { PreferenceCloudServiceInterface } from '../../../services/preference-cl
|
||||
import { PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||
import { ProcessListCloudPreferences } from '../models/process-cloud-preferences';
|
||||
import { ProcessListDatatableAdapter } from '../datatable/process-list-datatable-adapter';
|
||||
import {
|
||||
PROCESS_LIST_CUSTOM_VARIABLE_COLUMN,
|
||||
ProcessListDataColumnCustomData
|
||||
} from '../../../models/data-column-custom-data';
|
||||
import { PROCESS_LIST_CUSTOM_VARIABLE_COLUMN, ProcessListDataColumnCustomData } from '../../../models/data-column-custom-data';
|
||||
import { VariableMapperService } from '../../../services/variable-mapper.sevice';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { ProcessVariableFilterModel } from '../../../models/process-variable-filter.model';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NgIf } from '@angular/common';
|
||||
|
||||
const PRESET_KEY = 'adf-cloud-process-list.presets';
|
||||
|
||||
/* eslint-disable @typescript-eslint/brace-style */
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-process-list',
|
||||
standalone: true,
|
||||
imports: [
|
||||
DataTableComponent,
|
||||
MatProgressSpinnerModule,
|
||||
TranslateModule,
|
||||
ColumnsSelectorComponent,
|
||||
MainMenuDataTableTemplateDirective,
|
||||
EmptyContentComponent,
|
||||
NoContentTemplateDirective,
|
||||
LoadingContentTemplateDirective,
|
||||
NgIf
|
||||
],
|
||||
templateUrl: './process-list-cloud.component.html',
|
||||
styleUrls: ['./process-list-cloud.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class ProcessListCloudComponent
|
||||
extends DataTableSchema<ProcessListDataColumnCustomData>
|
||||
implements OnChanges, AfterContentInit, PaginatedComponent {
|
||||
|
||||
implements OnChanges, AfterContentInit, PaginatedComponent
|
||||
{
|
||||
@ViewChild(DataTableComponent) dataTable: DataTableComponent;
|
||||
|
||||
@ContentChild(CustomEmptyContentTemplateDirective)
|
||||
@ -244,24 +263,24 @@ export class ProcessListCloudComponent
|
||||
@Input()
|
||||
processDefinitionNames: string[] = [];
|
||||
|
||||
/**
|
||||
* Filter the processes. Display only processes started by any of the users whose usernames are present in the array.
|
||||
* This input will be used only if searchApiMethod input is provided with 'POST' value.
|
||||
*/
|
||||
/**
|
||||
* Filter the processes. Display only processes started by any of the users whose usernames are present in the array.
|
||||
* This input will be used only if searchApiMethod input is provided with 'POST' value.
|
||||
*/
|
||||
@Input()
|
||||
initiators: string[] = [];
|
||||
|
||||
/**
|
||||
* Filter the processes. Display only processes present in any of the specified app versions.
|
||||
* This input will be used only if searchApiMethod input is provided with 'POST' value.
|
||||
*/
|
||||
/**
|
||||
* Filter the processes. Display only processes present in any of the specified app versions.
|
||||
* This input will be used only if searchApiMethod input is provided with 'POST' value.
|
||||
*/
|
||||
@Input()
|
||||
appVersions: string[] = [];
|
||||
|
||||
/**
|
||||
* Filter the processes. Display only processes with provided statuses.
|
||||
* This input will be used only if searchApiMethod input is provided with 'POST' value.
|
||||
*/
|
||||
/**
|
||||
* Filter the processes. Display only processes with provided statuses.
|
||||
* This input will be used only if searchApiMethod input is provided with 'POST' value.
|
||||
*/
|
||||
@Input()
|
||||
statuses: string[] = [];
|
||||
|
||||
@ -278,7 +297,7 @@ export class ProcessListCloudComponent
|
||||
|
||||
/** Emitted when rows are selected/unselected. */
|
||||
@Output()
|
||||
rowsSelected: EventEmitter<any[]> = new EventEmitter<any[]>();
|
||||
rowsSelected = new EventEmitter<any[]>();
|
||||
|
||||
/** Emitted before the context menu is displayed for a row. */
|
||||
@Output()
|
||||
@ -294,11 +313,11 @@ export class ProcessListCloudComponent
|
||||
|
||||
/** Emitted when an error occurs while loading the list of process instances from the server. */
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
error = new EventEmitter<any>();
|
||||
|
||||
/** Emitted when the list of process instances has been loaded successfully from the server. */
|
||||
@Output()
|
||||
success: EventEmitter<any> = new EventEmitter<any>();
|
||||
success = new EventEmitter<any>();
|
||||
|
||||
pagination: BehaviorSubject<PaginationModel>;
|
||||
size: number;
|
||||
@ -335,40 +354,39 @@ export class ProcessListCloudComponent
|
||||
totalItems: 0
|
||||
});
|
||||
|
||||
combineLatest([
|
||||
this.isColumnSchemaCreated$,
|
||||
this.fetchProcessesTrigger$
|
||||
]).pipe(
|
||||
tap(() => this.isLoading = true),
|
||||
filter(([isColumnSchemaCreated]) => isColumnSchemaCreated),
|
||||
switchMap(() => {
|
||||
if (this.searchApiMethod === 'POST') {
|
||||
const requestNode = this.createProcessListRequestNode();
|
||||
this.processListRequestNode = requestNode;
|
||||
return this.processListCloudService.fetchProcessList(requestNode).pipe(take(1));
|
||||
} else {
|
||||
const requestNode = this.createRequestNode();
|
||||
this.requestNode = requestNode;
|
||||
return this.processListCloudService.getProcessByRequest(requestNode).pipe(take(1));
|
||||
combineLatest([this.isColumnSchemaCreated$, this.fetchProcessesTrigger$])
|
||||
.pipe(
|
||||
tap(() => (this.isLoading = true)),
|
||||
filter(([isColumnSchemaCreated]) => isColumnSchemaCreated),
|
||||
switchMap(() => {
|
||||
if (this.searchApiMethod === 'POST') {
|
||||
const requestNode = this.createProcessListRequestNode();
|
||||
this.processListRequestNode = requestNode;
|
||||
return this.processListCloudService.fetchProcessList(requestNode).pipe(take(1));
|
||||
} else {
|
||||
const requestNode = this.createRequestNode();
|
||||
this.requestNode = requestNode;
|
||||
return this.processListCloudService.getProcessByRequest(requestNode).pipe(take(1));
|
||||
}
|
||||
}),
|
||||
takeUntilDestroyed()
|
||||
)
|
||||
.subscribe({
|
||||
next: (processes) => {
|
||||
this.rows = this.variableMapperService.mapVariablesByColumnTitle(processes.list.entries, this.columns);
|
||||
|
||||
this.dataAdapter = new ProcessListDatatableAdapter(this.rows, this.columns);
|
||||
|
||||
this.success.emit(processes);
|
||||
this.isLoading = false;
|
||||
this.pagination.next(processes.list.pagination);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(error);
|
||||
this.error.emit(error);
|
||||
this.isLoading = false;
|
||||
}
|
||||
}),
|
||||
takeUntilDestroyed()
|
||||
).subscribe({
|
||||
next: (processes) => {
|
||||
this.rows = this.variableMapperService.mapVariablesByColumnTitle(processes.list.entries, this.columns);
|
||||
|
||||
this.dataAdapter = new ProcessListDatatableAdapter(this.rows, this.columns);
|
||||
|
||||
this.success.emit(processes);
|
||||
this.isLoading = false;
|
||||
this.pagination.next(processes.list.pagination);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(error);
|
||||
this.error.emit(error);
|
||||
this.isLoading = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
@ -429,7 +447,6 @@ export class ProcessListCloudComponent
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private isAnyPropertyChanged(changes: SimpleChanges): boolean {
|
||||
for (const property in changes) {
|
||||
if (this.isPropertyChanged(changes, property)) {
|
||||
@ -613,7 +630,7 @@ export class ProcessListCloudComponent
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return new ProcessListRequestSortingModel({orderBy, direction, isFieldProcessVariable: false});
|
||||
return new ProcessListRequestSortingModel({ orderBy, direction, isFieldProcessVariable: false });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,163 +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 { ObjectDataColumn } from '@alfresco/adf-core';
|
||||
import { ProcessListDataColumnCustomData } from '../../../models/data-column-custom-data';
|
||||
|
||||
export const fakeProcessCloudList = {
|
||||
list: {
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
appName: 'easy-peasy-japanesey',
|
||||
appVersion: 1,
|
||||
id: '69eddfa7-d781-11e8-ae24-0a58646001fa',
|
||||
name: 'starring',
|
||||
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',
|
||||
processDefinitionKey: 'BasicProcess',
|
||||
initiator: 'devopsuser',
|
||||
startDate: 1540381146275,
|
||||
businessKey: 'MyBusinessKey',
|
||||
status: 'RUNNING',
|
||||
lastModified: 1540381146276,
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null,
|
||||
variables: [{ id: 'variableId', value: 'variableValue'}]
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
appName: 'easy-peasy-japanesey',
|
||||
appVersion: 1,
|
||||
id: '8b3f625f-d781-11e8-ae24-0a58646001fa',
|
||||
name: null,
|
||||
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',
|
||||
processDefinitionKey: 'BasicProcess',
|
||||
initiator: 'devopsuser',
|
||||
startDate: 1540381202174,
|
||||
businessKey: 'MyBusinessKey',
|
||||
status: 'RUNNING',
|
||||
lastModified: 1540381202174,
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null
|
||||
}
|
||||
},
|
||||
{
|
||||
entry: {
|
||||
appName: 'easy-peasy-japanesey',
|
||||
appVersion: 2,
|
||||
id: '87c12637-d783-11e8-ae24-0a58646001fa',
|
||||
name: null,
|
||||
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',
|
||||
processDefinitionKey: 'BasicProcess',
|
||||
initiator: 'superadminuser',
|
||||
startDate: 1540382055307,
|
||||
businessKey: 'MyBusinessKey',
|
||||
status: 'RUNNING',
|
||||
lastModified: 1540382055308,
|
||||
lastModifiedTo: null,
|
||||
lastModifiedFrom: null
|
||||
}
|
||||
}
|
||||
],
|
||||
pagination: {
|
||||
skipCount: 0,
|
||||
maxItems: 100,
|
||||
count: 3,
|
||||
hasMoreItems: false,
|
||||
totalItems: 3
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const fakeCustomSchema =
|
||||
[
|
||||
new ObjectDataColumn<ProcessListDataColumnCustomData>({
|
||||
key: 'fakeName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true
|
||||
}),
|
||||
new ObjectDataColumn<ProcessListDataColumnCustomData>({
|
||||
key: 'fakeTaskName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
})
|
||||
];
|
||||
|
||||
export const processListSchemaMock = {
|
||||
presets: {
|
||||
default: [
|
||||
{
|
||||
key: 'id',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.ID'
|
||||
},
|
||||
{
|
||||
key: 'name',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.NAME'
|
||||
},
|
||||
{
|
||||
key: 'status',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.STATUS'
|
||||
},
|
||||
{
|
||||
key: 'startDate',
|
||||
type: 'date',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.START_DATE',
|
||||
format: 'timeAgo'
|
||||
},
|
||||
{
|
||||
key: 'appName',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.APP_NAME'
|
||||
},
|
||||
{
|
||||
key: 'businessKey',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.BUSINESS_KEY'
|
||||
},
|
||||
{
|
||||
key: 'initiator',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.INITIATOR'
|
||||
},
|
||||
{
|
||||
key: 'lastModified',
|
||||
type: 'date',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.LAST_MODIFIED'
|
||||
},
|
||||
{
|
||||
key: 'processDefinitionId',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEF_ID'
|
||||
},
|
||||
{
|
||||
key: 'processDefinitionKey',
|
||||
title: 'ADF_CLOUD_PROCESS_LIST.PROPERTIES.PROCESS_DEF_KEY'
|
||||
}
|
||||
].map((column: {
|
||||
key: string;
|
||||
type: string;
|
||||
title: string;
|
||||
sortable: boolean;
|
||||
format: string;
|
||||
}) => {
|
||||
column.sortable = true;
|
||||
if (!column.type) {
|
||||
column.type = 'text';
|
||||
}
|
||||
return column;
|
||||
})
|
||||
}
|
||||
};
|
@ -16,22 +16,18 @@
|
||||
*/
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ProcessListCloudComponent } from './components/process-list-cloud.component';
|
||||
import { MaterialModule } from '../../material.module';
|
||||
import { CoreModule } from '@alfresco/adf-core';
|
||||
import { LocalPreferenceCloudService } from '../../services/local-preference-cloud.service';
|
||||
import { PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN } from '../../services/cloud-token.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, MaterialModule, CoreModule],
|
||||
imports: [ProcessListCloudComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN,
|
||||
useClass: LocalPreferenceCloudService
|
||||
}
|
||||
],
|
||||
declarations: [ProcessListCloudComponent],
|
||||
exports: [ProcessListCloudComponent]
|
||||
})
|
||||
export class ProcessListCloudModule {}
|
||||
|
@ -59,17 +59,6 @@ export const fakeProcessWithFormInstance: ProcessInstanceCloud = {
|
||||
processDefinitionName: 'my-process'
|
||||
};
|
||||
|
||||
export const fakeCreatedProcessInstance: ProcessInstanceCloud = {
|
||||
appName: 'simple-app',
|
||||
id: 'd0b30377-dc5a-11e8-ae24-0a58646001fa',
|
||||
name: 'My Process Name',
|
||||
startDate: null,
|
||||
initiator: 'usermock',
|
||||
status: 'CREATED',
|
||||
processDefinitionId: 'BasicProcess:1:d05062f1-c6fb-11e8-ae24-0a58646001fa',
|
||||
processDefinitionKey: 'BasicProcess'
|
||||
};
|
||||
|
||||
export const fakeProcessDefinitions: ProcessDefinitionCloud[] = [
|
||||
new ProcessDefinitionCloud({
|
||||
appName: 'myApp',
|
||||
|
@ -21,6 +21,7 @@ import { TASK_FILTERS_CLOUD_DIRECTIVES } from './task-filters/task-filters-cloud
|
||||
import { TASK_FORM_CLOUD_DIRECTIVES } from './task-form/task-form.module';
|
||||
import { TaskHeaderCloudComponent } from './task-header/components/task-header-cloud.component';
|
||||
|
||||
/** @deprecated use standalone component imports instead */
|
||||
@NgModule({
|
||||
imports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_FORM_CLOUD_DIRECTIVES],
|
||||
exports: [TaskListCloudModule, ...TASK_FILTERS_CLOUD_DIRECTIVES, TaskHeaderCloudComponent, ...TASK_FORM_CLOUD_DIRECTIVES]
|
||||
|
@ -40,6 +40,7 @@ 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';
|
||||
import { ApolloModule } from 'apollo-angular';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-cloud-edit-task-filter',
|
||||
@ -60,7 +61,8 @@ import { TaskAssignmentFilterCloudComponent } from '../../task-assignment-filter
|
||||
MatCheckboxModule,
|
||||
DateRangeFilterComponent,
|
||||
PeopleCloudComponent,
|
||||
TaskAssignmentFilterCloudComponent
|
||||
TaskAssignmentFilterCloudComponent,
|
||||
ApolloModule
|
||||
],
|
||||
templateUrl: './edit-task-filter-cloud.component.html',
|
||||
styleUrls: ['./edit-task-filter-cloud.component.scss'],
|
||||
|
@ -18,7 +18,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 {
|
||||
AppConfigService,
|
||||
DataRowEvent,
|
||||
ObjectDataRow,
|
||||
User,
|
||||
DataColumn,
|
||||
ColumnsSelectorComponent,
|
||||
DataColumnListComponent,
|
||||
DataColumnComponent,
|
||||
CustomEmptyContentTemplateDirective
|
||||
} from '@alfresco/adf-core';
|
||||
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';
|
||||
@ -35,6 +45,8 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [TaskListCloudComponent, DataColumnListComponent, DataColumnComponent],
|
||||
template: ` <adf-cloud-task-list #taskListCloud>
|
||||
<data-columns>
|
||||
<data-column id="name" key="name" title="ADF_CLOUD_TASK_LIST.PROPERTIES.NAME" class="adf-full-width adf-name-column" [order]="3" />
|
||||
@ -60,7 +72,10 @@ class CustomTaskListComponent {
|
||||
return `${person.firstName} ${person.lastName}`;
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CustomEmptyContentTemplateDirective, TaskListCloudComponent],
|
||||
template: `
|
||||
<adf-cloud-task-list>
|
||||
<adf-custom-empty-content-template>
|
||||
@ -70,7 +85,10 @@ class CustomTaskListComponent {
|
||||
`
|
||||
})
|
||||
class EmptyTemplateComponent {}
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [TaskListCloudComponent, DataColumnListComponent, DataColumnComponent],
|
||||
template: ` <adf-cloud-task-list>
|
||||
<data-columns>
|
||||
<data-column [copyContent]="true" key="id" title="ADF_CLOUD_TASK_LIST.PROPERTIES.ID" />
|
||||
@ -655,8 +673,7 @@ describe('TaskListCloudComponent: Injecting custom colums for tasklist - CustomT
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessServiceCloudTestingModule],
|
||||
declarations: [CustomTaskListComponent, CustomCopyContentTaskListComponent]
|
||||
imports: [ProcessServiceCloudTestingModule, CustomTaskListComponent, CustomCopyContentTaskListComponent]
|
||||
});
|
||||
taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN);
|
||||
spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks));
|
||||
|
7
lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.ts
7
lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.ts
@ -17,12 +17,14 @@
|
||||
|
||||
import { Component, Inject, Input, ViewEncapsulation } from '@angular/core';
|
||||
import {
|
||||
AdfDateFnsAdapter,
|
||||
AppConfigService,
|
||||
ColumnsSelectorComponent,
|
||||
DataTableComponent,
|
||||
EmptyContentComponent,
|
||||
LoadingContentTemplateDirective,
|
||||
MainMenuDataTableTemplateDirective,
|
||||
MOMENT_DATE_FORMATS,
|
||||
NoContentTemplateDirective,
|
||||
UserPreferencesService
|
||||
} from '@alfresco/adf-core';
|
||||
@ -46,6 +48,7 @@ import { ProcessVariableFilterModel } from '../../../../models/process-variable-
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
||||
|
||||
const PRESET_KEY = 'adf-cloud-task-list.presets';
|
||||
|
||||
@ -63,6 +66,10 @@ const PRESET_KEY = 'adf-cloud-task-list.presets';
|
||||
LoadingContentTemplateDirective,
|
||||
DataTableComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: DateAdapter, useClass: AdfDateFnsAdapter },
|
||||
{ provide: MAT_DATE_FORMATS, useValue: MOMENT_DATE_FORMATS }
|
||||
],
|
||||
templateUrl: './task-list-cloud.component.html',
|
||||
styleUrls: ['./task-list-cloud.component.scss'],
|
||||
encapsulation: ViewEncapsulation.None
|
||||
|
@ -24,6 +24,7 @@ import { LocalPreferenceCloudService } from '../../services/local-preference-clo
|
||||
|
||||
export const TASK_LIST_CLOUD_DIRECTIVES = [TaskListCloudComponent, ServiceTaskListCloudComponent] as const;
|
||||
|
||||
/** @deprecated use standalone components or TASK_LIST_CLOUD_DIRECTIVES instead */
|
||||
@NgModule({
|
||||
imports: [...TASK_LIST_CLOUD_DIRECTIVES],
|
||||
exports: [...TASK_LIST_CLOUD_DIRECTIVES],
|
||||
|
@ -1,36 +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 { NoTaskDetailsTemplateDirective } from './no-task-detail-template.directive';
|
||||
import { TaskDetailsComponent } from '../task-details/task-details.component';
|
||||
|
||||
describe('NoTaskDetailsTemplateDirective', () => {
|
||||
let component: NoTaskDetailsTemplateDirective;
|
||||
let detailsComponent: TaskDetailsComponent;
|
||||
|
||||
beforeEach(() => {
|
||||
detailsComponent = new TaskDetailsComponent(null, null, null, null, null);
|
||||
component = new NoTaskDetailsTemplateDirective(detailsComponent);
|
||||
});
|
||||
|
||||
it('should set "no task details" template on task details component', () => {
|
||||
const testTemplate: any = 'test template';
|
||||
component.template = testTemplate;
|
||||
component.ngAfterContentInit();
|
||||
expect(detailsComponent.noTaskDetailsTemplateComponent).toBe(testTemplate);
|
||||
});
|
||||
});
|
@ -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 { AfterContentInit, ContentChild, Directive, TemplateRef } from '@angular/core';
|
||||
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({
|
||||
// eslint-disable-next-line @angular-eslint/directive-selector
|
||||
selector: 'adf-no-task-details-template, no-task-details-template',
|
||||
standalone: true
|
||||
})
|
||||
export class NoTaskDetailsTemplateDirective implements AfterContentInit {
|
||||
@ContentChild(TemplateRef)
|
||||
template: any;
|
||||
|
||||
constructor(private activitiTaskDetails: TaskDetailsComponent) {}
|
||||
|
||||
ngAfterContentInit() {
|
||||
this.activitiTaskDetails.noTaskDetailsTemplateComponent = this.template;
|
||||
}
|
||||
}
|
@ -1,155 +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 { Component } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { TaskListService } from '../../services/tasklist.service';
|
||||
import { ProcessTestingModule } from '../../../testing/process.testing.module';
|
||||
import { TaskAuditDirective } from '@alfresco/adf-process-services';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
describe('TaskAuditDirective', () => {
|
||||
@Component({
|
||||
selector: 'adf-basic-button',
|
||||
standalone: true,
|
||||
imports: [TaskAuditDirective],
|
||||
template: ` <button
|
||||
id="auditButton"
|
||||
adf-task-audit
|
||||
[task-id]="currentTaskId"
|
||||
[download]="download"
|
||||
[fileName]="fileName"
|
||||
[format]="format"
|
||||
(clicked)="onAuditClick($event)"
|
||||
>
|
||||
My button
|
||||
</button>`
|
||||
})
|
||||
class BasicButtonComponent {
|
||||
download: boolean = false;
|
||||
fileName: string;
|
||||
format: string;
|
||||
|
||||
onAuditClick() {}
|
||||
}
|
||||
|
||||
let fixture: ComponentFixture<BasicButtonComponent>;
|
||||
let component: BasicButtonComponent;
|
||||
let service: TaskListService;
|
||||
|
||||
const createFakePdfBlob = (): Blob => {
|
||||
const pdfData = atob(
|
||||
'JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog' +
|
||||
'IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv' +
|
||||
'TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K' +
|
||||
'Pj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAg' +
|
||||
'L1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+' +
|
||||
'PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9u' +
|
||||
'dAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2Jq' +
|
||||
'Cgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJU' +
|
||||
'CjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVu' +
|
||||
'ZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4g' +
|
||||
'CjAwMDAwMDAwNzkgMDAwMDAgbiAKMDAwMDAwMDE3MyAwMDAwMCBuIAowMDAwMDAwMzAxIDAw' +
|
||||
'MDAwIG4gCjAwMDAwMDAzODAgMDAwMDAgbiAKdHJhaWxlcgo8PAogIC9TaXplIDYKICAvUm9v' +
|
||||
'dCAxIDAgUgo+PgpzdGFydHhyZWYKNDkyCiUlRU9G'
|
||||
);
|
||||
return new Blob([pdfData], { type: 'application/pdf' });
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule, BasicButtonComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(BasicButtonComponent);
|
||||
component = fixture.componentInstance;
|
||||
service = TestBed.inject(TaskListService);
|
||||
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jasmine.Ajax.uninstall();
|
||||
});
|
||||
|
||||
it('should fetch the pdf Blob when the format is pdf', fakeAsync(() => {
|
||||
component.fileName = 'FakeAuditName';
|
||||
component.format = 'pdf';
|
||||
const blob = createFakePdfBlob();
|
||||
spyOn(service, 'fetchTaskAuditPdfById').and.returnValue(of(blob));
|
||||
spyOn(component, 'onAuditClick').and.callThrough();
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
const button = fixture.nativeElement.querySelector('#auditButton');
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.onAuditClick).toHaveBeenCalledWith({ format: 'pdf', value: blob, fileName: 'FakeAuditName' });
|
||||
});
|
||||
|
||||
button.click();
|
||||
}));
|
||||
|
||||
it('should fetch the json info when the format is json', fakeAsync(() => {
|
||||
component.fileName = 'FakeAuditName';
|
||||
component.format = 'json';
|
||||
component.download = true;
|
||||
|
||||
const auditJson = {
|
||||
taskId: '77',
|
||||
taskName: 'Fake Task Name',
|
||||
assignee: 'FirstName LastName',
|
||||
formData: [],
|
||||
selectedOutcome: null,
|
||||
comments: []
|
||||
};
|
||||
spyOn(service, 'fetchTaskAuditJsonById').and.returnValue(of(auditJson));
|
||||
spyOn(component, 'onAuditClick').and.callThrough();
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
const button = fixture.nativeElement.querySelector('#auditButton');
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.onAuditClick).toHaveBeenCalledWith({ format: 'json', value: auditJson, fileName: 'FakeAuditName' });
|
||||
});
|
||||
|
||||
button.click();
|
||||
}));
|
||||
|
||||
it('should fetch the pdf Blob as default when the format is UNKNOWN', fakeAsync(() => {
|
||||
component.fileName = 'FakeAuditName';
|
||||
component.format = 'fakeFormat';
|
||||
const blob = createFakePdfBlob();
|
||||
spyOn(service, 'fetchTaskAuditPdfById').and.returnValue(of(blob));
|
||||
spyOn(component, 'onAuditClick').and.callThrough();
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
const button = fixture.nativeElement.querySelector('#auditButton');
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(component.onAuditClick).toHaveBeenCalledWith({ format: 'pdf', value: blob, fileName: 'FakeAuditName' });
|
||||
});
|
||||
|
||||
button.click();
|
||||
}));
|
||||
});
|
@ -1,121 +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 @angular-eslint/no-input-rename */
|
||||
|
||||
import { DownloadService } from '@alfresco/adf-core';
|
||||
import { Directive, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||
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]',
|
||||
standalone: true,
|
||||
host: {
|
||||
role: 'button',
|
||||
'(click)': 'onClickAudit()'
|
||||
}
|
||||
})
|
||||
export class TaskAuditDirective implements OnChanges {
|
||||
/** (**required**) The id of the task. */
|
||||
@Input('task-id')
|
||||
taskId: string;
|
||||
|
||||
/** Name of the downloaded file (for PDF downloads). */
|
||||
@Input()
|
||||
fileName: string = 'Audit';
|
||||
|
||||
/** Format of the audit information. Can be "pdf" or "json". */
|
||||
@Input()
|
||||
format: string = 'pdf';
|
||||
|
||||
/** Enables downloading of the audit when the decorated element is clicked. */
|
||||
@Input()
|
||||
download: boolean = true;
|
||||
|
||||
/** Emitted when the decorated element is clicked. */
|
||||
@Output()
|
||||
clicked: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
/** Emitted when an error occurs. */
|
||||
@Output()
|
||||
error: EventEmitter<any> = new EventEmitter<any>();
|
||||
|
||||
public audit: any;
|
||||
|
||||
constructor(private downloadService: DownloadService, private taskListService: TaskListService) {}
|
||||
|
||||
ngOnChanges(): void {
|
||||
if (!this.isValidType()) {
|
||||
this.setDefaultFormatType();
|
||||
}
|
||||
}
|
||||
|
||||
isValidType(): boolean {
|
||||
return this.format && (this.isJsonFormat() || this.isPdfFormat());
|
||||
}
|
||||
|
||||
setDefaultFormatType(): void {
|
||||
this.format = PDF_FORMAT;
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch the audit information in the requested format
|
||||
*/
|
||||
fetchAuditInfo(): void {
|
||||
if (this.isPdfFormat()) {
|
||||
this.taskListService.fetchTaskAuditPdfById(this.taskId).subscribe(
|
||||
(blob: Blob) => {
|
||||
this.audit = blob;
|
||||
if (this.download) {
|
||||
this.downloadService.downloadBlob(this.audit, this.fileName + '.pdf');
|
||||
}
|
||||
this.clicked.emit({ format: this.format, value: this.audit, fileName: this.fileName });
|
||||
},
|
||||
(err) => {
|
||||
this.error.emit(err);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.taskListService.fetchTaskAuditJsonById(this.taskId).subscribe(
|
||||
(res) => {
|
||||
this.audit = res;
|
||||
this.clicked.emit({ format: this.format, value: this.audit, fileName: this.fileName });
|
||||
},
|
||||
(err) => {
|
||||
this.error.emit(err);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
onClickAudit() {
|
||||
this.fetchAuditInfo();
|
||||
}
|
||||
|
||||
isJsonFormat() {
|
||||
return this.format === JSON_FORMAT;
|
||||
}
|
||||
|
||||
isPdfFormat() {
|
||||
return this.format === PDF_FORMAT;
|
||||
}
|
||||
}
|
@ -20,8 +20,6 @@ import { UnclaimTaskDirective } from './components/task-form/unclaim-task.direct
|
||||
import { TaskFormComponent } from './components/task-form/task-form.component';
|
||||
import { AttachFormComponent } from './components/attach-form/attach-form.component';
|
||||
import { ChecklistComponent } from './components/checklist/checklist.component';
|
||||
import { NoTaskDetailsTemplateDirective } from './components/no-task-details/no-task-detail-template.directive';
|
||||
import { TaskAuditDirective } from './components/task-audit/task-audit.directive';
|
||||
import { TaskFiltersComponent } from './components/task-filters/task-filters.component';
|
||||
import { TaskListComponent } from './components/task-list/task-list.component';
|
||||
import { TaskDetailsComponent } from './components/task-details/task-details.component';
|
||||
@ -32,13 +30,11 @@ import { TaskStandaloneComponent } from './components/task-standalone/task-stand
|
||||
export * from './components/task-list/task-list.component';
|
||||
export * from './components/checklist/checklist.component';
|
||||
export * from './components/task-header/task-header.component';
|
||||
export * from './components/no-task-details/no-task-detail-template.directive';
|
||||
export * from './components/task-filters/task-filters.component';
|
||||
export * from './components/task-form/task-form.component';
|
||||
export * from './components/task-form/claim-task.directive';
|
||||
export * from './components/task-form/unclaim-task.directive';
|
||||
export * from './components/task-details/task-details.component';
|
||||
export * from './components/task-audit/task-audit.directive';
|
||||
export * from './components/start-task/start-task.component';
|
||||
export * from './components/task-standalone/task-standalone.component';
|
||||
export * from './components/attach-form/attach-form.component';
|
||||
@ -64,7 +60,5 @@ export const TASK_LIST_DIRECTIVES = [
|
||||
StartTaskComponent,
|
||||
TaskStandaloneComponent,
|
||||
ClaimTaskDirective,
|
||||
UnclaimTaskDirective,
|
||||
NoTaskDetailsTemplateDirective,
|
||||
TaskAuditDirective
|
||||
UnclaimTaskDirective
|
||||
] as const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user