mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ACA-3643] - add completedBy filter on tasks (#5924)
* [ACA-3643] - add completedBy filter on tasks * send user id as query parameter * preselect users * rebase and reset filter Co-authored-by: Silviu Popa <p3701014@L3700101120.ness.com>
This commit is contained in:
parent
fe61c6dbd1
commit
0119c743ba
@ -11,6 +11,7 @@
|
||||
"STATUS": "Status",
|
||||
"START_DATE": "Start Date",
|
||||
"COMPLETED_DATE": "Completed Date",
|
||||
"COMPLETED_BY": "Completed By",
|
||||
"ID": "Id",
|
||||
"INITIATOR": "Initiator",
|
||||
"APP_NAME": "Application Name",
|
||||
@ -89,7 +90,8 @@
|
||||
"LAST_MODIFIED": "Last Modified",
|
||||
"DUE_DATE": "Due Date",
|
||||
"CREATED": "Created",
|
||||
"JSON_CELL": "Json"
|
||||
"JSON_CELL": "Json",
|
||||
"COMPLETED_BY": "Completed By"
|
||||
},
|
||||
"LIST": {
|
||||
"MESSAGES": {
|
||||
@ -142,7 +144,8 @@
|
||||
"OWNER": "Owner",
|
||||
"DUE_DATE": "DueDate",
|
||||
"SORT": "Sort",
|
||||
"START_DATE": "StartDate"
|
||||
"START_DATE": "StartDate",
|
||||
"COMPLETED_BY": "Completed By"
|
||||
},
|
||||
"DIALOG": {
|
||||
"TITLE": "Save filter as",
|
||||
|
@ -73,6 +73,16 @@
|
||||
[options]="taskFilterProperty.dateFilterOptions"
|
||||
(dateTypeChange)="onDateTypeChange($event, taskFilterProperty)"
|
||||
(dateChanged)="onDateRangeFilterChanged($event, taskFilterProperty)"></adf-cloud-date-range-filter>
|
||||
|
||||
<div fxFlex="23%" class="adf-edit-task-filter-checkbox" *ngIf="isUserSelectType(taskFilterProperty)">
|
||||
<adf-cloud-people
|
||||
[preSelectUsers]="taskFilterProperty.value | async"
|
||||
[title]="taskFilterProperty.label"
|
||||
[validate]="true"
|
||||
[appName]="appName"
|
||||
[mode]="taskFilterProperty.selectionMode"
|
||||
(changedUsers)="onChangedUser($event, taskFilterProperty)"></adf-cloud-people>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -20,14 +20,14 @@ import { AbstractControl, FormGroup, FormBuilder } from '@angular/forms';
|
||||
import { DateAdapter } from '@angular/material/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { debounceTime, filter, takeUntil, finalize, switchMap } from 'rxjs/operators';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
import { Subject, Observable, of } from 'rxjs';
|
||||
import moment from 'moment-es6';
|
||||
import { Moment } from 'moment';
|
||||
|
||||
import { TaskFilterCloudModel, TaskFilterProperties, FilterOptions, TaskFilterAction } from './../models/filter-cloud.model';
|
||||
import { TaskFilterCloudService } from '../services/task-filter-cloud.service';
|
||||
import { TaskFilterDialogCloudComponent } from './task-filter-dialog-cloud.component';
|
||||
import { TranslationService, UserPreferencesService, UserPreferenceValues } from '@alfresco/adf-core';
|
||||
import { TranslationService, UserPreferencesService, UserPreferenceValues, IdentityUserModel, IdentityUserService } from '@alfresco/adf-core';
|
||||
import { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service';
|
||||
import { ApplicationInstanceModel } from '../../../app/models/application-instance.model';
|
||||
import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.model';
|
||||
@ -140,6 +140,7 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
private dateAdapter: DateAdapter<Moment>,
|
||||
private userPreferencesService: UserPreferencesService,
|
||||
private appsProcessCloudService: AppsProcessCloudService,
|
||||
private identityUserService: IdentityUserService,
|
||||
private taskCloudService: TaskCloudService) {
|
||||
}
|
||||
|
||||
@ -352,6 +353,10 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
);
|
||||
}
|
||||
|
||||
onChangedUser(users: IdentityUserModel[], userProperty: TaskFilterProperties) {
|
||||
this.getPropertyController(userProperty).setValue(users[0]?.username);
|
||||
}
|
||||
|
||||
hasError(property: TaskFilterProperties): boolean {
|
||||
return this.getPropertyController(property).errors && this.getPropertyController(property).errors.invalid;
|
||||
}
|
||||
@ -507,6 +512,10 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
return property.type === 'checkbox';
|
||||
}
|
||||
|
||||
isUserSelectType(property: TaskFilterProperties): boolean {
|
||||
return property.type === 'people';
|
||||
}
|
||||
|
||||
isDisabledAction(action: TaskFilterAction): boolean {
|
||||
return this.isDisabledForDefaultFilters(action) ? true : this.hasFormChanged(action);
|
||||
}
|
||||
@ -532,6 +541,13 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
return false;
|
||||
}
|
||||
|
||||
getUserByUsername(username: string): Observable<IdentityUserModel[]> {
|
||||
if (username) {
|
||||
return this.identityUserService.findUserByUsername(username);
|
||||
}
|
||||
return of([]);
|
||||
}
|
||||
|
||||
createFilterActions(): TaskFilterAction[] {
|
||||
return [
|
||||
new TaskFilterAction({
|
||||
@ -690,6 +706,13 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
||||
DateCloudFilterType.NEXT_7_DAYS,
|
||||
DateCloudFilterType.RANGE
|
||||
]
|
||||
}),
|
||||
new TaskFilterProperties({
|
||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.COMPLETED_BY',
|
||||
type: 'people',
|
||||
key: 'completedBy',
|
||||
value: this.getUserByUsername(currentTaskFilter.completedBy),
|
||||
selectionMode: 'single'
|
||||
})
|
||||
];
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
import { DateCloudFilterType } from '../../../models/date-cloud-filter.model';
|
||||
import { DateRangeFilterService } from '../../../common/date-range-filter/date-range-filter.service';
|
||||
import { ComponentSelectionMode } from '../../../types';
|
||||
|
||||
export class TaskFilterCloudModel {
|
||||
id: string;
|
||||
@ -43,6 +44,7 @@ export class TaskFilterCloudModel {
|
||||
standalone: boolean;
|
||||
lastModifiedFrom: Date;
|
||||
lastModifiedTo: Date;
|
||||
completedBy: string;
|
||||
|
||||
private _dueDateFrom: string;
|
||||
private _dueDateTo: string;
|
||||
@ -76,6 +78,7 @@ export class TaskFilterCloudModel {
|
||||
this.standalone = obj.standalone || null;
|
||||
this.lastModifiedFrom = obj.lastModifiedFrom || null;
|
||||
this.lastModifiedTo = obj.lastModifiedTo || null;
|
||||
this.completedBy = obj.completedBy || null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,6 +162,7 @@ export class TaskFilterProperties {
|
||||
attributes?: { [key: string]: string; };
|
||||
options?: FilterOptions[];
|
||||
dateFilterOptions?: DateCloudFilterType[];
|
||||
selectionMode?: ComponentSelectionMode;
|
||||
|
||||
constructor(obj?: any) {
|
||||
if (obj) {
|
||||
@ -169,6 +173,7 @@ export class TaskFilterProperties {
|
||||
this.attributes = obj.attributes || null;
|
||||
this.options = obj.options || null;
|
||||
this.dateFilterOptions = obj.dateFilterOptions || null;
|
||||
this.selectionMode = obj.selectionMode || null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import { TaskFilterDialogCloudComponent } from './components/task-filter-dialog-
|
||||
import { AppListCloudModule } from './../../app/app-list-cloud.module';
|
||||
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
||||
import { ProcessCommonModule } from '../../common/process-common.module';
|
||||
import { PeopleCloudModule } from '../../people/people-cloud.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@ -39,7 +40,8 @@ import { ProcessCommonModule } from '../../common/process-common.module';
|
||||
MaterialModule,
|
||||
AppListCloudModule,
|
||||
CoreModule,
|
||||
ProcessCommonModule
|
||||
ProcessCommonModule,
|
||||
PeopleCloudModule
|
||||
],
|
||||
declarations: [TaskFiltersCloudComponent, EditTaskFilterCloudComponent, TaskFilterDialogCloudComponent],
|
||||
exports: [TaskFiltersCloudComponent, EditTaskFilterCloudComponent],
|
||||
|
@ -114,6 +114,10 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
|
||||
@Input()
|
||||
priority: number;
|
||||
|
||||
/** Filter the tasks. Display only tasks with createdBy equal to the supplied value. */
|
||||
@Input()
|
||||
completedBy: number;
|
||||
|
||||
/** Filter the tasks. Display only the tasks that belong to a process in case is false or tasks that doesn't belong to a process in case of true. */
|
||||
@Input()
|
||||
standalone: boolean = false;
|
||||
@ -365,7 +369,8 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
|
||||
maxItems: this.size,
|
||||
skipCount: this.skipCount,
|
||||
sorting: this.sorting,
|
||||
standalone: this.standalone
|
||||
standalone: this.standalone,
|
||||
completedBy: this.completedBy
|
||||
};
|
||||
return new TaskQueryCloudRequestModel(requestNode);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ export class TaskQueryCloudRequestModel {
|
||||
processDefinitionName?: string;
|
||||
processInstanceId?: string;
|
||||
status?: string;
|
||||
completedBy?: string;
|
||||
maxItems: number;
|
||||
skipCount: number;
|
||||
sorting?: TaskListCloudSortingModel[];
|
||||
@ -66,6 +67,7 @@ export class TaskQueryCloudRequestModel {
|
||||
this.processDefinitionName = obj.processDefinitionName;
|
||||
this.processInstanceId = obj.processInstanceId;
|
||||
this.status = obj.status;
|
||||
this.completedBy = obj.completedBy;
|
||||
this.maxItems = obj.maxItems;
|
||||
this.skipCount = obj.skipCount;
|
||||
this.sorting = obj.sorting;
|
||||
|
Loading…
x
Reference in New Issue
Block a user