Browse Source

fix d binding (#142)

master
Alexey Velikiy 6 years ago committed by GitHub
parent
commit
dc35fe8331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      src/module.ts

13
src/module.ts

@ -18,6 +18,7 @@ import { MetricsPanelCtrl } from 'grafana/app/plugins/sdk';
import { appEvents } from 'grafana/app/core/core' import { appEvents } from 'grafana/app/core/core'
import { BackendSrv } from 'grafana/app/core/services/backend_srv'; import { BackendSrv } from 'grafana/app/core/services/backend_srv';
import _ from 'lodash'; import _ from 'lodash';
const BACKEND_VARIABLE_NAME = 'HASTIC_SERVER_URL'; const BACKEND_VARIABLE_NAME = 'HASTIC_SERVER_URL';
@ -160,7 +161,8 @@ class GraphCtrl extends MetricsPanelCtrl {
this.runBackendConnectivityCheck(); this.runBackendConnectivityCheck();
this.analyticsController = new AnalyticController(this.panel, this.analyticService, this.events); this.analyticsController = new AnalyticController(this.panel, this.analyticService, this.events);
keybindingSrv.bind('d', this.onDKey.bind(this));
this.bindDKey();
this.events.on('render', this.onRender.bind(this)); this.events.on('render', this.onRender.bind(this));
this.events.on('data-received', this.onDataReceived.bind(this)); this.events.on('data-received', this.onDataReceived.bind(this));
@ -201,6 +203,15 @@ class GraphCtrl extends MetricsPanelCtrl {
} }
bindDKey() {
this.keybindingSrv.bind('d', this.onDKey.bind(this));
}
editPanel() {
super.editPanel();
this.bindDKey();
}
get backendURL(): string { get backendURL(): string {
if(this.templateSrv.index[BACKEND_VARIABLE_NAME] === undefined) { if(this.templateSrv.index[BACKEND_VARIABLE_NAME] === undefined) {
return undefined; return undefined;

Loading…
Cancel
Save