From 37202780feaa94e10f4dce6062b3aa762cc596ec Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Wed, 21 Sep 2016 14:31:41 +0100 Subject: [PATCH 1/3] Fix filterList is shown twice --- .../src/components/activiti-filters.component.ts | 4 ++-- .../src/components/activiti-filters.component.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ng2-components/ng2-activiti-processlist/src/components/activiti-filters.component.ts b/ng2-components/ng2-activiti-processlist/src/components/activiti-filters.component.ts index 1ab8b8bb26..039c2571b3 100644 --- a/ng2-components/ng2-activiti-processlist/src/components/activiti-filters.component.ts +++ b/ng2-components/ng2-activiti-processlist/src/components/activiti-filters.component.ts @@ -82,7 +82,7 @@ export class ActivitiProcessFilters implements OnInit, OnChanges { ngOnChanges(changes: SimpleChanges) { let appId = changes['appId']; - if (appId && appId.currentValue) { + if (appId && (appId.currentValue || appId.currentValue === null)) { this.load(); return; } @@ -93,7 +93,6 @@ export class ActivitiProcessFilters implements OnInit, OnChanges { * @param tasks */ private load() { - this.resetFilter(); if (this.appName) { this.filterByAppName(); } else { @@ -104,6 +103,7 @@ export class ActivitiProcessFilters implements OnInit, OnChanges { private filterByAppId(appId) { this.activiti.getProcessFilters(appId).subscribe( (res: FilterRepresentationModel[]) => { + this.resetFilter(); res.forEach((filter) => { this.filterObserver.next(filter); }); 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 8d814fb95b..931e205783 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 @@ -82,7 +82,7 @@ export class ActivitiFilters implements OnInit, OnChanges { ngOnChanges(changes: SimpleChanges) { let appId = changes['appId']; - if (appId) { + if (appId && (appId.currentValue || appId.currentValue === null)) { this.load(); return; } @@ -93,7 +93,6 @@ export class ActivitiFilters implements OnInit, OnChanges { * @param tasks */ private load() { - this.resetFilter(); if (this.appName) { this.filterByAppName(); } else { @@ -104,6 +103,7 @@ export class ActivitiFilters implements OnInit, OnChanges { private filterByAppId(appId) { this.activiti.getTaskListFilters(appId).subscribe( (res: FilterRepresentationModel[]) => { + this.resetFilter(); res.forEach((filter) => { this.filterObserver.next(filter); this.selectFirstFilter(); From dda8adbf5f4ad41c441b1d4fcc470487458076b2 Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Wed, 21 Sep 2016 14:32:23 +0100 Subject: [PATCH 2/3] Show the TaskList when an app is select --- .../activiti/activiti-demo.component.html | 22 +++++++-------- .../activiti/activiti-demo.component.ts | 28 +++++++++++++------ 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html index 382a4ec4cf..08cf0aca94 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html @@ -1,20 +1,20 @@
-
-
-
+
+
-
+
@@ -24,7 +24,7 @@
Task List -
@@ -36,7 +36,7 @@
-
+
@@ -61,7 +61,7 @@
-
+
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 08e487dabd..02cb33ae3b 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts @@ -43,8 +43,6 @@ declare var componentHandler; }) export class ActivitiDemoComponent implements AfterViewChecked { - currentChoice: string = 'task-list'; - @ViewChild('activitiapps') activitiapps: ActivitiApps; @@ -66,6 +64,15 @@ export class ActivitiDemoComponent implements AfterViewChecked { @ViewChild('activitiprocessdetails') activitiprocessdetails: any; + @ViewChild('tabmain') + tabMain: any; + + @ViewChild('tabheader') + tabHeader: any; + + @Input() + appId: number; + layoutType: string; currentTaskId: string; currentProcessInstanceId: string; @@ -81,13 +88,6 @@ export class ActivitiDemoComponent implements AfterViewChecked { dataTasks: ObjectDataTableAdapter; dataProcesses: ObjectDataTableAdapter; - @Input() - appId: number; - - setChoice($event) { - this.currentChoice = $event.target.value; - } - isProcessListSelected() { return this.currentChoice === 'process-list'; } @@ -134,6 +134,16 @@ export class ActivitiDemoComponent implements AfterViewChecked { this.processFilter = null; this.currentProcessInstanceId = null; + + this.changeTab('apps','tasks'); + } + + changeTab(origin: string, destination: string) { + this.tabMain.nativeElement.children[origin].classList.remove('is-active'); + this.tabMain.nativeElement.children[destination].classList.add('is-active'); + + this.tabHeader.nativeElement.children[`${origin}-header`].classList.remove('is-active'); + this.tabHeader.nativeElement.children[`${destination}-header`].classList.add('is-active'); } onTaskFilterClick(event: FilterRepresentationModel) { From a040c067e286ab2fa093914d915379257850ec02 Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Wed, 21 Sep 2016 14:32:44 +0100 Subject: [PATCH 3/3] Fix hasForm problem --- .../activiti-task-details.component.html | 6 ++-- .../activiti-task-header.component.html | 4 --- .../activiti-task-header.component.ts | 35 +++---------------- 3 files changed, 7 insertions(+), 38 deletions(-) diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html index cd52a0fe3c..6e91517b49 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-details.component.html @@ -15,13 +15,13 @@
- +
- +
- -
- {{ 'TASK_DETAILS.LABELS.FORM' | translate }}: - {{taskForm?.name ? taskForm.name : ('TASK_DETAILS.FORM.NONE' | translate) }} -
\ No newline at end of file diff --git a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-header.component.ts b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-header.component.ts index 90ff4498d8..043725d4b3 100644 --- a/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-header.component.ts +++ b/ng2-components/ng2-activiti-tasklist/src/components/activiti-task-header.component.ts @@ -15,10 +15,9 @@ * limitations under the License. */ -import { Component, Input, OnInit, OnChanges } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { AlfrescoTranslationService, AlfrescoAuthenticationService } from 'ng2-alfresco-core'; import { TaskDetailsModel } from '../models/task-details.model'; -import { FormModel, FormService } from 'ng2-activiti-form'; declare let componentHandler: any; declare let __moduleName: string; @@ -27,23 +26,19 @@ declare let __moduleName: string; selector: 'activiti-task-header', moduleId: __moduleName, templateUrl: './activiti-task-header.component.html', - styleUrls: ['./activiti-task-header.component.css'], - providers: [ FormService ] + styleUrls: ['./activiti-task-header.component.css'] }) -export class ActivitiTaskHeader implements OnInit, OnChanges { +export class ActivitiTaskHeader implements OnInit { @Input() taskDetails: TaskDetailsModel; - taskForm: FormModel; - /** * Constructor * @param auth * @param translate */ constructor(private auth: AlfrescoAuthenticationService, - private activitiForm: FormService, private translate: AlfrescoTranslationService) { if (translate) { @@ -52,29 +47,7 @@ export class ActivitiTaskHeader implements OnInit, OnChanges { } ngOnInit() { - if (this.taskDetails && this.taskDetails.formKey) { - this.load(this.taskDetails.id); - } + } - ngOnChanges(change) { - if (this.taskDetails && this.taskDetails.formKey) { - this.load(this.taskDetails.id); - } else { - this.taskForm = null; - } - } - - public load(taskId: string) { - if (taskId) { - this.activitiForm.getTaskForm(taskId).subscribe( - (response) => { - this.taskForm = response; - }, - (err) => { - console.error(err); - } - ); - } - } }