Browse Source

remove annotations

master
Alexey Velikiy 6 years ago
parent
commit
74f5563096
  1. 79
      dist/module.js
  2. 6
      src/graph_renderer.ts
  3. 75
      src/module.ts

79
dist/module.js vendored

@ -6578,7 +6578,7 @@ var GraphRenderer = /** @class */ (function () {
if (this._ananlyticController === undefined) { if (this._ananlyticController === undefined) {
throw new Error('ananlyticController is undefined'); throw new Error('ananlyticController is undefined');
} }
this.annotations = []; // this.annotations = [];
this.panelWidth = 0; this.panelWidth = 0;
// this.eventManager = new EventManager(this.ctrl); // this.eventManager = new EventManager(this.ctrl);
this.flotOptions = {}; this.flotOptions = {};
@ -6678,7 +6678,7 @@ var GraphRenderer = /** @class */ (function () {
if (!this.data) { if (!this.data) {
return; return;
} }
this.annotations = this.ctrl.annotations || []; // this.annotations = this.ctrl.annotations || [];
this._buildFlotPairs(this.data); this._buildFlotPairs(this.data);
updateLegendValues(this.data, this.panel); updateLegendValues(this.data, this.panel);
this._renderPanel(); this._renderPanel();
@ -8169,7 +8169,6 @@ var GraphCtrl = /** @class */ (function (_super) {
_this.hiddenSeries = {}; _this.hiddenSeries = {};
_this.seriesList = []; _this.seriesList = [];
_this.dataList = []; _this.dataList = [];
_this.annotations = [];
_this._renderError = false; _this._renderError = false;
_this.colors = []; _this.colors = [];
_this.anomalyTypes = []; // TODO: remove it later. Only for alert tab _this.anomalyTypes = []; // TODO: remove it later. Only for alert tab
@ -8362,27 +8361,27 @@ var GraphCtrl = /** @class */ (function (_super) {
actions.push({ text: 'Toggle legend', click: 'ctrl.toggleLegend()' }); actions.push({ text: 'Toggle legend', click: 'ctrl.toggleLegend()' });
}; };
GraphCtrl.prototype.issueQueries = function (datasource) { GraphCtrl.prototype.issueQueries = function (datasource) {
this.annotationsPromise = this.annotationsSrv.getAnnotations({ // this.annotationsPromise = this.annotationsSrv.getAnnotations({
dashboard: this.dashboard, // dashboard: this.dashboard,
panel: this.panel, // panel: this.panel,
range: this.range, // range: this.range,
}); // });
return _super.prototype.issueQueries.call(this, datasource); return _super.prototype.issueQueries.call(this, datasource);
}; };
GraphCtrl.prototype.zoomOut = function (evt) { GraphCtrl.prototype.zoomOut = function (evt) {
this.publishAppEvent('zoom-out', 2); this.publishAppEvent('zoom-out', 2);
}; };
GraphCtrl.prototype.onDataSnapshotLoad = function (snapshotData) { GraphCtrl.prototype.onDataSnapshotLoad = function (snapshotData) {
this.annotationsPromise = this.annotationsSrv.getAnnotations({ // this.annotationsPromise = this.annotationsSrv.getAnnotations({
dashboard: this.dashboard, // dashboard: this.dashboard,
panel: this.panel, // panel: this.panel,
range: this.range, // range: this.range,
}); // });
this.onDataReceived(snapshotData); this.onDataReceived(snapshotData);
}; };
GraphCtrl.prototype.onDataError = function (err) { GraphCtrl.prototype.onDataError = function (err) {
this.seriesList = []; this.seriesList = [];
this.annotations = []; // this.annotations = [];
this.render([]); this.render([]);
}; };
GraphCtrl.prototype.onDataReceived = function (dataList) { GraphCtrl.prototype.onDataReceived = function (dataList) {
@ -8418,15 +8417,14 @@ var GraphCtrl = /** @class */ (function (_super) {
} }
} }
loadTasks = [ loadTasks = [
this.annotationsPromise, // this.annotationsPromise,
this.analyticsController.fetchAnomalyTypesSegments(+this.range.from, +this.range.to) this.analyticsController.fetchAnomalyTypesSegments(+this.range.from, +this.range.to)
]; ];
return [4 /*yield*/, Promise.all(loadTasks)]; return [4 /*yield*/, Promise.all(loadTasks)];
case 1: case 1:
results = _b.sent(); results = _b.sent();
this.loading = false; this.loading = false;
this.alertState = results[0].alertState; // this.annotations = results[0].annotations;
this.annotations = results[0].annotations;
this.render(this.seriesList); this.render(this.seriesList);
return [2 /*return*/]; return [2 /*return*/];
} }
@ -8583,34 +8581,27 @@ var GraphCtrl = /** @class */ (function (_super) {
modalClass: 'modal--narrow', modalClass: 'modal--narrow',
}); });
}; };
GraphCtrl.prototype.getAnnotationsByTag = function (tag) {
var res = [];
for (var _i = 0, _a = this.annotations; _i < _a.length; _i++) {
var annotation = _a[_i];
if (annotation.tags.indexOf(tag) >= 0) {
res.push(annotation);
}
}
return res;
};
Object.defineProperty(GraphCtrl.prototype, "annotationTags", {
get: function () {
var res = [];
for (var _i = 0, _a = this.annotations; _i < _a.length; _i++) {
var annotation = _a[_i];
for (var _b = 0, _c = annotation.tags; _b < _c.length; _b++) {
var tag = _c[_b];
if (res.indexOf(tag) < 0) {
res.push(tag);
}
}
}
return res;
},
enumerable: true,
configurable: true
});
Object.defineProperty(GraphCtrl.prototype, "panelPath", { Object.defineProperty(GraphCtrl.prototype, "panelPath", {
// getAnnotationsByTag(tag) {
// var res = [];
// for (var annotation of this.annotations) {
// if (annotation.tags.indexOf(tag) >= 0) {
// res.push(annotation);
// }
// }
// return res;
// }
// get annotationTags() {
// var res = [];
// for (var annotation of this.annotations) {
// for (var tag of annotation.tags) {
// if (res.indexOf(tag) < 0) {
// res.push(tag);
// }
// }
// }
// return res;
// }
get: function () { get: function () {
if (this._panelPath === undefined) { if (this._panelPath === undefined) {
this._panelPath = '/public/plugins/' + this.pluginId + '/'; this._panelPath = '/public/plugins/' + this.pluginId + '/';

6
src/graph_renderer.ts

@ -52,7 +52,7 @@ export class GraphRenderer {
// private eventManager; // private eventManager;
private flotOptions: any = {} private flotOptions: any = {}
private $elem: JQuery<HTMLElement>; private $elem: JQuery<HTMLElement>;
private annotations: any[]; // private annotations: any[];
private contextSrv: any; private contextSrv: any;
private popoverSrv: any; private popoverSrv: any;
private scope: any; private scope: any;
@ -78,7 +78,7 @@ export class GraphRenderer {
} }
this.annotations = []; // this.annotations = [];
this.panelWidth = 0; this.panelWidth = 0;
// this.eventManager = new EventManager(this.ctrl); // this.eventManager = new EventManager(this.ctrl);
@ -202,7 +202,7 @@ export class GraphRenderer {
if (!this.data) { if (!this.data) {
return; return;
} }
this.annotations = this.ctrl.annotations || []; // this.annotations = this.ctrl.annotations || [];
this._buildFlotPairs(this.data); this._buildFlotPairs(this.data);
updateLegendValues(this.data, this.panel); updateLegendValues(this.data, this.panel);
this._renderPanel(); this._renderPanel();

75
src/module.ts

@ -31,13 +31,13 @@ class GraphCtrl extends MetricsPanelCtrl {
hiddenSeries: any = {}; hiddenSeries: any = {};
seriesList: any = []; seriesList: any = [];
dataList: any = []; dataList: any = [];
annotations: any = []; // annotations: any = [];
alertState: any;
_panelPath: any; _panelPath: any;
_renderError: boolean = false; _renderError: boolean = false;
annotationsPromise: any; // annotationsPromise: any;
dataWarning: any; dataWarning: any;
colors: any = []; colors: any = [];
subTabIndex: number; subTabIndex: number;
@ -250,11 +250,11 @@ class GraphCtrl extends MetricsPanelCtrl {
} }
issueQueries(datasource) { issueQueries(datasource) {
this.annotationsPromise = this.annotationsSrv.getAnnotations({ // this.annotationsPromise = this.annotationsSrv.getAnnotations({
dashboard: this.dashboard, // dashboard: this.dashboard,
panel: this.panel, // panel: this.panel,
range: this.range, // range: this.range,
}); // });
return super.issueQueries(datasource); return super.issueQueries(datasource);
} }
@ -263,17 +263,17 @@ class GraphCtrl extends MetricsPanelCtrl {
} }
onDataSnapshotLoad(snapshotData) { onDataSnapshotLoad(snapshotData) {
this.annotationsPromise = this.annotationsSrv.getAnnotations({ // this.annotationsPromise = this.annotationsSrv.getAnnotations({
dashboard: this.dashboard, // dashboard: this.dashboard,
panel: this.panel, // panel: this.panel,
range: this.range, // range: this.range,
}); // });
this.onDataReceived(snapshotData); this.onDataReceived(snapshotData);
} }
onDataError(err) { onDataError(err) {
this.seriesList = []; this.seriesList = [];
this.annotations = []; // this.annotations = [];
this.render([]); this.render([]);
} }
@ -308,14 +308,13 @@ class GraphCtrl extends MetricsPanelCtrl {
} }
var loadTasks = [ var loadTasks = [
this.annotationsPromise, // this.annotationsPromise,
this.analyticsController.fetchAnomalyTypesSegments(+this.range.from, +this.range.to) this.analyticsController.fetchAnomalyTypesSegments(+this.range.from, +this.range.to)
]; ];
var results = await Promise.all(loadTasks); var results = await Promise.all(loadTasks);
this.loading = false; this.loading = false;
this.alertState = results[0].alertState; // this.annotations = results[0].annotations;
this.annotations = results[0].annotations;
this.render(this.seriesList); this.render(this.seriesList);
} }
@ -482,27 +481,27 @@ class GraphCtrl extends MetricsPanelCtrl {
}); });
} }
getAnnotationsByTag(tag) { // getAnnotationsByTag(tag) {
var res = []; // var res = [];
for (var annotation of this.annotations) { // for (var annotation of this.annotations) {
if (annotation.tags.indexOf(tag) >= 0) { // if (annotation.tags.indexOf(tag) >= 0) {
res.push(annotation); // res.push(annotation);
} // }
} // }
return res; // return res;
} // }
get annotationTags() { // get annotationTags() {
var res = []; // var res = [];
for (var annotation of this.annotations) { // for (var annotation of this.annotations) {
for (var tag of annotation.tags) { // for (var tag of annotation.tags) {
if (res.indexOf(tag) < 0) { // if (res.indexOf(tag) < 0) {
res.push(tag); // res.push(tag);
} // }
} // }
} // }
return res; // return res;
} // }
get panelPath() { get panelPath() {
if (this._panelPath === undefined) { if (this._panelPath === undefined) {

Loading…
Cancel
Save