From 9c14151f68c9b5a6ff845be839ff25c7ebea654c Mon Sep 17 00:00:00 2001 From: Xie Date: Thu, 16 Jun 2016 10:21:36 +0800 Subject: [PATCH] disable model edit function when it be used by some cubes --- webapp/app/js/controllers/cube.js | 3 +++ webapp/app/js/controllers/models.js | 12 +++++++++++- webapp/app/less/component.less | 5 ++++- webapp/app/partials/cubes/cube_detail.html | 2 +- webapp/app/partials/models/models_tree.html | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/webapp/app/js/controllers/cube.js b/webapp/app/js/controllers/cube.js index 57b53e7..f74aac0 100755 --- a/webapp/app/js/controllers/cube.js +++ b/webapp/app/js/controllers/cube.js @@ -92,6 +92,9 @@ KylinApp.controller('CubeCtrl', function ($scope, AccessService, MessageService, var totalSize = 0; hbase.forEach(function(t) { totalSize += t.tableSize; + if (t.regionCount == 0) { + $scope.regionCount = 'zeroCount'; + } }); cube.totalSize = totalSize; },function(e){ diff --git a/webapp/app/js/controllers/models.js b/webapp/app/js/controllers/models.js index cbf063c..7a1c63c 100644 --- a/webapp/app/js/controllers/models.js +++ b/webapp/app/js/controllers/models.js @@ -126,7 +126,17 @@ KylinApp.controller('ModelsCtrl', function ($scope, $q, $routeParams, $location, }); }; - + var cubename = []; + $scope.editModel = function(model){ + if (model.cubes.length == 0) { + $location.path("/models/edit/"+model.name); + }else{ + for(var i = 0; i < model.cubes.length; i++){ + cubename[i] = model.cubes[i].name; + } + SweetAlert.swal('sorry','this is model still be used by '+ cubename.join(',')); + } + }; $scope.cloneModel = function(model){ $modal.open({ templateUrl: 'modelClone.html', diff --git a/webapp/app/less/component.less b/webapp/app/less/component.less index 929006f..28dfff2 100644 --- a/webapp/app/less/component.less +++ b/webapp/app/less/component.less @@ -25,7 +25,10 @@ .dataTables_wrapper>.row { margin: 0!important; } - +.zeroCount{ + outline:2px dashed red; + width:40%; +} /** utilities **/ .dark { color: #333333 !important; diff --git a/webapp/app/partials/cubes/cube_detail.html b/webapp/app/partials/cubes/cube_detail.html index 38802ef..557dddc 100755 --- a/webapp/app/partials/cubes/cube_detail.html +++ b/webapp/app/partials/cubes/cube_detail.html @@ -95,7 +95,7 @@
-
+
HTable: {{table.tableName}}
  • Region Count: {{table.regionCount}}
  • diff --git a/webapp/app/partials/models/models_tree.html b/webapp/app/partials/models/models_tree.html index 447a507..809cff5 100644 --- a/webapp/app/partials/models/models_tree.html +++ b/webapp/app/partials/models/models_tree.html @@ -47,7 +47,7 @@
  • -- 2.8.3.windows.1