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",
|
"STATUS": "Status",
|
||||||
"START_DATE": "Start Date",
|
"START_DATE": "Start Date",
|
||||||
"COMPLETED_DATE": "Completed Date",
|
"COMPLETED_DATE": "Completed Date",
|
||||||
|
"COMPLETED_BY": "Completed By",
|
||||||
"ID": "Id",
|
"ID": "Id",
|
||||||
"INITIATOR": "Initiator",
|
"INITIATOR": "Initiator",
|
||||||
"APP_NAME": "Application Name",
|
"APP_NAME": "Application Name",
|
||||||
@ -89,7 +90,8 @@
|
|||||||
"LAST_MODIFIED": "Last Modified",
|
"LAST_MODIFIED": "Last Modified",
|
||||||
"DUE_DATE": "Due Date",
|
"DUE_DATE": "Due Date",
|
||||||
"CREATED": "Created",
|
"CREATED": "Created",
|
||||||
"JSON_CELL": "Json"
|
"JSON_CELL": "Json",
|
||||||
|
"COMPLETED_BY": "Completed By"
|
||||||
},
|
},
|
||||||
"LIST": {
|
"LIST": {
|
||||||
"MESSAGES": {
|
"MESSAGES": {
|
||||||
@ -142,7 +144,8 @@
|
|||||||
"OWNER": "Owner",
|
"OWNER": "Owner",
|
||||||
"DUE_DATE": "DueDate",
|
"DUE_DATE": "DueDate",
|
||||||
"SORT": "Sort",
|
"SORT": "Sort",
|
||||||
"START_DATE": "StartDate"
|
"START_DATE": "StartDate",
|
||||||
|
"COMPLETED_BY": "Completed By"
|
||||||
},
|
},
|
||||||
"DIALOG": {
|
"DIALOG": {
|
||||||
"TITLE": "Save filter as",
|
"TITLE": "Save filter as",
|
||||||
|
@ -73,6 +73,16 @@
|
|||||||
[options]="taskFilterProperty.dateFilterOptions"
|
[options]="taskFilterProperty.dateFilterOptions"
|
||||||
(dateTypeChange)="onDateTypeChange($event, taskFilterProperty)"
|
(dateTypeChange)="onDateTypeChange($event, taskFilterProperty)"
|
||||||
(dateChanged)="onDateRangeFilterChanged($event, taskFilterProperty)"></adf-cloud-date-range-filter>
|
(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>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -20,14 +20,14 @@ import { AbstractControl, FormGroup, FormBuilder } from '@angular/forms';
|
|||||||
import { DateAdapter } from '@angular/material/core';
|
import { DateAdapter } from '@angular/material/core';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { debounceTime, filter, takeUntil, finalize, switchMap } from 'rxjs/operators';
|
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-es6';
|
||||||
import { Moment } from 'moment';
|
import { Moment } from 'moment';
|
||||||
|
|
||||||
import { TaskFilterCloudModel, TaskFilterProperties, FilterOptions, TaskFilterAction } from './../models/filter-cloud.model';
|
import { TaskFilterCloudModel, TaskFilterProperties, FilterOptions, TaskFilterAction } from './../models/filter-cloud.model';
|
||||||
import { TaskFilterCloudService } from '../services/task-filter-cloud.service';
|
import { TaskFilterCloudService } from '../services/task-filter-cloud.service';
|
||||||
import { TaskFilterDialogCloudComponent } from './task-filter-dialog-cloud.component';
|
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 { AppsProcessCloudService } from '../../../app/services/apps-process-cloud.service';
|
||||||
import { ApplicationInstanceModel } from '../../../app/models/application-instance.model';
|
import { ApplicationInstanceModel } from '../../../app/models/application-instance.model';
|
||||||
import { DateCloudFilterType, DateRangeFilter } from '../../../models/date-cloud-filter.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 dateAdapter: DateAdapter<Moment>,
|
||||||
private userPreferencesService: UserPreferencesService,
|
private userPreferencesService: UserPreferencesService,
|
||||||
private appsProcessCloudService: AppsProcessCloudService,
|
private appsProcessCloudService: AppsProcessCloudService,
|
||||||
|
private identityUserService: IdentityUserService,
|
||||||
private taskCloudService: TaskCloudService) {
|
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 {
|
hasError(property: TaskFilterProperties): boolean {
|
||||||
return this.getPropertyController(property).errors && this.getPropertyController(property).errors.invalid;
|
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';
|
return property.type === 'checkbox';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isUserSelectType(property: TaskFilterProperties): boolean {
|
||||||
|
return property.type === 'people';
|
||||||
|
}
|
||||||
|
|
||||||
isDisabledAction(action: TaskFilterAction): boolean {
|
isDisabledAction(action: TaskFilterAction): boolean {
|
||||||
return this.isDisabledForDefaultFilters(action) ? true : this.hasFormChanged(action);
|
return this.isDisabledForDefaultFilters(action) ? true : this.hasFormChanged(action);
|
||||||
}
|
}
|
||||||
@ -532,6 +541,13 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getUserByUsername(username: string): Observable<IdentityUserModel[]> {
|
||||||
|
if (username) {
|
||||||
|
return this.identityUserService.findUserByUsername(username);
|
||||||
|
}
|
||||||
|
return of([]);
|
||||||
|
}
|
||||||
|
|
||||||
createFilterActions(): TaskFilterAction[] {
|
createFilterActions(): TaskFilterAction[] {
|
||||||
return [
|
return [
|
||||||
new TaskFilterAction({
|
new TaskFilterAction({
|
||||||
@ -690,6 +706,13 @@ export class EditTaskFilterCloudComponent implements OnInit, OnChanges, OnDestro
|
|||||||
DateCloudFilterType.NEXT_7_DAYS,
|
DateCloudFilterType.NEXT_7_DAYS,
|
||||||
DateCloudFilterType.RANGE
|
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 { DateCloudFilterType } from '../../../models/date-cloud-filter.model';
|
||||||
import { DateRangeFilterService } from '../../../common/date-range-filter/date-range-filter.service';
|
import { DateRangeFilterService } from '../../../common/date-range-filter/date-range-filter.service';
|
||||||
|
import { ComponentSelectionMode } from '../../../types';
|
||||||
|
|
||||||
export class TaskFilterCloudModel {
|
export class TaskFilterCloudModel {
|
||||||
id: string;
|
id: string;
|
||||||
@ -43,6 +44,7 @@ export class TaskFilterCloudModel {
|
|||||||
standalone: boolean;
|
standalone: boolean;
|
||||||
lastModifiedFrom: Date;
|
lastModifiedFrom: Date;
|
||||||
lastModifiedTo: Date;
|
lastModifiedTo: Date;
|
||||||
|
completedBy: string;
|
||||||
|
|
||||||
private _dueDateFrom: string;
|
private _dueDateFrom: string;
|
||||||
private _dueDateTo: string;
|
private _dueDateTo: string;
|
||||||
@ -76,6 +78,7 @@ export class TaskFilterCloudModel {
|
|||||||
this.standalone = obj.standalone || null;
|
this.standalone = obj.standalone || null;
|
||||||
this.lastModifiedFrom = obj.lastModifiedFrom || null;
|
this.lastModifiedFrom = obj.lastModifiedFrom || null;
|
||||||
this.lastModifiedTo = obj.lastModifiedTo || null;
|
this.lastModifiedTo = obj.lastModifiedTo || null;
|
||||||
|
this.completedBy = obj.completedBy || null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,6 +162,7 @@ export class TaskFilterProperties {
|
|||||||
attributes?: { [key: string]: string; };
|
attributes?: { [key: string]: string; };
|
||||||
options?: FilterOptions[];
|
options?: FilterOptions[];
|
||||||
dateFilterOptions?: DateCloudFilterType[];
|
dateFilterOptions?: DateCloudFilterType[];
|
||||||
|
selectionMode?: ComponentSelectionMode;
|
||||||
|
|
||||||
constructor(obj?: any) {
|
constructor(obj?: any) {
|
||||||
if (obj) {
|
if (obj) {
|
||||||
@ -169,6 +173,7 @@ export class TaskFilterProperties {
|
|||||||
this.attributes = obj.attributes || null;
|
this.attributes = obj.attributes || null;
|
||||||
this.options = obj.options || null;
|
this.options = obj.options || null;
|
||||||
this.dateFilterOptions = obj.dateFilterOptions || 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 { AppListCloudModule } from './../../app/app-list-cloud.module';
|
||||||
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';
|
||||||
import { ProcessCommonModule } from '../../common/process-common.module';
|
import { ProcessCommonModule } from '../../common/process-common.module';
|
||||||
|
import { PeopleCloudModule } from '../../people/people-cloud.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
@ -39,7 +40,8 @@ import { ProcessCommonModule } from '../../common/process-common.module';
|
|||||||
MaterialModule,
|
MaterialModule,
|
||||||
AppListCloudModule,
|
AppListCloudModule,
|
||||||
CoreModule,
|
CoreModule,
|
||||||
ProcessCommonModule
|
ProcessCommonModule,
|
||||||
|
PeopleCloudModule
|
||||||
],
|
],
|
||||||
declarations: [TaskFiltersCloudComponent, EditTaskFilterCloudComponent, TaskFilterDialogCloudComponent],
|
declarations: [TaskFiltersCloudComponent, EditTaskFilterCloudComponent, TaskFilterDialogCloudComponent],
|
||||||
exports: [TaskFiltersCloudComponent, EditTaskFilterCloudComponent],
|
exports: [TaskFiltersCloudComponent, EditTaskFilterCloudComponent],
|
||||||
|
@ -114,6 +114,10 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
|
|||||||
@Input()
|
@Input()
|
||||||
priority: number;
|
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. */
|
/** 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()
|
@Input()
|
||||||
standalone: boolean = false;
|
standalone: boolean = false;
|
||||||
@ -365,7 +369,8 @@ export class TaskListCloudComponent extends DataTableSchema implements OnChanges
|
|||||||
maxItems: this.size,
|
maxItems: this.size,
|
||||||
skipCount: this.skipCount,
|
skipCount: this.skipCount,
|
||||||
sorting: this.sorting,
|
sorting: this.sorting,
|
||||||
standalone: this.standalone
|
standalone: this.standalone,
|
||||||
|
completedBy: this.completedBy
|
||||||
};
|
};
|
||||||
return new TaskQueryCloudRequestModel(requestNode);
|
return new TaskQueryCloudRequestModel(requestNode);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ export class TaskQueryCloudRequestModel {
|
|||||||
processDefinitionName?: string;
|
processDefinitionName?: string;
|
||||||
processInstanceId?: string;
|
processInstanceId?: string;
|
||||||
status?: string;
|
status?: string;
|
||||||
|
completedBy?: string;
|
||||||
maxItems: number;
|
maxItems: number;
|
||||||
skipCount: number;
|
skipCount: number;
|
||||||
sorting?: TaskListCloudSortingModel[];
|
sorting?: TaskListCloudSortingModel[];
|
||||||
@ -66,6 +67,7 @@ export class TaskQueryCloudRequestModel {
|
|||||||
this.processDefinitionName = obj.processDefinitionName;
|
this.processDefinitionName = obj.processDefinitionName;
|
||||||
this.processInstanceId = obj.processInstanceId;
|
this.processInstanceId = obj.processInstanceId;
|
||||||
this.status = obj.status;
|
this.status = obj.status;
|
||||||
|
this.completedBy = obj.completedBy;
|
||||||
this.maxItems = obj.maxItems;
|
this.maxItems = obj.maxItems;
|
||||||
this.skipCount = obj.skipCount;
|
this.skipCount = obj.skipCount;
|
||||||
this.sorting = obj.sorting;
|
this.sorting = obj.sorting;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user