From a97bcc3ca793c7c2bc6d06840f024156ba6e4942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 19 Sep 2014 10:37:28 +0200 Subject: [PATCH] Elasticsearch: fix for issue when saving dashboard with title equal to slugified url, would cause the backward compatible fix to delete it, Closes #828 --- CHANGELOG.md | 1 + src/app/services/elasticsearch/es-datasource.js | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b525a62999..b7d233c8237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - [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 #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) diff --git a/src/app/services/elasticsearch/es-datasource.js b/src/app/services/elasticsearch/es-datasource.js index 4f69df61f17..ab03c614a83 100644 --- a/src/app/services/elasticsearch/es-datasource.js +++ b/src/app/services/elasticsearch/es-datasource.js @@ -169,7 +169,7 @@ function (angular, _, config, kbn, moment) { return this._request('PUT', '/dashboard/' + id, this.index, data) .then(function(results) { - self._removeUnslugifiedDashboard(results, title); + self._removeUnslugifiedDashboard(results, title, id); return { title: title, url: '/dashboard/db/' + id }; }, function() { throw 'Failed to save to elasticsearch'; @@ -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 (title === id) { return; } var self = this; this._get('/dashboard/' + title).then(function() {