Commit a97bcc3c by Torkel Ödegaard

Elasticsearch: fix for issue when saving dashboard with title equal to slugified…

Elasticsearch: fix for issue when saving dashboard with title equal to slugified url, would cause the backward compatible fix to delete it, Closes #828
parent fa31fc04
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
- [Issue #802](https://github.com/grafana/grafana/issues/802). Annotations: Fix when using InfluxDB datasource - [Issue #802](https://github.com/grafana/grafana/issues/802). Annotations: Fix when using InfluxDB datasource
- [Issue #795](https://github.com/grafana/grafana/issues/795). Chrome: Fix for display issue in chrome beta & chrome canary when entering edit mode - [Issue #795](https://github.com/grafana/grafana/issues/795). Chrome: Fix for display issue in chrome beta & chrome canary when entering edit mode
- [Issue #818](https://github.com/grafana/grafana/issues/818). Graph: Added percent y-axis format - [Issue #818](https://github.com/grafana/grafana/issues/818). Graph: Added percent y-axis format
- [Issue #828](https://github.com/grafana/grafana/issues/828). Elasticsearch: saving new dashboard with title equal to slugified url would cause it to deleted.
# 1.8.0-RC1 (2014-09-12) # 1.8.0-RC1 (2014-09-12)
......
...@@ -169,7 +169,7 @@ function (angular, _, config, kbn, moment) { ...@@ -169,7 +169,7 @@ function (angular, _, config, kbn, moment) {
return this._request('PUT', '/dashboard/' + id, this.index, data) return this._request('PUT', '/dashboard/' + id, this.index, data)
.then(function(results) { .then(function(results) {
self._removeUnslugifiedDashboard(results, title); self._removeUnslugifiedDashboard(results, title, id);
return { title: title, url: '/dashboard/db/' + id }; return { title: title, url: '/dashboard/db/' + id };
}, function() { }, function() {
throw 'Failed to save to elasticsearch'; throw 'Failed to save to elasticsearch';
...@@ -177,8 +177,9 @@ function (angular, _, config, kbn, moment) { ...@@ -177,8 +177,9 @@ function (angular, _, config, kbn, moment) {
} }
}; };
ElasticDatasource.prototype._removeUnslugifiedDashboard = function(saveResult, title) { ElasticDatasource.prototype._removeUnslugifiedDashboard = function(saveResult, title, id) {
if (saveResult.statusText !== 'Created') { return; } if (saveResult.statusText !== 'Created') { return; }
if (title === id) { return; }
var self = this; var self = this;
this._get('/dashboard/' + title).then(function() { this._get('/dashboard/' + title).then(function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment