Repository: kylin
Updated Branches:
  refs/heads/master 92d2a9c5a -> 030a16ada


KYLIN-1541 UI support int encoding


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

Branch: refs/heads/master
Commit: 030a16ada0f7284ae3e9dcf4f9a4f26ac6fe83c2
Parents: 92d2a9c
Author: Jason <jiat...@163.com>
Authored: Wed Mar 30 15:47:39 2016 +0800
Committer: Jason <jiat...@163.com>
Committed: Wed Mar 30 16:05:00 2016 +0800

----------------------------------------------------------------------
 .../model/validation/rule/RowKeyAttrRule.java   |  1 +
 webapp/app/js/controllers/cubeAdvanceSetting.js | 37 +++++++++++------
 webapp/app/js/controllers/cubeEdit.js           | 10 +++++
 webapp/app/js/model/cubeConfig.js               |  3 +-
 webapp/app/js/services/cubes.js                 |  1 +
 .../cubeDesigner/advanced_settings.html         | 43 +++++++-------------
 6 files changed, 52 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/030a16ad/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/RowKeyAttrRule.java
----------------------------------------------------------------------
diff --git 
a/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/RowKeyAttrRule.java
 
b/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/RowKeyAttrRule.java
index 13138ba..df3cd40 100644
--- 
a/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/RowKeyAttrRule.java
+++ 
b/core-cube/src/main/java/org/apache/kylin/cube/model/validation/rule/RowKeyAttrRule.java
@@ -48,6 +48,7 @@ public class RowKeyAttrRule implements 
IValidatorRule<CubeDesc> {
             if (rd.getColumn() == null || rd.getColumn().length() == 0) {
                 context.addResult(ResultLevel.ERROR, "Rowkey column empty");
             }
+
         }
 
     }

