- @Input() tm_from = 1528988550450;
- @Input() tm_to = 1528988842496;
+ @Input() tm_from = 'now-60s';
+ @Input() tm_to = 'now';
+ @Input() refresh = '5s';
- dd.url = this._buildDashboardUrl(dd.shortname, this.tm_from, this.tm_to, this.theme);
+ dd.url = this._buildDashboardUrl(dd.shortname, this.tm_from, this.tm_to, this.refresh, this.theme);
- gg.url = this._buildPanelUrl(gg.index, this.tm_from, this.tm_to, this.theme);
+ gg.url = this._buildPanelUrl(gg.index, this.tm_from, this.tm_to, this.refresh, this.theme);
- private _buildDashboardUrl(sname: string, from: number, to: number, theme: string) {
+ private _buildDashboardUrl(sname, from, to, refresh, theme: string) {
// FIXME get sname from config to support several dashboards
let url = 'http://localhost:3000/d/Lbpwc6Iiz/' + sname;
if (this.Config.grafanaDashboardUrl !== '') {
url = this.Config.grafanaDashboardUrl;
}
url += '?orgId=1';
// FIXME get sname from config to support several dashboards
let url = 'http://localhost:3000/d/Lbpwc6Iiz/' + sname;
if (this.Config.grafanaDashboardUrl !== '') {
url = this.Config.grafanaDashboardUrl;
}
url += '?orgId=1';
- url += '&from=' + from;
- url += '&to=' + to;
- url += '&theme=' + theme;
+ if (from !== '') { url += '&from=' + from; }
+ if (to !== '') { url += '&to=' + to; }
+ if (theme !== '') { url += '&theme=' + theme; }
+ if (refresh !== '') { url += '&refresh=' + refresh; }
- private _buildPanelUrl(idx: string, from: number, to: number, theme: string) {
+ private _buildPanelUrl(idx, from, to, refresh, theme: string) {
let url = 'http://localhost:3000/d-solo/Lbpwc6Iiz/agl-xds-supervisor';
if (this.Config.grafanaDashboardUrl !== '') {
url = this.Config.grafanaDashboardUrl;
}
url += '?panelId=' + idx;
url += '&orgId=1';
let url = 'http://localhost:3000/d-solo/Lbpwc6Iiz/agl-xds-supervisor';
if (this.Config.grafanaDashboardUrl !== '') {
url = this.Config.grafanaDashboardUrl;
}
url += '?panelId=' + idx;
url += '&orgId=1';
- url += '&from=' + from;
- url += '&to=' + to;
- url += '&theme=' + theme;
+ if (from !== '') { url += '&from=' + from; }
+ if (to !== '') { url += '&to=' + to; }
+ if (theme !== '') { url += '&theme=' + theme; }
+ if (refresh !== '') { url += '&refresh=' + refresh; }