#1517 - ADF-163 - Fixed wrong behaviour when task is created on the s… (#1785)

* #1517 - ADF-163 - Fixed wrong behaviour when task is created on the same selected filter

* 1517 - removed consecutives blank lines
This commit is contained in:
Vito
2017-03-30 01:16:52 -07:00
committed by Mario Romano
parent 0b099eff44
commit 020952c174
4 changed files with 26 additions and 7 deletions

View File

@@ -171,9 +171,7 @@ export class ActivitiDemoComponent implements AfterViewInit {
onStartTaskSuccess(event: any) { onStartTaskSuccess(event: any) {
this.activitifilter.selectFilterWithTask(event.id); this.activitifilter.selectFilterWithTask(event.id);
this.taskFilter = this.activitifilter.getCurrentFilter(); this.currentTaskId = event.id;
this.activititasklist.landingTaskId = event.id;
this.activititasklist.reload();
} }
onSuccessTaskList(event: FilterRepresentationModel) { onSuccessTaskList(event: FilterRepresentationModel) {

View File

@@ -158,6 +158,8 @@ export class ActivitiFilters implements OnInit, OnChanges {
if (filteredFilterList.length > 0) { if (filteredFilterList.length > 0) {
let myTaskFilter = filteredFilterList.find(filter => filter.name === 'My Tasks'); let myTaskFilter = filteredFilterList.find(filter => filter.name === 'My Tasks');
this.currentFilter = myTaskFilter ? myTaskFilter : filteredFilterList[0]; this.currentFilter = myTaskFilter ? myTaskFilter : filteredFilterList[0];
this.currentFilter.landingTaskId = taskId;
this.filterClick.emit(this.currentFilter);
} }
}); });
} }

View File

@@ -15,9 +15,24 @@
* limitations under the License. * limitations under the License.
*/ */
import { Component, Input, Output, ContentChild, AfterContentInit, EventEmitter, OnChanges, SimpleChanges } from '@angular/core'; import {
Component,
Input,
Output,
ContentChild,
AfterContentInit,
EventEmitter,
OnChanges,
SimpleChanges
} from '@angular/core';
import { AlfrescoTranslationService, LogService, DataColumnListComponent } from 'ng2-alfresco-core'; import { AlfrescoTranslationService, LogService, DataColumnListComponent } from 'ng2-alfresco-core';
import { ObjectDataTableAdapter, DataTableAdapter, DataRowEvent, ObjectDataRow, DataColumn } from 'ng2-alfresco-datatable'; import {
ObjectDataTableAdapter,
DataTableAdapter,
DataRowEvent,
ObjectDataRow,
DataColumn
} from 'ng2-alfresco-datatable';
import { ActivitiTaskListService } from './../services/activiti-tasklist.service'; import { ActivitiTaskListService } from './../services/activiti-tasklist.service';
import { TaskQueryRequestRepresentationModel } from '../models/filter.model'; import { TaskQueryRequestRepresentationModel } from '../models/filter.model';
@@ -124,7 +139,7 @@ export class ActivitiTaskList implements OnChanges, AfterContentInit {
let sort = changes['sort']; let sort = changes['sort'];
let name = changes['name']; let name = changes['name'];
let assignment = changes['assignment']; let assignment = changes['assignment'];
let landingTaskId = changes['landingTaskId'];
if (appId && appId.currentValue) { if (appId && appId.currentValue) {
changed = true; changed = true;
} else if (processDefinitionKey && processDefinitionKey.currentValue) { } else if (processDefinitionKey && processDefinitionKey.currentValue) {
@@ -137,6 +152,8 @@ export class ActivitiTaskList implements OnChanges, AfterContentInit {
changed = true; changed = true;
} else if (assignment && assignment.currentValue) { } else if (assignment && assignment.currentValue) {
changed = true; changed = true;
} else if (landingTaskId && landingTaskId.currentValue) {
changed = true;
} }
return changed; return changed;
} }
@@ -196,7 +213,7 @@ export class ActivitiTaskList implements OnChanges, AfterContentInit {
if (!this.isListEmpty()) { if (!this.isListEmpty()) {
let rows = this.data.getRows(); let rows = this.data.getRows();
if (rows.length > 0) { if (rows.length > 0) {
let dataRow = rows.find(row => row.getValue('id') === taskIdToSelect) || rows[0]; let dataRow = rows.find(row => row.getValue('id') === taskIdToSelect) || rows[0];
this.data.selectedRow = dataRow; this.data.selectedRow = dataRow;
this.currentInstanceId = dataRow.getValue('id'); this.currentInstanceId = dataRow.getValue('id');
} }

View File

@@ -61,6 +61,7 @@ export class FilterRepresentationModel {
icon: string; icon: string;
filter: FilterParamRepresentationModel; filter: FilterParamRepresentationModel;
index: number; index: number;
landingTaskId: string;
constructor(obj?: any) { constructor(obj?: any) {
this.appId = obj && obj.appId || null; this.appId = obj && obj.appId || null;
@@ -69,6 +70,7 @@ export class FilterRepresentationModel {
this.icon = obj && obj.icon || null; this.icon = obj && obj.icon || null;
this.filter = new FilterParamRepresentationModel(obj.filter); this.filter = new FilterParamRepresentationModel(obj.filter);
this.index = obj && obj.index; this.index = obj && obj.index;
this.landingTaskId = obj && obj.landingTaskId;
} }
hasFilter() { hasFilter() {