anryko / grafana-influx-dashboard

Grafana InfluxDB scripted dashboard
MIT License
132 stars 44 forks source link

Better schemaVersion support for different version of grafana #78

Closed chenatu closed 7 years ago

chenatu commented 7 years ago

I am working on putting threshold on graph panel for grafana 4.0. I set threshold in getdash.app.js but it is reset to empty array in public/app/features/dashboard/model.ts like this:

if (oldVersion < 13) {
        // update graph yaxes changes
        panelUpgrades.push(function(panel) {
          if (panel.type !== 'graph') { return; }
          if (!panel.grid) { return; }

          panel.thresholds = [];

This is because schemaVersion is below 13 and I think getdash.js does not set schemaVersion.

I think maybe it would be better to organize the schema version of code for different version of grafana support?

anryko commented 7 years ago

Please test and close the issue if this commit satisfies your request. Looking forward for threshold support :).

chenatu commented 7 years ago

I have put threshold on load graph panel based on your commit. It works fine and does not influence other plugins I use