* ========================LICENSE_START=================================
* O-RAN-SC
* %%
- * Copyright (C) 2019 AT&T Intellectual Property and Nokia
+ * 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.
import { StatsService } from '../services/stats/stats.service';
import { HttpClient } from '@angular/common/http';
import { map } from 'rxjs/operators';
+import { DashboardSuccessTransport } from '../interfaces/dashboard.types';
+import { DomSanitizer, SafeUrl, SafeResourceUrl } from '@angular/platform-browser';
@Component({
selector: 'rd-stats',
checked = false;
load;
delay;
+ metricsUrlAc : SafeResourceUrl;
+ metricsUrlMc : SafeResourceUrl;
public latencyChartColors: Array<any> = [
{ // blue
return value;
}
- constructor(private service: StatsService, private httpClient: HttpClient) {
+ constructor(private service: StatsService, private httpClient: HttpClient, private sanitize: DomSanitizer) {
this.sliderLoadMax = Number(this.service.loadMax) || 0;
this.sliderDelayMax = Number(this.service.delayMax) || 0;
// console.log('this.sliderLoadMax: ' + this.sliderLoadMax);
this.fetchMetrics().subscribe(metricsv => {
// console.log('metricsv.load: ' + metricsv['load']);
});
+ this.service.getAppMetricsUrl('AC').subscribe((res:DashboardSuccessTransport) => {
+ this.metricsUrlAc = this.sanitize.bypassSecurityTrustResourceUrl(res.data);
+ });
+ this.service.getAppMetricsUrl('MC').subscribe((res:DashboardSuccessTransport) => {
+ this.metricsUrlMc = this.sanitize.bypassSecurityTrustResourceUrl(res.data);
+ });
}
startLoadTimer() {
fetchMetrics() {
return this.httpClient.get<any[]>(this.service.hostURL + this.service.metricsPath, this.service.httpOptions).pipe(map(res => {
- // console.log(res);
- // console.log(res['load']);
return res;
}));
}
fetchDelay() {
return this.httpClient.get<any[]>(this.service.hostURL + this.service.delayPath, this.service.httpOptions).pipe(map(res => {
- // console.log(res);
- // console.log(res['delay']);
const delayv = res['delay'];
- // console.log(delayv);
this.delay = delayv;
return this.delay;
}));
}
saveDelay() {
- // console.log(this.delay);
this.service.putDelay(this.delay);
}
fetchLoad() {
return this.httpClient.get<any[]>(this.service.hostURL + this.service.loadPath, this.service.httpOptions).pipe(map(res => {
- // console.log(res);
- // console.log(res['load']);
const loadv = res['load'];
- // console.log(loadv);
this.load = loadv;
return this.load;
}));
}
saveLoad() {
- // console.log(this.load);
this.service.putLoad(this.load);
}