From 5e9cbcdfeb9c844d7bed52f6a3be13e19473193f Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Wed, 27 Jul 2016 09:43:34 +0100 Subject: [PATCH] Use the activiti page instead of task page in the demo shell --- .../activiti/activiti-demo.component.css | 7 ++ .../activiti/activiti-demo.component.html | 46 +++++---- .../activiti/activiti-demo.component.ts | 45 ++++++--- .../tasks/tasks-demo.component.html | 24 ----- .../components/tasks/tasks-demo.component.ts | 99 ------------------- 5 files changed, 66 insertions(+), 155 deletions(-) delete mode 100644 demo-shell-ng2/app/components/tasks/tasks-demo.component.html delete mode 100644 demo-shell-ng2/app/components/tasks/tasks-demo.component.ts diff --git a/demo-shell-ng2/app/components/activiti/activiti-demo.component.css b/demo-shell-ng2/app/components/activiti/activiti-demo.component.css index 0258de8fe1..cd936ed7cb 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.css +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.css @@ -2,3 +2,10 @@ cursor: pointer; font-weight: bold; } + +.task-column { + background-color: #f5f5f5; + padding: 10px 10px 10px 10px; + border-left: solid 2px rgb(31,188,210); + border-right : solid 2px rgb(31,188,210); +} 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 bd44038472..0f48743273 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.html +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.html @@ -1,22 +1,30 @@
- -
-
No tasks found
-
-
    -
  • - - launch - {{task.name || 'Nameless task'}} - -
-
+
+
    +
  • + + + +
  • +
  • + +
  • +
- -
- +
+
- -
+
+ +
+
\ No newline at end of file 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 db6555809b..7bb9451d54 100644 --- a/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts +++ b/demo-shell-ng2/app/components/activiti/activiti-demo.component.ts @@ -16,7 +16,10 @@ */ import { Component, OnInit, AfterViewChecked } from '@angular/core'; -import { ActivitiForm, FormService } from 'ng2-activiti-form'; +import { ALFRESCO_TASKLIST_DIRECTIVES } from 'ng2-activiti-tasklist'; +import { ActivitiForm } from 'ng2-activiti-form'; + +import { ObjectDataTableAdapter, ObjectDataColumn } from 'ng2-alfresco-datatable'; declare let __moduleName: string; @@ -27,22 +30,42 @@ declare var componentHandler; selector: 'activiti-demo', templateUrl: './activiti-demo.component.html', styleUrls: ['./activiti-demo.component.css'], - directives: [ActivitiForm], - providers: [FormService] + directives: [ALFRESCO_TASKLIST_DIRECTIVES, ActivitiForm] }) export class ActivitiDemoComponent implements OnInit, AfterViewChecked { - tasks: any[] = []; - selectedTask: any; + currentChoice: string = 'task-list'; - hasTasks(): boolean { - return this.tasks && this.tasks.length > 0; + currentTaskId: string; + + data: ObjectDataTableAdapter; + constructor() { + this.data = new ObjectDataTableAdapter([], []); } - constructor(private formService: FormService) {} + setChoice($event) { + this.currentChoice = $event.target.value; + } + + isProcessListSelected() { + return this.currentChoice === 'process-list'; + } + + isTaskListSelected() { + return this.currentChoice === 'task-list'; + } ngOnInit() { - this.formService.getTasks().subscribe(val => this.tasks = val || []); + let schema = [ + {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true} + ]; + + let columns = schema.map(col => new ObjectDataColumn(col)); + this.data.setColumns(columns); + } + + onRowClick(taskId) { + this.currentTaskId = taskId; } ngAfterViewChecked() { @@ -52,8 +75,4 @@ export class ActivitiDemoComponent implements OnInit, AfterViewChecked { } } - onTaskClicked(task, e) { - this.selectedTask = task; - } - } diff --git a/demo-shell-ng2/app/components/tasks/tasks-demo.component.html b/demo-shell-ng2/app/components/tasks/tasks-demo.component.html deleted file mode 100644 index 87fa1b0ab7..0000000000 --- a/demo-shell-ng2/app/components/tasks/tasks-demo.component.html +++ /dev/null @@ -1,24 +0,0 @@ -
-
-
    -
  • - - - -
  • -
  • - -
  • -
-
-
- -
-
Task Details
-
\ No newline at end of file diff --git a/demo-shell-ng2/app/components/tasks/tasks-demo.component.ts b/demo-shell-ng2/app/components/tasks/tasks-demo.component.ts deleted file mode 100644 index f5063fd608..0000000000 --- a/demo-shell-ng2/app/components/tasks/tasks-demo.component.ts +++ /dev/null @@ -1,99 +0,0 @@ -/*! - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { Component, OnInit } from '@angular/core'; -import { ALFRESCO_TASKLIST_DIRECTIVES } from 'ng2-activiti-tasklist'; -import { ActivitiForm } from 'ng2-activiti-form'; - -import { ObjectDataTableAdapter, ObjectDataColumn } from 'ng2-alfresco-datatable'; - -@Component({ - selector: 'tasks-demo', - template: ` -
-
-
    -
  • - - - -
  • -
  • - -
  • -
-
-
- -
-
- -
-
- - `, - directives: [ALFRESCO_TASKLIST_DIRECTIVES, ActivitiForm], - styles: [':host > .container { padding: 10px; }'] -}) -export class TasksDemoComponent implements OnInit { - - currentChoice: string = 'task-list'; - - currentTaskId: string; - - data: ObjectDataTableAdapter; - constructor() { - this.data = new ObjectDataTableAdapter([], []); - } - - setChoice($event) { - this.currentChoice = $event.target.value; - } - - isProcessListSelected() { - return this.currentChoice === 'process-list'; - } - - isTaskListSelected() { - return this.currentChoice === 'task-list'; - } - - ngOnInit() { - let schema = [ - {type: 'text', key: 'name', title: 'Name', cssClass: 'full-width name-column', sortable: true} - ]; - - let columns = schema.map(col => new ObjectDataColumn(col)); - this.data.setColumns(columns); - } - - onRowClick(taskId) { - this.currentTaskId = taskId; - } - -}