From d4d555911aa2e1ce9498bb150ec329ecf7b5a861 Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Wed, 2 Nov 2016 17:32:44 +0000 Subject: [PATCH 1/2] Fix Analytics demo --- .../ng2-activiti-analytics/demo/index.html | 10 +- .../ng2-activiti-analytics/demo/package.json | 93 ++++++++---------- .../ng2-activiti-analytics/demo/src/main.ts | 50 ++++++++-- .../demo/systemjs.config.js | 98 +++++++++---------- .../ng2-activiti-analytics/demo/tslint.json | 2 +- .../ng2-activiti-analytics/package.json | 1 + 6 files changed, 138 insertions(+), 116 deletions(-) diff --git a/ng2-components/ng2-activiti-analytics/demo/index.html b/ng2-components/ng2-activiti-analytics/demo/index.html index 833362c08e..8d5e80fe31 100644 --- a/ng2-components/ng2-activiti-analytics/demo/index.html +++ b/ng2-components/ng2-activiti-analytics/demo/index.html @@ -2,13 +2,15 @@ - Angular 2 Activiti Analitics - Demo + + Alfresco Angular 2 Activiti Analytics - Demo + @@ -18,7 +20,13 @@ + + + + + + ``` +#### Moment + +```sh +npm install moment --save +``` + +Also make sure you include these dependencies in your `index.html` file: + +```html + +``` + + +#### Material Design Date picker + +```sh +npm install md-date-time-picker --save +``` + +Also make sure you include these dependencies in your `index.html` file: + +```html + +``` + #### Material Design Lite The style of this component is based on [material design](https://getmdl.io/), so if you want to visualize it correctly you have to add the material @@ -41,17 +66,34 @@ Also make sure you include these dependencies in your `index.html` file: ``` -## Basic usage example Activiti Analytics - +## Basic usage example Activiti Analytics List +The component shows the list of all the available reports ```html - + ``` #### Events - +**onSuccess**: The event is emitted when the report list are loaded
+**onError**: The event is emitted when an error occur during the loading
+**reportClick**: The event is emitted when the report in the list is selected
#### Options +No options. +## Basic usage example Activiti Analytics +The component shows the charts related to the reportId passed as input +```html + +``` + +#### Events +**onSuccess**: The event is emitted when the report parameters are loaded
+**onError**: The event is emitted when an error occur during the loading
+ +#### Options +**appId**: The application id
+**reportId**: The report id
+**debug**: Flag to enable or disable the Form values in the console log
## Build from sources diff --git a/ng2-components/ng2-activiti-analytics/src/components/analytics.component.spec.ts b/ng2-components/ng2-activiti-analytics/src/components/analytics.component.spec.ts index d5fb553eec..a0a0211630 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/analytics.component.spec.ts +++ b/ng2-components/ng2-activiti-analytics/src/components/analytics.component.spec.ts @@ -94,7 +94,7 @@ describe('Test ng2-activiti-analytics Report ', () => { }); it('Should render the Process definition overview report ', (done) => { - component.onShowReport.subscribe((res) => { + component.onSuccess.subscribe((res) => { expect(res).toBeDefined(); expect(res.length).toEqual(3); @@ -133,7 +133,7 @@ describe('Test ng2-activiti-analytics Report ', () => { }); it('Should render the Task overview report ', (done) => { - component.onShowReport.subscribe((res) => { + component.onSuccess.subscribe((res) => { expect(res).toBeDefined(); expect(res.length).toEqual(2); diff --git a/ng2-components/ng2-activiti-analytics/src/components/analytics.component.ts b/ng2-components/ng2-activiti-analytics/src/components/analytics.component.ts index b1ba8da484..f3b77f8330 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/analytics.component.ts +++ b/ng2-components/ng2-activiti-analytics/src/components/analytics.component.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { Component, EventEmitter, OnInit, OnChanges, Input, Output, SimpleChanges } from '@angular/core'; +import { Component, EventEmitter, OnChanges, Input, Output, SimpleChanges } from '@angular/core'; import { AlfrescoTranslationService } from 'ng2-alfresco-core'; import { AnalyticsService } from '../services/analytics.service'; import { ReportQuery } from '../models/report.model'; @@ -27,7 +27,7 @@ import { Chart } from '../models/chart.model'; templateUrl: './analytics.component.html', styleUrls: ['./analytics.component.css'] }) -export class AnalyticsComponent implements OnInit, OnChanges { +export class AnalyticsComponent implements OnChanges { @Input() appId: string; @@ -41,9 +41,6 @@ export class AnalyticsComponent implements OnInit, OnChanges { @Output() onSuccess = new EventEmitter(); - @Output() - onShowReport = new EventEmitter(); - @Output() onError = new EventEmitter(); @@ -59,9 +56,6 @@ export class AnalyticsComponent implements OnInit, OnChanges { } } - ngOnInit() { - } - ngOnChanges(changes: SimpleChanges) { this.reset(); } @@ -71,7 +65,7 @@ export class AnalyticsComponent implements OnInit, OnChanges { this.analyticsService.getReportsByParams(this.reportId, this.reportParamQuery).subscribe( (res: Chart[]) => { this.reports = res; - this.onShowReport.emit(res); + this.onSuccess.emit(res); }, (err: any) => { this.onError.emit(err);