From 020952c1744fe95d4a9a4651dd038ab147d9cced Mon Sep 17 00:00:00 2001 From: Vito Date: Thu, 30 Mar 2017 01:16:52 -0700 Subject: [PATCH] =?UTF-8?q?#1517=20-=20ADF-163=20-=20Fixed=20wrong=20behav?= =?UTF-8?q?iour=20when=20task=20is=20created=20on=20the=20s=E2=80=A6=20(#1?= =?UTF-8?q?785)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * #1517 - ADF-163 - Fixed wrong behaviour when task is created on the same selected filter * 1517 - removed consecutives blank lines --- .../activiti/activiti-demo.component.ts | 4 +-- .../components/activiti-filters.component.ts | 2 ++ .../components/activiti-tasklist.component.ts | 25 ++++++++++++++++--- .../src/models/filter.model.ts | 2 ++ 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts index 19d771b45d..0ace4bbb8e 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts @@ -171,9 +171,7 @@ export class ActivitiDemoComponent implements AfterViewInit { onStartTaskSuccess(event: any) { this.activitifilter.selectFilterWithTask(event.id); - this.taskFilter = this.activitifilter.getCurrentFilter(); - this.activititasklist.landingTaskId = event.id; - this.activititasklist.reload(); + this.currentTaskId = event.id; } onSuccessTaskList(event: FilterRepresentationModel) { diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-filters.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-filters.component.ts index f0cf9a2410..daf2fd67d2 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-filters.component.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-filters.component.ts @@ -158,6 +158,8 @@ export class ActivitiFilters implements OnInit, OnChanges { if (filteredFilterList.length > 0) { let myTaskFilter = filteredFilterList.find(filter => filter.name === 'My Tasks'); this.currentFilter = myTaskFilter ? myTaskFilter : filteredFilterList[0]; + this.currentFilter.landingTaskId = taskId; + this.filterClick.emit(this.currentFilter); } }); } diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-tasklist.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-tasklist.component.ts index 2bdf0809e6..d5ba4f34f1 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-tasklist.component.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-tasklist.component.ts @@ -15,9 +15,24 @@ * 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 { 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 { TaskQueryRequestRepresentationModel } from '../models/filter.model'; @@ -124,7 +139,7 @@ export class ActivitiTaskList implements OnChanges, AfterContentInit { let sort = changes['sort']; let name = changes['name']; let assignment = changes['assignment']; - + let landingTaskId = changes['landingTaskId']; if (appId && appId.currentValue) { changed = true; } else if (processDefinitionKey && processDefinitionKey.currentValue) { @@ -137,6 +152,8 @@ export class ActivitiTaskList implements OnChanges, AfterContentInit { changed = true; } else if (assignment && assignment.currentValue) { changed = true; + } else if (landingTaskId && landingTaskId.currentValue) { + changed = true; } return changed; } @@ -196,7 +213,7 @@ export class ActivitiTaskList implements OnChanges, AfterContentInit { if (!this.isListEmpty()) { let rows = this.data.getRows(); 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.currentInstanceId = dataRow.getValue('id'); } diff --git a/ng2-components/ng2-activiti-tasklist/src/models/filter.model.ts b/ng2-components/ng2-activiti-tasklist/src/models/filter.model.ts index fb23c2f2f2..7d56ba2299 100644 --- a/ng2-components/ng2-activiti-tasklist/src/models/filter.model.ts +++ b/ng2-components/ng2-activiti-tasklist/src/models/filter.model.ts @@ -61,6 +61,7 @@ export class FilterRepresentationModel { icon: string; filter: FilterParamRepresentationModel; index: number; + landingTaskId: string; constructor(obj?: any) { this.appId = obj && obj.appId || null; @@ -69,6 +70,7 @@ export class FilterRepresentationModel { this.icon = obj && obj.icon || null; this.filter = new FilterParamRepresentationModel(obj.filter); this.index = obj && obj.index; + this.landingTaskId = obj && obj.landingTaskId; } hasFilter() {