Browse Source

fix: TypeError: Cannot read property 'timeSrv' of undefined

master
Coin de Gamma 6 years ago
parent
commit
8da6221441
  1. 2
      .vscode/launch.json
  2. 6
      src/panel/graph_panel/graph_renderer.ts

2
.vscode/launch.json vendored

@ -5,7 +5,7 @@
"type": "chrome", "type": "chrome",
"request": "launch", "request": "launch",
"name": "Launch Chrome against localhost", "name": "Launch Chrome against localhost",
"url": "http://localhost:3000/d/Votr2gvmk/nginx", "url": "http://localhost:3000/",
"sourceMaps": true, "sourceMaps": true,
"pathMapping": { "pathMapping": {
"/public/plugins/hastic-graph-panel": "${workspaceFolder}/dist" "/public/plugins/hastic-graph-panel": "${workspaceFolder}/dist"

6
src/panel/graph_panel/graph_renderer.ts

@ -56,7 +56,9 @@ export class GraphRenderer {
private timeSrv: any; private timeSrv: any;
private _graphMousePosition: any; private _graphMousePosition: any;
constructor ($elem: JQuery<HTMLElement>, timeSrv, contextSrv, scope) { constructor($elem: JQuery<HTMLElement>, timeSrv, contextSrv, scope) {
var self = this; var self = this;
this.$elem = $elem; this.$elem = $elem;
@ -164,7 +166,7 @@ export class GraphRenderer {
// this.eventManager.updateTime(selectionEvent.xaxis); // this.eventManager.updateTime(selectionEvent.xaxis);
// }, 100); // }, 100);
} else { } else {
this.scope.$apply(function() { this.scope.$apply(() => {
this.timeSrv.setTime({ this.timeSrv.setTime({
from: moment.utc(selectionEvent.xaxis.from), from: moment.utc(selectionEvent.xaxis.from),
to: moment.utc(selectionEvent.xaxis.to), to: moment.utc(selectionEvent.xaxis.to),

Loading…
Cancel
Save