浏览代码

dashfolders: Do not allow loading a folder as a dashboard

Marcus Efraimsson 8 年之前
父节点
当前提交
47014ddb65
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      public/app/features/dashboard/dashboardLoaderSrv.js

+ 7 - 0
public/app/features/dashboard/dashboardLoaderSrv.js

@@ -43,6 +43,13 @@ function (angular, moment, _, $, kbn, dateMath, impressionSrv) {
           });
           });
       } else {
       } else {
         promise = backendSrv.getDashboard($routeParams.type, $routeParams.slug)
         promise = backendSrv.getDashboard($routeParams.type, $routeParams.slug)
+          .then(result => {
+            if (result.meta.isFolder) {
+              $rootScope.appEvent("alert-error", ['Dashboard not found']);
+              throw new Error("Dashboard not found");
+            }
+            return result;
+          })
           .catch(function() {
           .catch(function() {
             return self._dashboardLoadFailed("Not found");
             return self._dashboardLoadFailed("Not found");
           });
           });