+
+
{{report.title}}
{{'ANALYTICS.MESSAGES.NO-DATA-FOUND' | translate}}
@@ -80,7 +97,10 @@
{{'ANALYTICS.MESSAGES.UNKNOWN-WIDGET-TYPE' | translate}}: {{report.type}}
diff --git a/ng2-components/ng2-activiti-analytics/src/components/analytics-generator.component.spec.ts b/ng2-components/ng2-activiti-analytics/src/components/analytics-generator.component.spec.ts
index 77313de50d..e94809f961 100644
--- a/ng2-components/ng2-activiti-analytics/src/components/analytics-generator.component.spec.ts
+++ b/ng2-components/ng2-activiti-analytics/src/components/analytics-generator.component.spec.ts
@@ -135,6 +135,44 @@ describe('AnalyticsGeneratorComponent', () => {
});
});
+ it('Should render the Process definition overview report when onchanges is called ', (done) => {
+ component.onSuccess.subscribe((res) => {
+ expect(res).toBeDefined();
+ expect(res.length).toEqual(3);
+
+ expect(res[0]).toBeDefined();
+ expect(res[0].type).toEqual('table');
+ expect(res[0].datasets).toBeDefined();
+ expect(res[0].datasets.length).toEqual(4);
+ expect(res[0].datasets[0][0]).toEqual('__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-TOTAL-PROCESS-DEFINITIONS');
+ expect(res[0].datasets[0][1]).toEqual('9');
+ expect(res[0].datasets[1][0]).toEqual('__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-TOTAL-PROCESS-INSTANCES');
+ expect(res[0].datasets[1][1]).toEqual('41');
+ expect(res[0].datasets[2][0]).toEqual('__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-ACTIVE-PROCESS-INSTANCES');
+ expect(res[0].datasets[2][1]).toEqual('3');
+ expect(res[0].datasets[3][0]).toEqual('__KEY_REPORTING.DEFAULT-REPORTS.PROCESS-DEFINITION-OVERVIEW.GENERAL-TABLE-COMPLETED-PROCESS-INSTANCES');
+ expect(res[0].datasets[3][1]).toEqual('38');
+
+ expect(res[1]).toBeDefined();
+ expect(res[1].type).toEqual('pie');
+
+ expect(res[2]).toBeDefined();
+ expect(res[2].type).toEqual('table');
+
+ done();
+ });
+
+ component.reportId = 1001;
+ component.reportParamQuery = new ReportQuery({status: 'All'});
+ component.ngOnChanges();
+
+ jasmine.Ajax.requests.mostRecent().respondWith({
+ status: 200,
+ contentType: 'json',
+ responseText: analyticMock.chartProcessDefOverview
+ });
+ });
+
it('Should render the Task overview report ', (done) => {
component.onSuccess.subscribe((res) => {
expect(res).toBeDefined();
diff --git a/ng2-components/ng2-activiti-analytics/src/components/analytics-generator.component.ts b/ng2-components/ng2-activiti-analytics/src/components/analytics-generator.component.ts
index 09097365c8..9625ada99a 100644
--- a/ng2-components/ng2-activiti-analytics/src/components/analytics-generator.component.ts
+++ b/ng2-components/ng2-activiti-analytics/src/components/analytics-generator.component.ts
@@ -44,6 +44,7 @@ export class AnalyticsGeneratorComponent implements OnChanges {
reports: Chart[];
showDetails: boolean = false;
+ currentChartPosition: number;
public barChartOptions: any = {
responsive: true,
@@ -83,6 +84,9 @@ export class AnalyticsGeneratorComponent implements OnChanges {
this.analyticsService.getReportsByParams(reportId, reportParamQuery).subscribe(
(res: Chart[]) => {
this.reports = res;
+ if (this.reports) {
+ this.selectFirstReport();
+ }
this.onSuccess.emit(res);
},
(err: any) => {
@@ -116,4 +120,16 @@ export class AnalyticsGeneratorComponent implements OnChanges {
isShowDetails(): boolean {
return this.showDetails;
}
+
+ isCurrent(position: number) {
+ return position === this.currentChartPosition ? true : false;
+ }
+
+ selectCurrent(position: number) {
+ this.currentChartPosition = position;
+ }
+
+ selectFirstReport() {
+ this.selectCurrent(0);
+ }
}
diff --git a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.css b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.css
index 073fb82bbd..e9065e2264 100644
--- a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.css
+++ b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.css
@@ -16,4 +16,37 @@
.activiti-filters__entry.active .activiti-filters__entry-icon {
color: rgb(68,138,255);
-}
\ No newline at end of file
+}
+
+.application-title {
+ color: white;
+ z-index: 7;
+}
+
+.logo {
+ position: absolute;
+ right: 20px;
+ top: 35px;
+ z-index: 6;
+}
+.logo i{
+ font-size: 70px;
+}
+
+.theme-1 {
+ background-color: #269abc;
+}
+
+.theme-1 .logo i {
+ color: #168aac;
+}
+.theme-1 .mdl-card__actions i {
+ color: #168aac;
+}
+.theme-1 .mdl-card__actions i:hover {
+ color: #b7dfea;
+}
+
+.selectedIcon{
+ color: #e9f1f3!important;
+}
diff --git a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.html b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.html
index 38a6af1268..40a9ba9bf5 100644
--- a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.html
+++ b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.html
@@ -1,5 +1,5 @@
\ No newline at end of file
+
+
+
equalizer
+
+
{{report.name}}
+
+
+
{{report.description}}
+
+
+ done
+
+
+
+
diff --git a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.spec.ts b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.spec.ts
index c437ab7342..7e31bd19b9 100644
--- a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.spec.ts
+++ b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.spec.ts
@@ -21,6 +21,7 @@ import { Observable } from 'rxjs/Rx';
import { CoreModule, AlfrescoTranslationService } from 'ng2-alfresco-core';
import { AnalyticsReportListComponent } from '../components/analytics-report-list.component';
import { AnalyticsService } from '../services/analytics.service';
+import { ReportParametersModel } from '../models/report.model';
declare let jasmine: any;
@@ -166,6 +167,59 @@ describe('AnalyticsReportListComponent', () => {
component.selectReport(reportSelected);
});
+ it('Should return true if the current report is selected', () => {
+ component.selectReport(reportSelected);
+ expect(component.isSelected(reportSelected)).toBe(true);
+ });
+
+ it('Should return false if the current report is different', () => {
+ component.selectReport(reportSelected);
+ let anotherReport = {'id': 111, 'name': 'Another Fake Test Process definition overview'};
+ expect(component.isSelected(anotherReport)).toBe(false);
+ });
+
+ it('Should reload the report list', (done) => {
+ component.initObserver();
+ let report = new ReportParametersModel({'id': 2002, 'name': 'Fake Test Process definition heat map'});
+ component.reports = [report];
+ expect(component.reports.length).toEqual(1);
+ component.reload();
+
+ component.onSuccess.subscribe(() => {
+ expect(component.reports.length).toEqual(5);
+ done();
+ });
+
+ jasmine.Ajax.requests.mostRecent().respondWith({
+ status: 200,
+ contentType: 'json',
+ responseText: reportList
+ });
+ });
+
+ });
+
+ describe('layout', () => {
+
+ it('should display a list by default', () => {
+ fixture.detectChanges();
+ expect(component.isGrid()).toBe(false);
+ expect(component.isList()).toBe(true);
+ });
+
+ it('should display a grid when configured to', () => {
+ component.layoutType = AnalyticsReportListComponent.LAYOUT_GRID;
+ fixture.detectChanges();
+ expect(component.isGrid()).toBe(true);
+ expect(component.isList()).toBe(false);
+ });
+
+ it('should display a list when configured to', () => {
+ component.layoutType = AnalyticsReportListComponent.LAYOUT_LIST;
+ fixture.detectChanges();
+ expect(component.isGrid()).toBe(false);
+ expect(component.isList()).toBe(true);
+ });
});
});
diff --git a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.ts b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.ts
index ca2649f230..2563c0fb6c 100644
--- a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.ts
+++ b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-list.component.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import { Component, EventEmitter, OnInit, Output } from '@angular/core';
+import { Component, EventEmitter, OnInit, Output, Input } from '@angular/core';
import { Observer, Observable } from 'rxjs/Rx';
import { LogService } from 'ng2-alfresco-core';
import { AnalyticsService } from '../services/analytics.service';
@@ -29,6 +29,12 @@ import { ReportParametersModel } from '../models/report.model';
})
export class AnalyticsReportListComponent implements OnInit {
+ public static LAYOUT_LIST: string = 'LIST';
+ public static LAYOUT_GRID: string = 'GRID';
+
+ @Input()
+ layoutType: string = AnalyticsReportListComponent.LAYOUT_LIST;
+
@Output()
reportClick: EventEmitter
= new EventEmitter();
@@ -51,11 +57,15 @@ export class AnalyticsReportListComponent implements OnInit {
}
ngOnInit() {
+ this.initObserver();
+
+ this.getReportList();
+ }
+
+ initObserver() {
this.report$.subscribe((report: ReportParametersModel) => {
this.reports.push(report);
});
-
- this.getReportList();
}
/**
@@ -131,4 +141,16 @@ export class AnalyticsReportListComponent implements OnInit {
this.currentReport = report;
this.reportClick.emit(report);
}
+
+ isSelected(report: any) {
+ return this.currentReport === report ? true : false;
+ }
+
+ isList() {
+ return this.layoutType === AnalyticsReportListComponent.LAYOUT_LIST;
+ }
+
+ isGrid() {
+ return this.layoutType === AnalyticsReportListComponent.LAYOUT_GRID;
+ }
}
diff --git a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.css b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.css
index 07f935cbb9..947c5d475a 100644
--- a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.css
+++ b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.css
@@ -56,7 +56,7 @@
}
.report-container {
- border: solid 1px rgb(212, 212, 212);
+ border-bottom: solid 1px rgb(212, 212, 212);
padding: 10px 10px 10px 10px;
}
diff --git a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.html b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.html
index 98939ea442..91b38999f5 100644
--- a/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.html
+++ b/ng2-components/ng2-activiti-analytics/src/components/analytics-report-parameters.component.html
@@ -1,11 +1,5 @@