diff --git a/ng2-components/ng2-activiti-analytics/README.md b/ng2-components/ng2-activiti-analytics/README.md index ac208e5422..ad7db61552 100644 --- a/ng2-components/ng2-activiti-analytics/README.md +++ b/ng2-components/ng2-activiti-analytics/README.md @@ -23,6 +23,31 @@ Also make sure you include these dependencies in your `index.html` file: ``` +#### 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);