You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ka...@apache.org on 2017/02/09 07:57:49 UTC

kylin git commit: KYLIN-2308 bug fix and improve user experience

Repository: kylin
Updated Branches:
  refs/heads/master 7742b31d8 -> 1e9f0908b


KYLIN-2308 bug fix and improve user experience


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

Branch: refs/heads/master
Commit: 1e9f0908b9942113bbd251dc5eeba71973cc77e1
Parents: 7742b31
Author: kangkaisen <ka...@163.com>
Authored: Thu Feb 9 12:06:56 2017 +0800
Committer: kangkaisen <ka...@163.com>
Committed: Thu Feb 9 15:54:01 2017 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/cubeAdvanceSetting.js | 36 ++++++++++++++++++--
 webapp/app/js/controllers/cubeSchema.js         |  8 +++++
 .../cubeDesigner/advanced_settings.html         |  2 +-
 3 files changed, 43 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/1e9f0908/webapp/app/js/controllers/cubeAdvanceSetting.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeAdvanceSetting.js b/webapp/app/js/controllers/cubeAdvanceSetting.js
index 39d36b0..7cdb1cd 100644
--- a/webapp/app/js/controllers/cubeAdvanceSetting.js
+++ b/webapp/app/js/controllers/cubeAdvanceSetting.js
@@ -342,12 +342,44 @@ KylinApp.controller('CubeAdvanceSettingCtrl', function ($scope, $modal,cubeConfi
     return assignedMeasures;
   };
 
-  if ($scope.getAllMeasureNames().length != $scope.getAssignedMeasureNames().length) {
+  $scope.rmDeprecatedMeasureNames = function () {
+    var allMeasureNames = $scope.getAllMeasureNames();
+    var tmpColumnFamily = $scope.cubeMetaFrame.hbase_mapping.column_family;
+
+    angular.forEach($scope.cubeMetaFrame.hbase_mapping.column_family, function (colFamily,index1) {
+      angular.forEach(colFamily.columns[0].measure_refs, function (measureName, index2) {
+        var allIndex = allMeasureNames.indexOf(measureName);
+        if (allIndex == -1) {
+          tmpColumnFamily[index1].columns[0].measure_refs.splice(index2, 1);
+        }
+
+        if (tmpColumnFamily[index1].columns[0].measure_refs == 0) {
+          tmpColumnFamily.splice(index1, 1);
+        }
+      });
+    });
+
+    $scope.cubeMetaFrame.hbase_mapping.column_family = tmpColumnFamily;
+  };
+
+  if ($scope.getAssignedMeasureNames().length == 0) {
     $scope.initColumnFamily();
+  } else {
+    $scope.rmDeprecatedMeasureNames();
+    if ($scope.getAllMeasureNames().length > $scope.getAssignedMeasureNames().length) {
+      $scope.initColumnFamily();
+    }
   }
 
-
   $scope.addColumnFamily = function () {
+    var isCFEmpty = _.some($scope.cubeMetaFrame.hbase_mapping.column_family, function(colFamily) {
+      return colFamily.columns[0].measure_refs.length == 0;
+    });
+
+    if (isCFEmpty === true) {
+      return;
+    }
+
     var colFamily = $scope.newColFamily($scope.cubeMetaFrame.hbase_mapping.column_family.length + 1);
     $scope.cubeMetaFrame.hbase_mapping.column_family.push(colFamily);
   };

http://git-wip-us.apache.org/repos/asf/kylin/blob/1e9f0908/webapp/app/js/controllers/cubeSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeSchema.js b/webapp/app/js/controllers/cubeSchema.js
index 17371f2..4beeebe 100755
--- a/webapp/app/js/controllers/cubeSchema.js
+++ b/webapp/app/js/controllers/cubeSchema.js
@@ -287,6 +287,14 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
           errors.push("All measures need to be assigned to column family");
         }
 
+        var isCFEmpty = _.some($scope.cubeMetaFrame.hbase_mapping.column_family, function(colFamily) {
+          return colFamily.columns[0].measure_refs.length == 0;
+        });
+
+        if (isCFEmpty == true) {
+          errors.push("Each column family can't not be empty");
+        }
+
 
         var errorInfo = "";
         angular.forEach(errors,function(item){

http://git-wip-us.apache.org/repos/asf/kylin/blob/1e9f0908/webapp/app/partials/cubeDesigner/advanced_settings.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/advanced_settings.html b/webapp/app/partials/cubeDesigner/advanced_settings.html
index bf95256..f26722b 100755
--- a/webapp/app/partials/cubeDesigner/advanced_settings.html
+++ b/webapp/app/partials/cubeDesigner/advanced_settings.html
@@ -453,7 +453,7 @@
 
                      <td class="col-xs-1">
                        <!--Remove Button -->
-                       <button class="btn btn-xs btn-info" ng-click="removeElement(cubeMetaFrame.hbase_mapping.column_family, colFamily)">
+                       <button ng-if="colFamily.columns[0].measure_refs.length == 0" class="btn btn-xs btn-info" ng-click="removeElement(cubeMetaFrame.hbase_mapping.column_family, colFamily)">
                          <i class="fa fa-minus"></i>
                        </button>
                      </td>