http://git-wip-us.apache.org/repos/asf/kylin/blob/030a16ad/webapp/app/js/controllers/cubeAdvanceSetting.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeAdvanceSetting.js 
b/webapp/app/js/controllers/cubeAdvanceSetting.js
index 178df6d..189cab9 100644
--- a/webapp/app/js/controllers/cubeAdvanceSetting.js
+++ b/webapp/app/js/controllers/cubeAdvanceSetting.js
@@ -25,17 +25,23 @@ KylinApp.controller('CubeAdvanceSettingCtrl', function 
($scope, $modal,cubeConfi
   //rowkey
   $scope.convertedRowkeys = [];
   angular.forEach($scope.cubeMetaFrame.rowkey.rowkey_columns,function(item){
-    var _isDictionary = item.encoding === "dict"?"true":"false";
+    //var _isDictionary = item.encoding === "dict"?"true":"false";
     var _isFixedLength = item.encoding.substring(0,12) === 
"fixed_length"?"true":"false";//fixed_length:12
-    var _fixedLength ;
-    if(_isFixedLength){
-      _fixedLength = item.encoding.substring(13,item.encoding.length);
+    var _isIntLength = item.encoding.substring(0,3) === 
"int"?"true":"false";//fixed_length:12
+    var _encoding = "dict";
+    var _valueLength ;
+    if(_isFixedLength !=="false"){
+      _valueLength = item.encoding.substring(13,item.encoding.length);
+      _encoding = "fixed_length";
+    }
+    if(_isIntLength!="false"){
+      _valueLength = item.encoding.substring(4,item.encoding.length);
+      _encoding = "int";
     }
     var rowkeyObj = {
       column:item.column,
-      isDictionary:_isDictionary,
-      isFixedLength:_isFixedLength,
-      fixedLength:_fixedLength
+      encoding:_encoding,
+      valueLength:_valueLength
     }
 
     $scope.convertedRowkeys.push(rowkeyObj);
@@ -45,10 +51,15 @@ KylinApp.controller('CubeAdvanceSettingCtrl', function 
($scope, $modal,cubeConfi
   $scope.refreshRowKey = function(list,index,item){
     var encoding = "dict";
     var column = item.column;
-    if(item.isDictionary!=="true"){
-      if(item.fixedLength){
-        encoding = "fixed_length:"+item.fixedLength;
+    if(item.encoding!=="dict"){
+      if(item.encoding=="fixed_length" && item.valueLength){
+        encoding = "fixed_length:"+item.valueLength;
+      }
+      else if(item.encoding=="int" && item.valueLength){
+        encoding = "int:"+item.valueLength;
       }
+    }else{
+      item.valueLength=0;
     }
     $scope.cubeMetaFrame.rowkey.rowkey_columns[index].column = column;
     $scope.cubeMetaFrame.rowkey.rowkey_columns[index].encoding = encoding;
@@ -72,9 +83,8 @@ KylinApp.controller('CubeAdvanceSettingCtrl', function 
($scope, $modal,cubeConfi
   $scope.addNewRowkeyColumn = function () {
     var rowkeyObj = {
       column:"",
-      isDictionary:"true",
-      isFixedLength:"false",
-      fixedLength:0
+      encoding:"dict",
+      valueLength:0
     }
 
     $scope.convertedRowkeys.push(rowkeyObj);
@@ -84,6 +94,7 @@ KylinApp.controller('CubeAdvanceSettingCtrl', function 
($scope, $modal,cubeConfi
     });
 
   };
+
   $scope.addNewHierarchy = function(grp){
     grp.select_rule.hierarchy_dims.push([]);
   }

http://git-wip-us.apache.org/repos/asf/kylin/blob/030a16ad/webapp/app/js/controllers/cubeEdit.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeEdit.js 
b/webapp/app/js/controllers/cubeEdit.js
index 4e9fdea..e188245 100755
--- a/webapp/app/js/controllers/cubeEdit.js
+++ b/webapp/app/js/controllers/cubeEdit.js
@@ -37,6 +37,16 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, 
$routeParams, $locatio
   }
 
 
+  //init encoding list
+  $scope.store = {
+    supportedEncoding:[]
+  }
+  CubeService.getValidEncodings({}, function (encodings) {
+    $scope.store.supportedEncoding = encodings;
+  },function(e){
+    $scope.store.supportedEncoding = $scope.cubeConfig.encodings;
+  })
+
   $scope.getColumnsByTable = function (tableName) {
     var temp = [];
     angular.forEach(TableModel.selectProjectTables, function (table) {

http://git-wip-us.apache.org/repos/asf/kylin/blob/030a16ad/webapp/app/js/model/cubeConfig.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/cubeConfig.js 
b/webapp/app/js/model/cubeConfig.js
index 99c2ba1..76d9ae9 100644
--- a/webapp/app/js/model/cubeConfig.js
+++ b/webapp/app/js/model/cubeConfig.js
@@ -65,7 +65,8 @@ KylinApp.constant('cubeConfig', {
     topN:{name: 'Top 100', value: "topn(100)"}
   },
     dictionaries: ["true", "false"],
-
+    encodings:["dict","fixed_length","int"],
+    intEncodingOptions: [1,2,3,4,5,6,7,8],
 //    cubes config
   theaditems: [
     {attr: 'name', name: 'Name'},

http://git-wip-us.apache.org/repos/asf/kylin/blob/030a16ad/webapp/app/js/services/cubes.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/cubes.js b/webapp/app/js/services/cubes.js
index 2e7a185..953f157 100644
--- a/webapp/app/js/services/cubes.js
+++ b/webapp/app/js/services/cubes.js
@@ -19,6 +19,7 @@
 KylinApp.factory('CubeService', ['$resource', function ($resource, config) {
   return $resource(Config.service.url + 
'cubes/:cubeId/:propName/:propValue/:action', {}, {
     list: {method: 'GET', params: {}, isArray: true},
+    getValidEncodings: {method: 'GET', params: {action:"validEncodings"}, 
isArray: true},
     getCube: {method: 'GET', params: {}, isArray: false},
     getSql: {method: 'GET', params: {propName: 'segs', action: 'sql'}, 
isArray: false},
     updateNotifyList: {method: 'PUT', params: {propName: 'notify_list'}, 
isArray: false},

http://git-wip-us.apache.org/repos/asf/kylin/blob/030a16ad/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 936c79a..bdc1e3e 100755
--- a/webapp/app/partials/cubeDesigner/advanced_settings.html
+++ b/webapp/app/partials/cubeDesigner/advanced_settings.html
@@ -50,10 +50,10 @@
                       
on-select="refreshAggregationGroup(cubeMetaFrame.aggregation_groups, rowIndex, 
aggregation_group)"
                       
on-remove="refreshAggregationGroup(cubeMetaFrame.aggregation_groups, rowIndex, 
aggregation_group)"
                       ng-if="state.mode=='edit'" style="width: 100%" multiple 
ng-model="aggregation_group.includes">
-                     <ui-select-match placeholder="Select 
Column...">{{$item.column}}</ui-select-match>
+                      <ui-select-match placeholder="Select 
Column...">{{$item.column}}</ui-select-match>
                       <ui-select-choices
-                      repeat="rowkey_column.column as rowkey_column in 
cubeMetaFrame.rowkey.rowkey_columns | filter:$select.search">
-                    {{rowkey_column.column}}
+                        repeat="rowkey_column.column as rowkey_column in 
cubeMetaFrame.rowkey.rowkey_columns | filter:$select.search">
+                        {{rowkey_column.column}}
                       </ui-select-choices>
                     </ui-select>
 
@@ -68,14 +68,6 @@
                     Mandatory Dimensions
                   </td>
                   <td class="col-xs-8">
-                    <!-- Dimensions -->
-                    <!--<select ng-if="state.mode=='edit'" style="width: 
100%"-->
-                            
<!--ng-model="aggregation_group.select_rule.mandatory_dims" chosen multiple-->
-                            
<!--ng-change="refreshAggregationGroup(cubeMetaFrame.aggregation_groups, 
rowIndex, aggregation_group)"-->
-                            <!--ng-options="column as column for column in 
aggregation_group.includes">-->
-                      <!--<option value=""></option>-->
-                    <!--</select>-->
-
                     <ui-select
                       close-on-select="false"
                       autofocus="true"
@@ -105,14 +97,6 @@
                     <table class="table">
                       <tr class="row" ng-repeat="hierarchyDims in 
aggregation_group.select_rule.hierarchy_dims track by $index">
                         <td class="col-xs-10">
-                          <!-- Dimensions -->
-                          <!--<select ng-if="state.mode=='edit'" style="width: 
100%"-->
-                                  <!--ng-model="hierarchyDims" chosen 
multiple-->
-                                  
<!--ng-change="refreshAggregationHierarchy(cubeMetaFrame.aggregation_groups, 
rowIndex, aggregation_group,$index,hierarchyDims)"-->
-                                  <!--ng-options="column as column for column 
in aggregation_group.includes">-->
-                            <!--<option value=""></option>-->
-                          <!--</select>-->
-
                           <ui-select
                             close-on-select="false"
                             autofocus="true"
@@ -218,13 +202,13 @@
         <table style="margin-left:42px; width:92%"
                ng-if="cubeMetaFrame.rowkey.rowkey_columns.length > 0"
                class="table table-hover table-bordered list"
-          >
+        >
           <thead>
           <tr>
             <th>ID</th>
             <th style="width:200px;">Column</th>
-            <th>Dictionary</th>
-            <th>Fixed Length</th>
+            <th>Encoding</th>
+            <th>Length</th>
             <th ng-if="state.mode=='edit'"></th>
           </tr>
           </thead>
@@ -248,24 +232,25 @@
               <span ng-if="state.mode=='view'">{{rowkey_column.column}}</span>
             </td>
             <td>
-              <select ng-if="state.mode=='edit'" style="width:80px;"
-                      chosen ng-model="rowkey_column.isDictionary"
+              <select ng-if="state.mode=='edit'" style="width:180px;"
+                      chosen ng-model="rowkey_column.encoding"
                       
ng-change="refreshRowKey(convertedRowkeys,$index,rowkey_column);"
-                      ng-options="dt as dt for dt in cubeConfig.dictionaries">
+                      ng-options="dt as dt for dt in store.supportedEncoding">
                 <option value=""></option>
               </select>
-              <span 
ng-if="state.mode=='view'">{{rowkey_column.isDictionary}}</span>
+              <span 
ng-if="state.mode=='view'">{{rowkey_column.encoding}}</span>
 
             </td>
             <td>
               <!--Column Length -->
               <input type="text" class="form-control" placeholder="Column 
Length.." ng-if="state.mode=='edit'"
                      tooltip="rowkey column length.." tooltip-trigger="focus"
-                     ng-disabled="rowkey_column.isDictionary=='true'"
+                     ng-disabled="rowkey_column.encoding=='dict'"
                      
ng-change="refreshRowKey(convertedRowkeys,$index,rowkey_column);"
-                     ng-model="rowkey_column.fixedLength" class="form-control">
+                     ng-model="rowkey_column.valueLength" class="form-control">
 
-              <span 
ng-if="state.mode=='view'">{{rowkey_column.fixedLength}}</span>
+              <small class="help-block red" ng-show="state.mode=='edit' && 
rowkey_column.encoding=='int' && (rowkey_column.valueLength>8 || 
rowkey_column.valueLength<1)">int encoding column length should between 1 and 
8</small>
+              <span 
ng-if="state.mode=='view'">{{rowkey_column.valueLength}}</span>
             </td>
 
             <td ng-if="state.mode=='edit'">

Reply via email to