You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by zh...@apache.org on 2016/08/19 07:07:46 UTC

kylin git commit: KYLIN-1488-web-modify-model-issue

Repository: kylin
Updated Branches:
  refs/heads/master 35de3fdc9 -> a4ad980c1


KYLIN-1488-web-modify-model-issue

Signed-off-by: Jason <ji...@163.com>


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/a4ad980c
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/a4ad980c
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/a4ad980c

Branch: refs/heads/master
Commit: a4ad980c11761007142dd9ef5f70d5103021d598
Parents: 35de3fd
Author: zx chen <34...@qq.com>
Authored: Thu Aug 18 17:51:13 2016 +0800
Committer: Jason <ji...@163.com>
Committed: Fri Aug 19 15:06:22 2016 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/models.js         | 21 +++++++++++++++++++++
 webapp/app/partials/models/models_tree.html |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/a4ad980c/webapp/app/js/controllers/models.js
----------------------------------------------------------------------
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',

http://git-wip-us.apache.org/repos/asf/kylin/blob/a4ad980c/webapp/app/partials/models/models_tree.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 @@
           <li class="list-group-item" ng-repeat="model in modelsManager.models">
 
             <div class="pull-right" showonhoverparent style="display:none;">
-              <a href="models/edit/{{model.name}}" data-placement="bottom" title="Edit Model" ng-if="(userService.hasRole('ROLE_ADMIN') || hasPermission(model, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))"><span class="fa fa-pencil fa-lg fa-fw"></span></a>
+              <a ng-click="editModel(model)"  title="Edit Model" style="cursor:pointer;margin-right: 8px;" ng-if="(userService.hasRole('ROLE_ADMIN') || hasPermission(model, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))"><span class="fa fa-pencil fa-lg fa-fw"></span></a>
               <a ng-click="cloneModel(model)" title="Clone Model"  style="cursor:pointer;margin-right: 8px;" ng-if="(userService.hasRole('ROLE_ADMIN') || hasPermission(model, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))"><span class="fa fa-copy fa-lg fa-fw"></span></a>
               <a ng-click="dropModel(model)" title="Drop Model"  style="cursor:pointer;margin-right: 8px;" ng-if="(userService.hasRole('ROLE_ADMIN') || hasPermission(model, permissions.ADMINISTRATION.mask, permissions.MANAGEMENT.mask, permissions.OPERATION.mask))"><span class="fa fa-trash-o fa-lg fa-fw"></span></a>
             </div>