Browse Source

InfluxDB: Fix for bug when saving dashboard where title is the same as slugified url id, Fixes #859

Torkel Ödegaard 11 years ago
parent
commit
bce6e75cfa
2 changed files with 5 additions and 2 deletions
  1. 1 0
      CHANGELOG.md
  2. 4 2
      src/app/services/influxdb/influxdbDatasource.js

+ 1 - 0
CHANGELOG.md

@@ -7,6 +7,7 @@
 - [Issue #851](https://github.com/grafana/grafana/issues/851). Annotations: Fix for annotations not reloaded when switching between 2 dashboards with annotations
 - [Issue #851](https://github.com/grafana/grafana/issues/851). Annotations: Fix for annotations not reloaded when switching between 2 dashboards with annotations
 - [Issue #846](https://github.com/grafana/grafana/issues/846). Edit panes: Issue when open row or json editor when scrolled down the page, unable to scroll and you did not see editor
 - [Issue #846](https://github.com/grafana/grafana/issues/846). Edit panes: Issue when open row or json editor when scrolled down the page, unable to scroll and you did not see editor
 - [Issue #840](https://github.com/grafana/grafana/issues/840). Import: Fixes to import from json file and import from graphite. Issues was lingering state from previous dashboard.
 - [Issue #840](https://github.com/grafana/grafana/issues/840). Import: Fixes to import from json file and import from graphite. Issues was lingering state from previous dashboard.
+- [Issue #859](https://github.com/grafana/grafana/issues/859). InfluxDB: Fix for bug when saving dashboard where title is the same as slugified url id
 
 
 # 1.8.0 (2014-09-22)
 # 1.8.0 (2014-09-22)
 
 

+ 4 - 2
src/app/services/influxdb/influxdbDatasource.js

@@ -203,7 +203,7 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) {
       else {
       else {
         var self = this;
         var self = this;
         return this._influxRequest('POST', '/series', data).then(function() {
         return this._influxRequest('POST', '/series', data).then(function() {
-          self._removeUnslugifiedDashboard(title, false);
+          self._removeUnslugifiedDashboard(id, title, false);
           return { title: title, url: '/dashboard/db/' + id };
           return { title: title, url: '/dashboard/db/' + id };
         }, function(err) {
         }, function(err) {
           throw 'Failed to save dashboard to InfluxDB: ' + err.data;
           throw 'Failed to save dashboard to InfluxDB: ' + err.data;
@@ -211,7 +211,9 @@ function (angular, _, kbn, InfluxSeries, InfluxQueryBuilder) {
       }
       }
     };
     };
 
 
-    InfluxDatasource.prototype._removeUnslugifiedDashboard = function(id, isTemp) {
+    InfluxDatasource.prototype._removeUnslugifiedDashboard = function(id, title, isTemp) {
+      if (id === title) { return; }
+
       var self = this;
       var self = this;
       self._getDashboardInternal(id, isTemp).then(function(dashboard) {
       self._getDashboardInternal(id, isTemp).then(function(dashboard) {
         if (dashboard !== null) {
         if (dashboard !== null) {