Commit 30ad784d by Torkel Ödegaard

Changed dashboard urls from /dashboard/elasticsearch/<title> to…

Changed dashboard urls from /dashboard/elasticsearch/<title> to dashboard/db/<title>, old urls will still work
parent 7be7b07c
...@@ -41,7 +41,7 @@ function (angular, _, config, $) { ...@@ -41,7 +41,7 @@ function (angular, _, config, $) {
var selectedDash = $scope.results.dashboards[$scope.selectedIndex]; var selectedDash = $scope.results.dashboards[$scope.selectedIndex];
if (selectedDash) { if (selectedDash) {
$location.path("/dashboard/elasticsearch/" + selectedDash.id); $location.path("/dashboard/db/" + selectedDash.id);
setTimeout(function() { setTimeout(function() {
$('body').click(); // hack to force dropdown to close; $('body').click(); // hack to force dropdown to close;
}); });
...@@ -54,7 +54,7 @@ function (angular, _, config, $) { ...@@ -54,7 +54,7 @@ function (angular, _, config, $) {
$scope.share = { $scope.share = {
title: title, title: title,
url: baseUrl + '#dashboard/elasticsearch/' + encodeURIComponent(id) url: baseUrl + '#dashboard/db/' + encodeURIComponent(id)
}; };
}; };
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
ng-class="{'selected': $index === selectedIndex }"> ng-class="{'selected': $index === selectedIndex }">
<td><a ng-click="deleteDashboard(row.id)"><i class="icon-remove"></i></a></td> <td><a ng-click="deleteDashboard(row.id)"><i class="icon-remove"></i></a></td>
<td style="width:100%"> <td style="width:100%">
<a href="#/dashboard/elasticsearch/{{row.id}}" bo-text="row.id"></a> <a href="#/dashboard/db/{{row.id}}" bo-text="row.id"></a>
</td> </td>
<td style="white-space: nowrap; text-align: right;"> <td style="white-space: nowrap; text-align: right;">
<a ng-click="filterByTag(tag, $event)" ng-repeat="tag in row.tags" style="margin-right: 5px;" class="label label-tag"> <a ng-click="filterByTag(tag, $event)" ng-repeat="tag in row.tags" style="margin-right: 5px;" class="label label-tag">
......
define([ define([
'./dashboard-from-es', './dashboard-from-db',
'./dashboard-from-file', './dashboard-from-file',
'./dashboard-from-script', './dashboard-from-script',
'./dashboard-default', './dashboard-default',
], ],
function () {}); function () {});
\ No newline at end of file
...@@ -8,17 +8,21 @@ function (angular) { ...@@ -8,17 +8,21 @@ function (angular) {
module.config(function($routeProvider) { module.config(function($routeProvider) {
$routeProvider $routeProvider
.when('/dashboard/db/:id', {
templateUrl: 'app/partials/dashboard.html',
controller : 'DashFromDBProvider',
})
.when('/dashboard/elasticsearch/:id', { .when('/dashboard/elasticsearch/:id', {
templateUrl: 'app/partials/dashboard.html', templateUrl: 'app/partials/dashboard.html',
controller : 'DashFromElasticProvider', controller : 'DashFromDBProvider',
}) })
.when('/dashboard/temp/:id', { .when('/dashboard/temp/:id', {
templateUrl: 'app/partials/dashboard.html', templateUrl: 'app/partials/dashboard.html',
controller : 'DashFromElasticProvider', controller : 'DashFromDBProvider',
}); });
}); });
module.controller('DashFromElasticProvider', function($scope, $rootScope, datasourceSrv, $routeParams, alertSrv) { module.controller('DashFromDBProvider', function($scope, $rootScope, datasourceSrv, $routeParams, alertSrv) {
var db = datasourceSrv.getGrafanaDB(); var db = datasourceSrv.getGrafanaDB();
db.getDashboard($routeParams.id) db.getDashboard($routeParams.id)
......
...@@ -141,7 +141,7 @@ function (angular, _, $, config, kbn, moment) { ...@@ -141,7 +141,7 @@ function (angular, _, $, config, kbn, moment) {
return this._request('PUT', '/dashboard/' + encodeURIComponent(title), this.index, data) return this._request('PUT', '/dashboard/' + encodeURIComponent(title), this.index, data)
.then(function() { .then(function() {
return { title: title, url: '/dashboard/elasticsearch/' + title }; return { title: title, url: '/dashboard/db/' + title };
}, function(err) { }, function(err) {
throw 'Failed to save to elasticsearch ' + err.data; throw 'Failed to save to elasticsearch ' + err.data;
}); });
......
...@@ -243,7 +243,7 @@ function (angular, _, kbn, InfluxSeries) { ...@@ -243,7 +243,7 @@ function (angular, _, kbn, InfluxSeries) {
}]; }];
return this._influxRequest('POST', '/series', data).then(function() { return this._influxRequest('POST', '/series', data).then(function() {
return { title: title, url: '/dashboard/elasticsearch/' + title }; return { title: title, url: '/dashboard/db/' + title };
}, function(err) { }, function(err) {
throw 'Failed to save dashboard to InfluxDB: ' + err.data; throw 'Failed to save dashboard to InfluxDB: ' + err.data;
}); });
......
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