Browse Source

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

master
Coin de Gamma 5 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",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:3000/d/Votr2gvmk/nginx",
"url": "http://localhost:3000/",
"sourceMaps": true,
"pathMapping": {
"/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 _graphMousePosition: any;
constructor ($elem: JQuery<HTMLElement>, timeSrv, contextSrv, scope) {
constructor($elem: JQuery<HTMLElement>, timeSrv, contextSrv, scope) {
var self = this;
this.$elem = $elem;
@ -164,7 +166,7 @@ export class GraphRenderer {
// this.eventManager.updateTime(selectionEvent.xaxis);
// }, 100);
} else {
this.scope.$apply(function() {
this.scope.$apply(() => {
this.timeSrv.setTime({
from: moment.utc(selectionEvent.xaxis.from),
to: moment.utc(selectionEvent.xaxis.to),

Loading…
Cancel
Save