Просмотр исходного кода

Fixed panel error handling issue

Torkel Ödegaard 10 лет назад
Родитель
Сommit
5be5ee9b1b
3 измененных файлов с 6 добавлено и 11 удалено
  1. 3 8
      src/app/features/panel/panelSrv.js
  2. 2 2
      src/app/panels/graph/module.js
  3. 1 1
      src/css/less/sidemenu.less

+ 3 - 8
src/app/features/panel/panelSrv.js

@@ -104,14 +104,9 @@ function (angular, _, config) {
 
 
         $scope.getCurrentDatasource().then(function(datasource) {
         $scope.getCurrentDatasource().then(function(datasource) {
           $scope.datasource = datasource;
           $scope.datasource = datasource;
-
-          var promise = $scope.refreshData($scope.datasource);
-          if (promise) {
-            promise.then(function() { $scope.panelMeta.loading = false; });
-          } else {
-            $scope.panelMeta.loading = false;
-          }
-
+          return $scope.refreshData($scope.datasource) || $q.when({});
+        }).then(function() {
+          $scope.panelMeta.loading = false;
         }, function(err) {
         }, function(err) {
           console.log('Panel data error:', err);
           console.log('Panel data error:', err);
           $scope.panelMeta.loading = false;
           $scope.panelMeta.loading = false;

+ 2 - 2
src/app/panels/graph/module.js

@@ -129,10 +129,10 @@ function (angular, app, $, _, kbn, moment, TimeSeries, PanelMeta) {
       $scope.annotationsPromise = annotationsSrv.getAnnotations($scope.rangeUnparsed, $scope.dashboard);
       $scope.annotationsPromise = annotationsSrv.getAnnotations($scope.rangeUnparsed, $scope.dashboard);
 
 
       return panelHelper.issueMetricQuery($scope, datasource)
       return panelHelper.issueMetricQuery($scope, datasource)
-        .then($scope.dataHandler)
-        .then(null, function() {
+        .then($scope.dataHandler, function(err) {
           $scope.seriesList = [];
           $scope.seriesList = [];
           $scope.render([]);
           $scope.render([]);
+          throw err;
         });
         });
     };
     };
 
 

+ 1 - 1
src/css/less/sidemenu.less

@@ -116,7 +116,7 @@
     opacity: .7;
     opacity: .7;
     position: relative;
     position: relative;
     left: 7px;
     left: 7px;
-    top: 3px;
+    top: 5px;
     font-size: 150%;
     font-size: 150%;
   }
   }
 }
 }