added svcapi ui and camunda code
[it/otf.git] / otf-frontend / client / src / app / layout / components / stats / schedule / schedule.component.ts
diff --git a/otf-frontend/client/src/app/layout/components/stats/schedule/schedule.component.ts b/otf-frontend/client/src/app/layout/components/stats/schedule/schedule.component.ts
new file mode 100644 (file)
index 0000000..a8a04ce
--- /dev/null
@@ -0,0 +1,71 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #\r
+#                                                                              #\r
+#   Licensed under the Apache License, Version 2.0 (the "License");            #\r
+#   you may not use this file except in compliance with the License.           #\r
+#   You may obtain a copy of the License at                                    #\r
+#                                                                              #\r
+#       http://www.apache.org/licenses/LICENSE-2.0                             #\r
+#                                                                              #\r
+#   Unless required by applicable law or agreed to in writing, software        #\r
+#   distributed under the License is distributed on an "AS IS" BASIS,          #\r
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #\r
+#   See the License for the specific language governing permissions and        #\r
+#   limitations under the License.                                             #\r
+##############################################################################*/\r
+\r
+\r
+import { Component, OnInit, NgZone, ChangeDetectorRef } from '@angular/core';\r
+//import material from "@amcharts/amcharts4/themes/material";\r
+import am4themes_animated from "@amcharts/amcharts4/themes/animated";\r
+import { GroupService } from 'app/shared/services/group.service';\r
+import { StatsService } from '../stats.service';\r
+import { Observable, Subject } from 'rxjs';\r
+\r
+export interface ScheduleElement {\r
+  name: string;\r
+  dateExec: string;\r
+  timeExec: string;\r
+}\r
+\r
+@Component({\r
+  selector: 'app-schedule',\r
+  templateUrl: './schedule.component.pug',\r
+  styleUrls: ['./schedule.component.scss']\r
+})\r
+\r
+export class ScheduleComponent implements OnInit {\r
+\r
+  protected stats: StatsService;\r
+  public doneLoadingfalse;\r
+  public dataSource;\r
+\r
+  displayedColumns: string[] = ['name', 'dateExec', 'timeExec'];\r
+\r
+  constructor(private zone: NgZone, private _groups: GroupService, private statsService: StatsService, private changeDetector: ChangeDetectorRef) {\r
+    this.stats = statsService;\r
+  }\r
+\r
+  ngOnInit() {\r
+\r
+    this.stats.onDefaultDataCallFinished().subscribe(res => {\r
+      this.dataSource = this.stats.getData("Schedule");\r
+    })\r
+    this.dataSource = this.stats.getData("Schedule");\r
+\r
+    this.refresh();\r
+  }\r
+\r
+  defaultDataListener(): Observable<Object> {\r
+    return this.stats.finishedDefaultData;\r
+  }\r
+\r
+  refresh(){\r
+    this.stats.onScheduleChangeFinished().subscribe(res => {\r
+      this.dataSource = this.stats.getData("Schedule");\r
+      this.dataSource = this.dataSource.slice();\r
+      \r
+      this.changeDetector.detectChanges();\r
+    })\r
+  }\r
+\r
+}
\ No newline at end of file