diff --git a/monitor/src/app/model/report-meta.ts b/monitor/src/app/model/report-meta.ts deleted file mode 100644 index bdcff3c88..000000000 --- a/monitor/src/app/model/report-meta.ts +++ /dev/null @@ -1,7 +0,0 @@ -export class ReportMeta { - name: string; - date: string; - header: Array; - rowDesc: string; - totalDesc: string; -} diff --git a/monitor/src/app/model/report.ts b/monitor/src/app/model/report.ts deleted file mode 100644 index 11b367b1d..000000000 --- a/monitor/src/app/model/report.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ReportMeta } from "./report-meta"; - -export class ReportModel { - meta: ReportMeta; - // The keys of the rows object are unknown. They represent the name of that specific row. - // Each row (value of rows Object) has two keys: 'cells:Object' and 'total:number'. - // The keys of 'cells' are the same as 'meta.header:number'. - // This also applies to sumRow. - rows: Object; - sumRow: Object; -} diff --git a/monitor/src/app/report/report.component.html b/monitor/src/app/report/report.component.html index 2ceed538e..0840ff582 100644 --- a/monitor/src/app/report/report.component.html +++ b/monitor/src/app/report/report.component.html @@ -1,21 +1,21 @@ -
+
-

{{model.meta.name}} ({{model.meta.date | date : 'dd.MM.yyyy HH:mm:ss'}})

+

{{meta.name}} ({{meta.date | date : 'dd.MM.yyyy HH:mm:ss'}})

- - - + + + - + - + - - - + + +
{{model.meta.rowDesc}}{{header}}{{model.meta.totalDesc}}{{meta.rowDesc}}{{header}}{{meta.totalDesc}}
{{row.key}}{{row.val.cells[header]}}{{row.val.cells[header]}} {{row.val.total}}
{{model.meta.totalDesc}}{{model.sumRow.cells[header]}}{{model.sumRow.total}}{{meta.totalDesc}}{{sumRow.cells[header]}}{{sumRow.total}}
diff --git a/monitor/src/app/report/report.component.ts b/monitor/src/app/report/report.component.ts index 6e423e0e5..251dde13f 100644 --- a/monitor/src/app/report/report.component.ts +++ b/monitor/src/app/report/report.component.ts @@ -1,5 +1,7 @@ import { Component, Input, OnInit } from "@angular/core"; -import { ReportModel } from "../model/report"; +import { RestConnectorService } from "../service/rest-connector.service"; +import { error } from "util"; +import { ReportType } from "./reportType"; @Component({ selector: 'report', @@ -8,14 +10,46 @@ import { ReportModel } from "../model/report"; export class Report implements OnInit { @Input() - model: ReportModel; + type: ReportType; - constructor() { + meta: ReportMeta; + /* + * The keys of the rows object are unknown. They represent the name of that specific row. + * Each row (value of rows Object) has two keys: 'cells:Object' and 'total:number'. + * The keys of 'cells' are the same as 'meta.header:number'. + * This also applies to sumRow. + */ + rows: Object; + sumRow: Object; + + + private isDataAvailable: boolean = false; + + constructor(private restConnector: RestConnectorService) { } ngOnInit(): void { - + switch (this.type) { + case ReportType.WorkbasketStatus: + this.restConnector.getTaskStatusReport().subscribe(res => { + this.meta = res['meta']; + this.rows = res['rows']; + this.sumRow = res['sumRow']; + this.isDataAvailable = true; + }); + break; + default: + error("unknown ReportType '" + this.type + "'"); + } } +} + +class ReportMeta { + name: string; + date: string; + header: Array; + rowDesc: string; + totalDesc: string; } diff --git a/monitor/src/app/report/reportType.ts b/monitor/src/app/report/reportType.ts new file mode 100644 index 000000000..5a29c07fe --- /dev/null +++ b/monitor/src/app/report/reportType.ts @@ -0,0 +1,3 @@ +export enum ReportType { + WorkbasketStatus +} diff --git a/monitor/src/app/service/rest-connector.service.ts b/monitor/src/app/service/rest-connector.service.ts index 7ad62cb77..dfc4bfa74 100644 --- a/monitor/src/app/service/rest-connector.service.ts +++ b/monitor/src/app/service/rest-connector.service.ts @@ -4,7 +4,6 @@ import { environment } from '../../environments/environment'; import { Observable } from 'rxjs/Observable'; import { State } from '../model/state'; import { WorkbasketCounter } from '../model/workbasket-counter'; -import { ReportModel } from "../model/report"; @Injectable() export class RestConnectorService { @@ -23,7 +22,7 @@ export class RestConnectorService { .map(res => res.json()); } - getTaskStatusReport(): Observable { + getTaskStatusReport(): Observable { return this.http.get(environment.taskanaRestUrl + "/v1/monitor/taskStatusReport", this.createAuthorizationHeader()) .map(res => res.json()); } diff --git a/monitor/src/app/tasks/tasks.component.html b/monitor/src/app/tasks/tasks.component.html index 0e1916ba7..46de0f40d 100644 --- a/monitor/src/app/tasks/tasks.component.html +++ b/monitor/src/app/tasks/tasks.component.html @@ -1,4 +1,4 @@
- + diff --git a/monitor/src/app/tasks/tasks.component.ts b/monitor/src/app/tasks/tasks.component.ts index 1a65321cd..51e7c6947 100644 --- a/monitor/src/app/tasks/tasks.component.ts +++ b/monitor/src/app/tasks/tasks.component.ts @@ -1,7 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { RestConnectorService } from '../service/rest-connector.service'; -import { Report } from "../report/report.component"; -import { ReportModel } from "../model/report"; +import { ReportType } from "../report/reportType"; @Component({ selector: 'tasks', @@ -16,8 +15,7 @@ export class TasksComponent implements OnInit { pieChartData: number[] = []; pieChartType: string = 'pie'; isDataAvailable: boolean = false; - report: Report; - taskStatusReport: ReportModel; + reportType = ReportType.WorkbasketStatus; constructor(private restConnectorService: RestConnectorService) { } @@ -39,10 +37,7 @@ export class TasksComponent implements OnInit { } else { this.pieChartData.push(0); } - }); - this.restConnectorService.getTaskStatusReport().subscribe(report => { - this.taskStatusReport = report; this.isDataAvailable = true; - }) + }); } }