Commit 7dc4484f by Torkel Ödegaard

Renamed dashboard service to dashboardModel, fixed saving default dashboard feature

parent 257ea391
...@@ -23,7 +23,6 @@ define([ ...@@ -23,7 +23,6 @@ define([
'config', 'config',
'underscore', 'underscore',
'services/all', 'services/all',
'services/dashboard/all'
], ],
function (angular, $, config, _) { function (angular, $, config, _) {
"use strict"; "use strict";
...@@ -119,12 +118,6 @@ function (angular, $, config, _) { ...@@ -119,12 +118,6 @@ function (angular, $, config, _) {
return $scope.editorTabs; return $scope.editorTabs;
}; };
// This is whoafully incomplete, but will do for now
$scope.parse_error = function(data) {
var _error = data.match("nested: (.*?);");
return _.isNull(_error) ? data : _error[1];
};
$scope.colors = [ $scope.colors = [
"#7EB26D","#EAB839","#6ED0E0","#EF843C","#E24D42","#1F78C1","#BA43A9","#705DA0", //1 "#7EB26D","#EAB839","#6ED0E0","#EF843C","#E24D42","#1F78C1","#BA43A9","#705DA0", //1
"#508642","#CCA300","#447EBC","#C15C17","#890F02","#0A437C","#6D1F62","#584477", //2 "#508642","#CCA300","#447EBC","#C15C17","#890F02","#0A437C","#6D1F62","#584477", //2
......
...@@ -48,20 +48,13 @@ function (angular, _, moment) { ...@@ -48,20 +48,13 @@ function (angular, _, moment) {
}; };
$scope.set_default = function() { $scope.set_default = function() {
if($scope.dashboard.set_default($location.path())) { window.localStorage.grafanaDashboardDefault = $location.path();
alertSrv.set('Home Set','This page has been set as your default dashboard','success',5000); alertSrv.set('Home Set','This page has been set as your default dashboard','success',5000);
} else {
alertSrv.set('Incompatible Browser','Sorry, your browser is too old for this feature','error',5000);
}
}; };
$scope.purge_default = function() { $scope.purge_default = function() {
if($scope.dashboard.purge_default()) { delete window.localStorage.grafanaDashboardDefault;
alertSrv.set('Local Default Clear','Your default dashboard has been reset to the default', alertSrv.set('Local Default Clear','Your default dashboard has been reset to the default','success', 5000);
'success',5000);
} else {
alertSrv.set('Incompatible Browser','Sorry, your browser is too old for this feature','error',5000);
}
}; };
$scope.saveForSharing = function() { $scope.saveForSharing = function() {
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
</li> </li>
<li class="grafana-menu-home"><a bs-tooltip="'Goto saved default'" data-placement="bottom" href='#/dashboard'><i class='icon-home'></i></a></li> <li class="grafana-menu-home"><a bs-tooltip="'Goto saved default'" data-placement="bottom" href='#/'><i class='icon-home'></i></a></li>
<li class="grafana-menu-edit" ng-show="dashboard.editable" bs-tooltip="'Configure dashboard'" data-placement="bottom"><a class="link" config-modal="app/partials/dasheditor.html"><i class='icon-cog pointer'></i></a></li> <li class="grafana-menu-edit" ng-show="dashboard.editable" bs-tooltip="'Configure dashboard'" data-placement="bottom"><a class="link" config-modal="app/partials/dasheditor.html"><i class='icon-cog pointer'></i></a></li>
......
...@@ -14,6 +14,16 @@ function (angular, $, config, _) { ...@@ -14,6 +14,16 @@ function (angular, $, config, _) {
.when('/dashboard/file/:jsonFile', { .when('/dashboard/file/:jsonFile', {
templateUrl: 'app/partials/dashboard.html', templateUrl: 'app/partials/dashboard.html',
controller : 'DashFromFileProvider', controller : 'DashFromFileProvider',
})
.when('/', {
redirectTo: function() {
if (window.localStorage && window.localStorage.grafanaDashboardDefault) {
return window.localStorage.grafanaDashboardDefault;
}
else {
return config.default_route;
}
}
}); });
}); });
......
define([ define([
'./alertSrv', './alertSrv',
'./dashboard',
'./datasourceSrv', './datasourceSrv',
'./filterSrv', './filterSrv',
'./timer', './timer',
...@@ -10,5 +9,7 @@ define([ ...@@ -10,5 +9,7 @@ define([
'./playlistSrv', './playlistSrv',
'./unsavedChangesSrv', './unsavedChangesSrv',
'./elasticsearch/es-client', './elasticsearch/es-client',
'./dashboard/dashboardKeyBindings',
'./dashboard/dashboardModel',
], ],
function () {}); function () {});
\ No newline at end of file
define([
'./dashboardKeyBindings',
],
function () {});
...@@ -90,10 +90,6 @@ function (angular, $, kbn, _) { ...@@ -90,10 +90,6 @@ function (angular, $, kbn, _) {
} }
}; };
// An elasticJS client to use
/*var ejs = ejsResource(config.elasticsearch, config.elasticsearchBasicAuth);
var gist_pattern = /(^\d{5,}$)|(^[a-z0-9]{10,}$)|(gist.github.com(\/*.*)\/[a-z0-9]{5,}\/*$)/;
*/
return { return {
create: function(dashboard) { create: function(dashboard) {
return new DashboardModel(dashboard); return new DashboardModel(dashboard);
......
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