Преглед изворни кода

notify dashboard migration fail

Mitsuhiro Tanda пре 9 година
родитељ
комит
44b2a292eb
1 измењених фајлова са 10 додато и 5 уклоњено
  1. 10 5
      public/app/features/dashboard/dashboard_ctrl.ts

+ 10 - 5
public/app/features/dashboard/dashboard_ctrl.ts

@@ -21,6 +21,7 @@ export class DashboardCtrl {
     dynamicDashboardSrv,
     dashboardViewStateSrv,
     contextSrv,
+    alertSrv,
     $timeout) {
 
       $scope.editor = { index: 0 };
@@ -29,11 +30,15 @@ export class DashboardCtrl {
       var resizeEventTimeout;
 
       $scope.setupDashboard = function(data) {
-        var dashboard = dashboardSrv.create(data.dashboard, data.meta);
-        dashboardSrv.setCurrent(dashboard);
-
-        // init services
-        timeSrv.init(dashboard);
+        try {
+          var dashboard = dashboardSrv.create(data.dashboard, data.meta);
+          dashboardSrv.setCurrent(dashboard);
+
+          // init services
+          timeSrv.init(dashboard);
+        } catch (err) {
+          $scope.appEvent("alert-error", ['Dashboard init failed', err.message]);
+        }
 
         // template values service needs to initialize completely before
         // the rest of the dashboard can load