Renamed dashboard service to dashboardModel, fixed saving default dashboard feature
This commit is contained in:
@@ -23,7 +23,6 @@ define([
|
||||
'config',
|
||||
'underscore',
|
||||
'services/all',
|
||||
'services/dashboard/all'
|
||||
],
|
||||
function (angular, $, config, _) {
|
||||
"use strict";
|
||||
@@ -119,12 +118,6 @@ function (angular, $, config, _) {
|
||||
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 = [
|
||||
"#7EB26D","#EAB839","#6ED0E0","#EF843C","#E24D42","#1F78C1","#BA43A9","#705DA0", //1
|
||||
"#508642","#CCA300","#447EBC","#C15C17","#890F02","#0A437C","#6D1F62","#584477", //2
|
||||
|
||||
@@ -48,20 +48,13 @@ function (angular, _, moment) {
|
||||
};
|
||||
|
||||
$scope.set_default = function() {
|
||||
if($scope.dashboard.set_default($location.path())) {
|
||||
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);
|
||||
}
|
||||
window.localStorage.grafanaDashboardDefault = $location.path();
|
||||
alertSrv.set('Home Set','This page has been set as your default dashboard','success',5000);
|
||||
};
|
||||
|
||||
$scope.purge_default = function() {
|
||||
if($scope.dashboard.purge_default()) {
|
||||
alertSrv.set('Local Default Clear','Your default dashboard has been reset to the default',
|
||||
'success',5000);
|
||||
} else {
|
||||
alertSrv.set('Incompatible Browser','Sorry, your browser is too old for this feature','error',5000);
|
||||
}
|
||||
delete window.localStorage.grafanaDashboardDefault;
|
||||
alertSrv.set('Local Default Clear','Your default dashboard has been reset to the default','success', 5000);
|
||||
};
|
||||
|
||||
$scope.saveForSharing = function() {
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
</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>
|
||||
|
||||
|
||||
@@ -14,6 +14,16 @@ function (angular, $, config, _) {
|
||||
.when('/dashboard/file/:jsonFile', {
|
||||
templateUrl: 'app/partials/dashboard.html',
|
||||
controller : 'DashFromFileProvider',
|
||||
})
|
||||
.when('/', {
|
||||
redirectTo: function() {
|
||||
if (window.localStorage && window.localStorage.grafanaDashboardDefault) {
|
||||
return window.localStorage.grafanaDashboardDefault;
|
||||
}
|
||||
else {
|
||||
return config.default_route;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
define([
|
||||
'./alertSrv',
|
||||
'./dashboard',
|
||||
'./datasourceSrv',
|
||||
'./filterSrv',
|
||||
'./timer',
|
||||
@@ -10,5 +9,7 @@ define([
|
||||
'./playlistSrv',
|
||||
'./unsavedChangesSrv',
|
||||
'./elasticsearch/es-client',
|
||||
'./dashboard/dashboardKeyBindings',
|
||||
'./dashboard/dashboardModel',
|
||||
],
|
||||
function () {});
|
||||
@@ -1,4 +0,0 @@
|
||||
define([
|
||||
'./dashboardKeyBindings',
|
||||
],
|
||||
function () {});
|
||||
@@ -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 {
|
||||
create: function(dashboard) {
|
||||
return new DashboardModel(dashboard);
|
||||
Reference in New Issue
Block a user