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 { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
import { CloudLayoutService } from './services/cloud-layout.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-cloud-layout',
|
selector: 'app-cloud-layout',
|
||||||
@@ -27,13 +28,22 @@ export class CloudLayoutComponent implements OnInit {
|
|||||||
displayMenu = true;
|
displayMenu = true;
|
||||||
applicationName: string;
|
applicationName: string;
|
||||||
|
|
||||||
constructor(private router: Router, private route: ActivatedRoute) {
|
constructor(
|
||||||
}
|
private router: Router,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private cloudLayoutService: CloudLayoutService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.params.subscribe((params) => {
|
this.route.params.subscribe((params) => {
|
||||||
this.applicationName = params.applicationName;
|
this.applicationName = params.applicationName;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.route.queryParams.subscribe((params) => {
|
||||||
|
if (params.id) {
|
||||||
|
this.cloudLayoutService.setCurrentTaskFilterParam({ id: params.id });
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onStartTask() {
|
onStartTask() {
|
||||||
|
@@ -20,12 +20,15 @@ import { TaskListCloudComponent, TaskListCloudSortingModel, TaskFilterCloudModel
|
|||||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { CloudLayoutService } from './services/cloud-layout.service';
|
import { CloudLayoutService } from './services/cloud-layout.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'tasks-cloud-demo.component.html',
|
templateUrl: 'tasks-cloud-demo.component.html',
|
||||||
styleUrls: ['tasks-cloud-demo.component.scss']
|
styleUrls: ['tasks-cloud-demo.component.scss']
|
||||||
})
|
})
|
||||||
export class TasksCloudDemoComponent implements OnInit {
|
export class TasksCloudDemoComponent implements OnInit {
|
||||||
|
|
||||||
|
public static ACTION_SAVE_AS = 'SAVE_AS';
|
||||||
|
|
||||||
@ViewChild('taskCloud')
|
@ViewChild('taskCloud')
|
||||||
taskCloud: TaskListCloudComponent;
|
taskCloud: TaskListCloudComponent;
|
||||||
|
|
||||||
@@ -70,10 +73,13 @@ export class TasksCloudDemoComponent implements OnInit {
|
|||||||
|
|
||||||
onFilterChange(filter: any) {
|
onFilterChange(filter: any) {
|
||||||
this.editedFilter = Object.assign({}, filter);
|
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) {
|
onTaskFilterAction(filterAction: any) {
|
||||||
this.cloudLayoutService.setCurrentTaskFilterParam({id: filter.id});
|
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",
|
"PROCESS_DEF_ID": "ProcessDefinitionId",
|
||||||
"STATUS": "Status",
|
"STATUS": "Status",
|
||||||
"ASSIGNMENT": "Assignment",
|
"ASSIGNMENT": "Assignment",
|
||||||
"COLUMN": "Column",
|
|
||||||
"DIRECTION": "Direction",
|
"DIRECTION": "Direction",
|
||||||
"PROCESS_INSTANCE_ID": "ProcessInstanceId",
|
"PROCESS_INSTANCE_ID": "ProcessInstanceId",
|
||||||
"DUE_BEFORE": "DueBefore",
|
"DUE_BEFORE": "DueBefore",
|
||||||
@@ -114,7 +113,8 @@
|
|||||||
"LAST_MODIFIED_TO": "LastModifiedTo",
|
"LAST_MODIFIED_TO": "LastModifiedTo",
|
||||||
"OWNER": "Owner",
|
"OWNER": "Owner",
|
||||||
"DUE_DATE_TO": "DueDateTo",
|
"DUE_DATE_TO": "DueDateTo",
|
||||||
"DUE_DATE_FROM": "DueDateFrom"
|
"DUE_DATE_FROM": "DueDateFrom",
|
||||||
|
"SORT": "Sort"
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@@ -77,7 +77,7 @@ export class EditTaskFilterCloudComponent implements OnChanges {
|
|||||||
columns = [
|
columns = [
|
||||||
{value: 'id', label: 'ID'},
|
{value: 'id', label: 'ID'},
|
||||||
{value: 'name', label: 'NAME'},
|
{value: 'name', label: 'NAME'},
|
||||||
{value: 'createdDate', label: 'Created Date'},
|
{value: 'createdDate', label: 'CREATED DATE'},
|
||||||
{value: 'priority', label: 'PRIORITY'},
|
{value: 'priority', label: 'PRIORITY'},
|
||||||
{value: 'processDefinitionId', label: 'PROCESS DEFINITION ID'}
|
{value: 'processDefinitionId', label: 'PROCESS DEFINITION ID'}
|
||||||
];
|
];
|
||||||
@@ -215,12 +215,13 @@ export class EditTaskFilterCloudComponent implements OnChanges {
|
|||||||
|
|
||||||
onSave() {
|
onSave() {
|
||||||
this.taskFilterCloudService.updateFilter(this.changedTaskFilter);
|
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() {
|
onDelete() {
|
||||||
this.taskFilterCloudService.deleteFilter(this.taskFilter);
|
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() {
|
onSaveAs() {
|
||||||
@@ -243,7 +244,8 @@ export class EditTaskFilterCloudComponent implements OnChanges {
|
|||||||
};
|
};
|
||||||
const resultFilter = Object.assign({}, this.changedTaskFilter, newFilter);
|
const resultFilter = Object.assign({}, this.changedTaskFilter, newFilter);
|
||||||
this.taskFilterCloudService.addFilter(resultFilter);
|
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 || ''
|
value: currentTaskFilter.processDefinitionId || ''
|
||||||
}),
|
}),
|
||||||
new TaskFilterProperties({
|
new TaskFilterProperties({
|
||||||
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.COLUMN',
|
label: 'ADF_CLOUD_EDIT_TASK_FILTER.LABEL.SORT',
|
||||||
type: 'select',
|
type: 'select',
|
||||||
key: 'sort',
|
key: 'sort',
|
||||||
value: currentTaskFilter.sort || this.columns[0].value,
|
value: currentTaskFilter.sort || this.columns[0].value,
|
||||||
|
@@ -98,7 +98,7 @@ export class FilterParamsModel {
|
|||||||
|
|
||||||
export interface FilterActionType {
|
export interface FilterActionType {
|
||||||
actionType: string;
|
actionType: string;
|
||||||
id: string;
|
filter: TaskFilterCloudModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FilterOptions {
|
export interface FilterOptions {
|
||||||
|
Reference in New Issue
Block a user