From acc36d85dcea55666e0f1a20c75879f00a9d4cba Mon Sep 17 00:00:00 2001 From: zx chen <346839943@qq.com> Date: Thu, 18 Aug 2016 17:51:13 +0800 Subject: [PATCH] KYLIN-1488-web-modify-model-issue --- webapp/app/js/controllers/models.js | 21 +++++++++++++++++++++ webapp/app/partials/models/models_tree.html | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/webapp/app/js/controllers/models.js b/webapp/app/js/controllers/models.js index cbf063c..6fe2598 100644 --- a/webapp/app/js/controllers/models.js +++ b/webapp/app/js/controllers/models.js @@ -127,6 +127,27 @@ KylinApp.controller('ModelsCtrl', function ($scope, $q, $routeParams, $location, }); }; + $scope.editModel = function(model){ + var cubename = []; + var modelstate=false; + var i=0; + if (model.cubes.length != 0) { + angular.forEach(model.cubes,function(cube){ + if (cube.status=="READY"){ + modelstate=true; + cubename[i] =cube.name; + i++; + } + }) + } + if(modelstate==false){ + $location.path("/models/edit/"+model.name); + } + else{ + SweetAlert.swal('Sorry','This model is still used by '+ cubename.join(',')); + } + }; + $scope.cloneModel = function(model){ $modal.open({ templateUrl: 'modelClone.html', diff --git a/webapp/app/partials/models/models_tree.html b/webapp/app/partials/models/models_tree.html index 447a507..530139e 100644 --- a/webapp/app/partials/models/models_tree.html +++ b/webapp/app/partials/models/models_tree.html @@ -47,7 +47,7 @@