Skip to content

Commit

Permalink
[AAE-9186] Filter tasks by assignee (#7784)
Browse files Browse the repository at this point in the history
* [AAE-9186] Filter tasks by assignee

* add status filter enum

* remove useless case

* remove useless unit test

* improve task assignment filter unit tests

* remove useless imports

* rebase

* fix lint

* run the copydist only for affected

* Build always cli and testing to use local

* Add back test and cli

Co-authored-by: Maurizio Vitale <maurizio.vitale@alfresco.com>
  • Loading branch information
tomgny and mauriziovitale authored Aug 26, 2022
1 parent 2ef40b1 commit c7d7695
Show file tree
Hide file tree
Showing 17 changed files with 598 additions and 322 deletions.
32 changes: 31 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
"tsConfig": "lib/core/tsconfig.lib.json",
"project": "lib/core/ng-package.json"
},
"dependsOn": ["license", "^build"],
"dependsOn": ["^build", "license"],
"configurations": {
"production": {
"project": "lib/core/ng-package.json",
Expand Down Expand Up @@ -412,6 +412,16 @@
}
]
}
},
"pretheme": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "$(npm bin)/webpack -- --config ./lib/config/webpack.style.js --progress --profile --bail && rm ./dist/libs/core/lib/prebuilt-themes/*.js"
}
]
}
}
}
},
Expand Down Expand Up @@ -833,6 +843,16 @@
"lib/testing/**/*.html"
]
}
},
"copydist": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "rm -rf ./node_modules/@alfresco/adf-testing/ && mkdir -p ./node_modules/@alfresco/adf-testing/ && cp -R ./dist/libs/testing/* ./node_modules/@alfresco/adf-testing/"
}
]
}
}
}
},
Expand Down Expand Up @@ -863,6 +883,16 @@
"lib/cli/**/*.html"
]
}
},
"copydist": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "cp -R ./lib/cli/dist dist/libs/cli/ && rm -rf ./node_modules/@alfresco/adf-cli/ && mkdir -p ./node_modules/@alfresco/adf-cli/ && cp -R ./dist/libs/cli/* ./node_modules/@alfresco/adf-cli/"
}
]
}
}
}
},
Expand Down
4 changes: 3 additions & 1 deletion lib/process-services-cloud/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,11 @@
"ADF_CLOUD_FORM_COMPONENT": {
"RETRIEVE_METADATA": "Autofill Form"
},
"ADF_CLOUD_TASK_ASSIGNEMNT_FILTER": {
"ADF_CLOUD_TASK_ASSIGNMENT_FILTER": {
"ASSIGNED_TO": "Assigned to",
"ASSIGNED_TO_ME": "Assigned to me",
"UNASSIGNED": "Unassigned",
"NONE": "None",
"LIST_OF_CANDIDATE_GROUPS": "List of candidate groups",
"ASSIGNEE": "Assignee",
"ASSIGNMENT_TYPE": "Assignment type"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@
</mat-expansion-panel-header>
<ng-container *ngIf="!isLoading;">
<form *ngIf="editTaskFilterForm" [formGroup]="editTaskFilterForm">
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="10px" fxLayoutAlign="start center">
<div fxLayout="row wrap" fxLayout.xs="column" fxLayoutGap="10px" fxLayoutAlign="start">
<ng-container *ngFor="let taskFilterProperty of taskFilterProperties">
<mat-form-field fxFlex="23%"
[floatLabel]="'auto'"
*ngIf="taskFilterProperty.type === 'select'"
[attr.data-automation-id]="taskFilterProperty.key">
<mat-select placeholder="{{taskFilterProperty.label | translate}}"
[formControlName]="taskFilterProperty.key"
[attr.data-automation-id]="'adf-cloud-edit-task-property-' + taskFilterProperty.key">
[attr.data-automation-id]="'adf-cloud-edit-task-property-' + taskFilterProperty.key"
(selectionChange)="onStatusChange($event)">
<mat-option *ngFor="let propertyOption of taskFilterProperty.options"
[value]="propertyOption.value"
[attr.data-automation-id]="'adf-cloud-edit-task-property-options-' + taskFilterProperty.key">
Expand Down Expand Up @@ -109,9 +110,13 @@
<adf-cloud-task-assignment-filter fxFlex="23%"
*ngIf="taskFilterProperty.type === 'assignment'"
[taskFilterProperty]="taskFilterProperty"
(assignedChange)="onAssignedChange($event)"
(assignedGroupChange)="onAssignedGroupsChange($event)">
[status]="selectedStatus"
[appName]="appName"
(assignedUsersChange)="onAssignedUsersChange($event)"
(assignedGroupsChange)="onAssignedGroupsChange($event)"
(assignmentTypeChange)="onAssignmentTypeChange($event)">
</adf-cloud-task-assignment-filter>

</ng-container>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { OnChanges, SimpleChanges, OnInit, OnDestroy, Directive, Input, Output, EventEmitter } from '@angular/core';
import { FilterOptions, TaskFilterAction, TaskFilterProperties } from '../../models/filter-cloud.model';
import { AssignmentType, FilterOptions, TaskFilterAction, TaskFilterProperties, TaskStatusFilter } from '../../models/filter-cloud.model';
import { TaskCloudService } from './../../../services/task-cloud.service';
import { AppsProcessCloudService } from './../../../../app/services/apps-process-cloud.service';
import { DateCloudFilterType, DateRangeFilter } from '../../../../models/date-cloud-filter.model';
Expand All @@ -30,6 +30,7 @@ import { TaskFilterDialogCloudComponent } from '../task-filter-dialog/task-filte
import { MatDialog } from '@angular/material/dialog';
import { IdentityUserModel } from '../../../../people/models/identity-user.model';
import { IdentityGroupModel } from '../../../../group/models/identity-group.model';
import { MatSelectChange } from '@angular/material/select';

/* eslint-disable @typescript-eslint/naming-convention */

Expand Down Expand Up @@ -106,6 +107,7 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
taskFilterProperties: TaskFilterProperties[] = [];
taskFilterActions: TaskFilterAction[] = [];
toggleFilterActions: boolean = false;
selectedStatus: TaskStatusFilter;
sortDirections: DropdownOption[] = [
{ value: 'ASC', label: 'ADF_CLOUD_TASK_FILTERS.DIRECTION.ASCENDING' },
{ value: 'DESC', label: 'ADF_CLOUD_TASK_FILTERS.DIRECTION.DESCENDING' }
Expand Down Expand Up @@ -305,16 +307,49 @@ export abstract class BaseEditTaskFilterCloudComponent<T> implements OnInit, OnC
this.getPropertyController(userProperty).setValue(selectedUsers);
}

onAssignedChange(assignedValue: IdentityUserModel) {
this.editTaskFilterForm.get('candidateGroups').setValue([]);
this.editTaskFilterForm.get('assignee').setValue(assignedValue?.username);
onAssignedUsersChange(assignedUsers: IdentityUserModel[]) {
this.editTaskFilterForm.get('candidateGroups').setValue(undefined);
this.editTaskFilterForm.get('assignedUsers').setValue(assignedUsers);
}

onAssignedGroupsChange(groups: IdentityGroupModel[]) {
this.editTaskFilterForm.get('assignee').setValue(null);
this.editTaskFilterForm.get('assignedUsers').setValue(undefined);
this.editTaskFilterForm.get('candidateGroups').setValue(groups);
}

onAssignmentTypeChange(assignmentType: AssignmentType) {
switch (assignmentType) {
case AssignmentType.UNASSIGNED:
this.editTaskFilterForm.get('status').setValue(TaskStatusFilter.CREATED);
this.resetAssignmentTypeValues();
break;
case AssignmentType.NONE:
this.editTaskFilterForm.get('status').setValue(TaskStatusFilter.ALL);
this.resetAssignmentTypeValues();
break;
case AssignmentType.ASSIGNED_TO:
case AssignmentType.CANDIDATE_GROUPS:
this.editTaskFilterForm.get('status').setValue(TaskStatusFilter.ASSIGNED);
this.resetAssignmentTypeValues();
break;
default:
this.editTaskFilterForm.get('status').setValue(TaskStatusFilter.ASSIGNED);
}
}

onStatusChange(status: MatSelectChange) {
if (status.value === TaskStatusFilter.CREATED) {
this.resetAssignmentTypeValues();
}

this.selectedStatus = status.value;
}

private resetAssignmentTypeValues() {
this.editTaskFilterForm.get('assignedUsers').setValue(undefined);
this.editTaskFilterForm.get('candidateGroups').setValue(undefined);
}

hasError(property: TaskFilterProperties): boolean {
const controller = this.getPropertyController(property);
return controller.errors && controller.errors.invalid;
Expand Down
Loading

0 comments on commit c7d7695

Please sign in to comment.