X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=otf-frontend%2Fclient%2Fsrc%2Fapp%2Flayout%2Fcomponents%2Fstats%2Fschedule%2Fschedule.component.ts;fp=otf-frontend%2Fclient%2Fsrc%2Fapp%2Flayout%2Fcomponents%2Fstats%2Fschedule%2Fschedule.component.ts;h=a8a04ce764432ac74493f0edc0a85bffaae7537b;hb=6f7e46b4562b31f748670be8947d315963240ddd;hp=0000000000000000000000000000000000000000;hpb=f49bd1efeaaddd4891c1f329b18d8cfb28b3e75b;p=it%2Fotf.git 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 index 0000000..a8a04ce --- /dev/null +++ b/otf-frontend/client/src/app/layout/components/stats/schedule/schedule.component.ts @@ -0,0 +1,71 @@ +/* Copyright (c) 2019 AT&T Intellectual Property. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +##############################################################################*/ + + +import { Component, OnInit, NgZone, ChangeDetectorRef } from '@angular/core'; +//import material from "@amcharts/amcharts4/themes/material"; +import am4themes_animated from "@amcharts/amcharts4/themes/animated"; +import { GroupService } from 'app/shared/services/group.service'; +import { StatsService } from '../stats.service'; +import { Observable, Subject } from 'rxjs'; + +export interface ScheduleElement { + name: string; + dateExec: string; + timeExec: string; +} + +@Component({ + selector: 'app-schedule', + templateUrl: './schedule.component.pug', + styleUrls: ['./schedule.component.scss'] +}) + +export class ScheduleComponent implements OnInit { + + protected stats: StatsService; + public doneLoadingfalse; + public dataSource; + + displayedColumns: string[] = ['name', 'dateExec', 'timeExec']; + + constructor(private zone: NgZone, private _groups: GroupService, private statsService: StatsService, private changeDetector: ChangeDetectorRef) { + this.stats = statsService; + } + + ngOnInit() { + + this.stats.onDefaultDataCallFinished().subscribe(res => { + this.dataSource = this.stats.getData("Schedule"); + }) + this.dataSource = this.stats.getData("Schedule"); + + this.refresh(); + } + + defaultDataListener(): Observable { + return this.stats.finishedDefaultData; + } + + refresh(){ + this.stats.onScheduleChangeFinished().subscribe(res => { + this.dataSource = this.stats.getData("Schedule"); + this.dataSource = this.dataSource.slice(); + + this.changeDetector.detectChanges(); + }) + } + +} \ No newline at end of file