Procházet zdrojové kódy

style changing now works again

Torkel Ödegaard před 11 roky
rodič
revize
186f753aec

+ 2 - 0
src/app/controllers/dash.js

@@ -45,6 +45,8 @@ function (angular, $, config, _) {
       $rootScope.fullscreen = false;
 
       $scope.dashboard = dashboard.create(dashboardData);
+      $scope.grafana.style = $scope.dashboard.style;
+
       $scope.filter = filterSrv;
       $scope.filter.init($scope.dashboard);
 

+ 5 - 1
src/app/controllers/dashLoader.js

@@ -17,7 +17,7 @@ function (angular, _, moment) {
       $scope.elasticsearch = $scope.elasticsearch || {};
 
       $scope.onAppEvent('save-dashboard', function() {
-        $scope.elasticsearch_save('dashboard', false);
+        $scope.saveDashboard();
       });
 
       $scope.onAppEvent('zoom-out', function() {
@@ -142,6 +142,10 @@ function (angular, _, moment) {
       });
     };
 
+    $scope.styleUpdated = function() {
+      $scope.grafana.style = $scope.dashboard.style;
+    };
+
     $scope.openSaveDropdown = function() {
       $scope.isFavorite = playlistSrv.isCurrentFavorite($scope.dashboard);
     };

+ 3 - 0
src/app/controllers/grafanaCtrl.js

@@ -15,6 +15,9 @@ function (angular, config, _) {
     $scope.init = function() {
       $scope._ = _;
       $scope.dashAlerts = alertSrv;
+      $scope.grafana = {
+        style: 'dark'
+      };
     };
 
     $rootScope.onAppEvent = function(name, callback) {

+ 1 - 1
src/app/partials/dasheditor.html

@@ -15,7 +15,7 @@
           <label class="small">Title</label><input type="text" class="input-large" ng-model='dashboard.title'></input>
         </div>
         <div class="editor-option">
-          <label class="small">Style</label><select class="input-small" ng-model="dashboard.style" ng-options="f for f in ['dark','light']"></select>
+          <label class="small">Theme</label><select class="input-small" ng-model="dashboard.style" ng-options="f for f in ['dark','light']" ng-change="styleUpdated()"></select>
         </div>
         <div class="editor-option">
           <label class="small">Time correction</label>

+ 1 - 1
src/index.html

@@ -20,7 +20,7 @@
 
   <body ng-cloak ng-controller="GrafanaCtrl">
 
-    <link rel="stylesheet" href="css/bootstrap.light.min.css" ng-if="dashboard.style === 'light'">
+    <link rel="stylesheet" href="css/bootstrap.light.min.css" ng-if="grafana.style === 'light'">
     <link rel="stylesheet" href="css/bootstrap-responsive.min.css">
     <link rel="stylesheet" href="css/font-awesome.min.css">