mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-3866] Fix several bugs in Task List Cloud component (#4181)
* [ADF-3866] Fix several bugs in Task List Cloud component * [ADF-3866] Remove comment and improve logic
This commit is contained in:
committed by
Eugenio Romano
parent
6fffeef5c6
commit
0348b8ed9c
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { CloudLayoutService } from './services/cloud-layout.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cloud-layout',
|
||||
@@ -27,13 +28,22 @@ export class CloudLayoutComponent implements OnInit {
|
||||
displayMenu = true;
|
||||
applicationName: string;
|
||||
|
||||
constructor(private router: Router, private route: ActivatedRoute) {
|
||||
}
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private cloudLayoutService: CloudLayoutService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.params.subscribe((params) => {
|
||||
this.applicationName = params.applicationName;
|
||||
});
|
||||
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
if (params.id) {
|
||||
this.cloudLayoutService.setCurrentTaskFilterParam({ id: params.id });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onStartTask() {
|
||||
|
@@ -20,12 +20,15 @@ import { TaskListCloudComponent, TaskListCloudSortingModel, TaskFilterCloudModel
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { CloudLayoutService } from './services/cloud-layout.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'tasks-cloud-demo.component.html',
|
||||
styleUrls: ['tasks-cloud-demo.component.scss']
|
||||
})
|
||||
export class TasksCloudDemoComponent implements OnInit {
|
||||
|
||||
public static ACTION_SAVE_AS = 'SAVE_AS';
|
||||
|
||||
@ViewChild('taskCloud')
|
||||
taskCloud: TaskListCloudComponent;
|
||||
|
||||
@@ -70,10 +73,13 @@ export class TasksCloudDemoComponent implements OnInit {
|
||||
|
||||
onFilterChange(filter: any) {
|
||||
this.editedFilter = Object.assign({}, filter);
|
||||
this.sortArray = [new TaskListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order})];
|
||||
this.sortArray = [new TaskListCloudSortingModel({ orderBy: this.editedFilter.sort, direction: this.editedFilter.order })];
|
||||
}
|
||||
|
||||
onTaskFilterAction(filter: any) {
|
||||
this.cloudLayoutService.setCurrentTaskFilterParam({id: filter.id});
|
||||
onTaskFilterAction(filterAction: any) {
|
||||
this.cloudLayoutService.setCurrentTaskFilterParam({ id: filterAction.filter.id });
|
||||
if (filterAction.actionType === TasksCloudDemoComponent.ACTION_SAVE_AS) {
|
||||
this.router.navigate([`/cloud/${this.applicationName}/tasks/`], { queryParams: filterAction.filter });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -97,7 +97,6 @@
|
||||
"PROCESS_DEF_ID": "ProcessDefinitionId",
|
||||
"STATUS": "Status",
|
||||
"ASSIGNMENT": "Assignment",
|
||||
"COLUMN": "Column",
|
||||
"DIRECTION": "Direction",
|
||||
"PROCESS_INSTANCE_ID": "ProcessInstanceId",
|
||||
"DUE_BEFORE": "DueBefore",
|
||||
@@ -114,7 +113,8 @@
|
||||
"LAST_MODIFIED_TO": "LastModifiedTo",
|
||||
"OWNER": "Owner",
|
||||
"DUE_DATE_TO": "DueDateTo",
|
||||
"DUE_DATE_FROM": "DueDateFrom"
|
||||
"DUE_DATE_FROM": "DueDateFrom",
|
||||
"SORT": "Sort"
|
||||
|
||||
|
||||
},
|
||||
|
@@ -77,7 +77,7 @@ export class EditTaskFilterCloudComponent implements OnChanges {
|
||||
columns = [
|
||||
{value: 'id', label: 'ID'},
|
||||
{value: 'name', label: 'NAME'},
|
||||
{value: 'createdDate', label: 'Created Date'},
|
||||
{value: 'createdDate', label: 'CREATED DATE'},
|
||||
{value: 'priority', label: 'PRIORITY'},
|
||||
{value: 'processDefinitionId', label: 'PROCESS DEFINITION ID'}
|
||||
];
|
||||
@@ -215,12 +215,13 @@ export class EditTaskFilterCloudComponent implements OnChanges {
|
||||
|
||||
onSave() {
|
||||
this.taskFilterCloudService.updateFilter(this.changedTaskFilter);
|
||||
this.action.emit({actionType: EditTaskFilterCloudComponent.ACTION_SAVE, id: this.changedTaskFilter.id});
|
||||
this.action.emit({actionType: EditTaskFilterCloudComponent.ACTION_SAVE, filter: this.changedTaskFilter});
|
||||
this.formHasBeenChanged = this.compareFilters(this.changedTaskFilter, this.taskFilter);
|
||||
}
|
||||
|
||||
onDelete() {
|
||||
this.taskFilterCloudService.deleteFilter(this.taskFilter);
|
||||
this.action.emit({actionType: EditTaskFilterCloudComponent.ACTION_DELETE, id: this.taskFilter.id});
|
||||
this.action.emit({actionType: EditTaskFilterCloudComponent.ACTION_DELETE, filter: this.taskFilter});
|
||||
}
|
||||
|
||||
onSaveAs() {
|
||||
@@ -243,7 +244,8 @@ export class EditTaskFilterCloudComponent implements OnChanges {
|
||||
};
|
||||
const resultFilter = Object.assign({}, this.changedTaskFilter, newFilter);
|
||||
this.taskFilterCloudService.addFilter(resultFilter);
|
||||
this.action.emit({actionType: EditTaskFilterCloudComponent.ACTION_SAVE_AS, id: resultFilter.id});
|
||||
this.action.emit({actionType: EditTaskFilterCloudComponent.ACTION_SAVE_AS, filter: resultFilter});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -311,7 +313,7 @@ export class EditTaskFilterCloudComponent implements OnChanges {
|
||||
value: currentTaskFilter.processDefinitionId || ''
|
||||
}),
|
||||
new TaskFilterProperties({
|
||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.COLUMN',
|
||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.SORT',
|
||||
type: 'select',
|
||||
key: 'sort',
|
||||
value: currentTaskFilter.sort || this.columns[0].value,
|
||||
|
@@ -98,7 +98,7 @@ export class FilterParamsModel {
|
||||
|
||||
export interface FilterActionType {
|
||||
actionType: string;
|
||||
id: string;
|
||||
filter: TaskFilterCloudModel;
|
||||
}
|
||||
|
||||
export interface FilterOptions {
|
||||
|
Reference in New Issue
Block a user