Merge pull request #717 from Alfresco/dev-mvitale-673

Add first task selection on filter change
This commit is contained in:
Denys Vuika
2016-09-08 15:08:04 +01:00
committed by GitHub
4 changed files with 54 additions and 2 deletions

View File

@@ -110,6 +110,17 @@ export class ActivitiTaskDetails implements OnInit {
}
}
/**
* Reset the task detail to undefined
*/
reset() {
this.taskDetails = null;
}
/**
* Load the activiti task details
* @param taskId
*/
loadDetails(taskId: string) {
this.taskForm = null;
this.taskPeople = [];
@@ -142,10 +153,13 @@ export class ActivitiTaskDetails implements OnInit {
}
);
} else {
this.taskDetails = null;
this.reset();
}
}
/**
* Complete the activiti task
*/
onComplete() {
this.activitiTaskList.completeTask(this.taskId).subscribe(
(res) => {
@@ -154,14 +168,26 @@ export class ActivitiTaskDetails implements OnInit {
);
}
/**
* Emit the form saved event
* @param data
*/
formSavedEmitter(data: any) {
this.formSaved.emit(data);
}
/**
* Emit the form completed event
* @param data
*/
formCompletedEmitter(data: any) {
this.formCompleted.emit(data);
}
/**
* Emit the form loaded event
* @param data
*/
formLoadedEmitter(data: any) {
this.formLoaded.emit(data);
}

View File

@@ -95,6 +95,7 @@ export class ActivitiTaskList implements OnInit {
this.activiti.getTasks(filterParam).subscribe(
(response) => {
this.renderTasks(response.data);
this.selectFirstTask();
this.onSuccess.emit(response);
}, (error) => {
console.error(error);
@@ -115,6 +116,25 @@ export class ActivitiTaskList implements OnInit {
this.tasks = new ObjectDataTableAdapter(tasks, this.data.getColumns());
}
/**
* Select the first task of a tasklist if present
*/
private selectFirstTask() {
if (!this.isTaskListEmpty()) {
this.currentTaskId = this.tasks.getRows()[0].getValue('id');
} else {
this.currentTaskId = null;
}
}
/**
* Return the current task
* @returns {string}
*/
getCurrentTaskId(): string {
return this.currentTaskId;
}
/**
* Check if the tasks list is empty
* @returns {ObjectDataTableAdapter|boolean}