Add basic Analytics documentation #951

This commit is contained in:
mauriziovitale84 2016-11-03 10:41:39 +00:00
parent d4d555911a
commit 29cf46212f
3 changed files with 51 additions and 15 deletions

View File

@ -23,6 +23,31 @@ Also make sure you include these dependencies in your `index.html` file:
<script src="node_modules/chart.js/dist/Chart.bundle.min.js"></script> <script src="node_modules/chart.js/dist/Chart.bundle.min.js"></script>
``` ```
#### Moment
```sh
npm install moment --save
```
Also make sure you include these dependencies in your `index.html` file:
```html
<script src="node_modules/moment/min/moment.min.js"></script>
```
#### 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
<script src="node_modules/md-date-time-picker/dist/js/mdDateTimePicker.min.js"></script>
```
#### Material Design Lite #### 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 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:
<link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css"> <link rel="stylesheet" href="node_modules/material-design-icons/iconfont/material-icons.css">
``` ```
## Basic usage example Activiti Analytics ## Basic usage example Activiti Analytics List
The component shows the list of all the available reports
```html ```html
<activiti-analytics></activiti-analytics> <analytics-report-list></analytics-report-list>
``` ```
#### Events #### Events
**onSuccess**: The event is emitted when the report list are loaded<br />
**onError**: The event is emitted when an error occur during the loading<br />
**reportClick**: The event is emitted when the report in the list is selected<br />
#### Options #### Options
No options.
## Basic usage example Activiti Analytics
The component shows the charts related to the reportId passed as input
```html
<activiti-analytics [appId]="appId" [reportId]="reportId"></activiti-analytics>
```
#### Events
**onSuccess**: The event is emitted when the report parameters are loaded<br />
**onError**: The event is emitted when an error occur during the loading<br />
#### Options
**appId**: The application id<br />
**reportId**: The report id<br />
**debug**: Flag to enable or disable the Form values in the console log<br />
## Build from sources ## Build from sources

View File

@ -94,7 +94,7 @@ describe('Test ng2-activiti-analytics Report ', () => {
}); });
it('Should render the Process definition overview report ', (done) => { it('Should render the Process definition overview report ', (done) => {
component.onShowReport.subscribe((res) => { component.onSuccess.subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(res.length).toEqual(3); expect(res.length).toEqual(3);
@ -133,7 +133,7 @@ describe('Test ng2-activiti-analytics Report ', () => {
}); });
it('Should render the Task overview report ', (done) => { it('Should render the Task overview report ', (done) => {
component.onShowReport.subscribe((res) => { component.onSuccess.subscribe((res) => {
expect(res).toBeDefined(); expect(res).toBeDefined();
expect(res.length).toEqual(2); expect(res.length).toEqual(2);

View File

@ -15,7 +15,7 @@
* limitations under the License. * 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 { AlfrescoTranslationService } from 'ng2-alfresco-core';
import { AnalyticsService } from '../services/analytics.service'; import { AnalyticsService } from '../services/analytics.service';
import { ReportQuery } from '../models/report.model'; import { ReportQuery } from '../models/report.model';
@ -27,7 +27,7 @@ import { Chart } from '../models/chart.model';
templateUrl: './analytics.component.html', templateUrl: './analytics.component.html',
styleUrls: ['./analytics.component.css'] styleUrls: ['./analytics.component.css']
}) })
export class AnalyticsComponent implements OnInit, OnChanges { export class AnalyticsComponent implements OnChanges {
@Input() @Input()
appId: string; appId: string;
@ -41,9 +41,6 @@ export class AnalyticsComponent implements OnInit, OnChanges {
@Output() @Output()
onSuccess = new EventEmitter(); onSuccess = new EventEmitter();
@Output()
onShowReport = new EventEmitter();
@Output() @Output()
onError = new EventEmitter(); onError = new EventEmitter();
@ -59,9 +56,6 @@ export class AnalyticsComponent implements OnInit, OnChanges {
} }
} }
ngOnInit() {
}
ngOnChanges(changes: SimpleChanges) { ngOnChanges(changes: SimpleChanges) {
this.reset(); this.reset();
} }
@ -71,7 +65,7 @@ export class AnalyticsComponent implements OnInit, OnChanges {
this.analyticsService.getReportsByParams(this.reportId, this.reportParamQuery).subscribe( this.analyticsService.getReportsByParams(this.reportId, this.reportParamQuery).subscribe(
(res: Chart[]) => { (res: Chart[]) => {
this.reports = res; this.reports = res;
this.onShowReport.emit(res); this.onSuccess.emit(res);
}, },
(err: any) => { (err: any) => {
this.onError.emit(err); this.onError.emit(err);