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

Fixes to text panel, and alert related to angularjs upgrade

Torkel Ödegaard 11 лет назад
Родитель
Сommit
e75debbf81
2 измененных файлов с 9 добавлено и 7 удалено
  1. 6 4
      src/app/panels/text/module.js
  2. 3 3
      src/app/services/alertSrv.js

+ 6 - 4
src/app/panels/text/module.js

@@ -82,11 +82,13 @@ function (angular, app, _, require) {
     $scope.updateContent = function(html) {
     $scope.updateContent = function(html) {
       try {
       try {
         $scope.content = $sce.trustAsHtml(filterSrv.applyTemplateToTarget(html));
         $scope.content = $sce.trustAsHtml(filterSrv.applyTemplateToTarget(html));
-
-        if(!$scope.$$phase) {
-          $scope.$apply();
-        }
       } catch(e) {
       } catch(e) {
+        console.log('Text panel error: ', e);
+        $scope.content = $sce.trustAsHtml(html);
+      }
+
+      if(!$scope.$$phase) {
+        $scope.$apply();
       }
       }
     };
     };
 
 

+ 3 - 3
src/app/services/alertSrv.js

@@ -7,7 +7,7 @@ function (angular, _) {
 
 
   var module = angular.module('grafana.services');
   var module = angular.module('grafana.services');
 
 
-  module.service('alertSrv', function($timeout) {
+  module.service('alertSrv', function($timeout, $sce) {
     var self = this;
     var self = this;
 
 
     // List of all alert objects
     // List of all alert objects
@@ -17,7 +17,7 @@ function (angular, _) {
       var
       var
         _a = {
         _a = {
           title: title || '',
           title: title || '',
-          text: text || '',
+          text: $sce.trustAsHtml(text || ''),
           severity: severity || 'info',
           severity: severity || 'info',
         },
         },
         _ca = angular.toJson(_a),
         _ca = angular.toJson(_a),
@@ -46,4 +46,4 @@ function (angular, _) {
       self.list = [];
       self.list = [];
     };
     };
   });
   });
-});
+});