kylin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhongj...@apache.org
Subject kylin git commit: KYLIN-1786 extended column UI update
Date Mon, 18 Jul 2016 15:03:41 GMT
Repository: kylin
Updated Branches:
  refs/heads/master a8dd0ec91 -> 19f9ef070


KYLIN-1786 extended column UI update


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

Branch: refs/heads/master
Commit: 19f9ef070bf47e0bc955ba7621a90ed4ef5b961c
Parents: a8dd0ec
Author: Jason <jiatuer@163.com>
Authored: Mon Jul 18 23:02:51 2016 +0800
Committer: Jason <jiatuer@163.com>
Committed: Mon Jul 18 23:03:24 2016 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/cubeEdit.js          |  57 ++---------
 webapp/app/js/controllers/cubeMeasures.js      |  69 ++++++++-----
 webapp/app/js/model/cubeConfig.js              |  10 +-
 webapp/app/partials/cubeDesigner/measures.html | 105 +-------------------
 4 files changed, 60 insertions(+), 181 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/19f9ef07/webapp/app/js/controllers/cubeEdit.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeEdit.js b/webapp/app/js/controllers/cubeEdit.js
index 8475025..3fba2c9 100755
--- a/webapp/app/js/controllers/cubeEdit.js
+++ b/webapp/app/js/controllers/cubeEdit.js
@@ -86,40 +86,7 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams,
$locatio
     return avaColObject;
   };
 
-  $scope.getCommonMetricColumns = function (measure) {
-    var nonCustomMeasures = ['SUM','MIN','MAX','COUNT'];
-    var expression = measure.function.expression;
-
-    //metric from model
-    var me_columns = [];
-    if($scope.metaModel.model.metrics){
-      angular.forEach($scope.metaModel.model.metrics,function(metric,index){
-        me_columns.push(metric);
-      })
-    }
-
-    if(nonCustomMeasures.indexOf(expression)!==-1){
-      return me_columns;
-    }
-
-    //add cube dimension column for specific measure
-    angular.forEach($scope.cubeMetaFrame.dimensions,function(dimension,index){
-      if(dimension.column && dimension.derived == null){
-        me_columns.push(dimension.column);
-      }
-
-      if(dimension.derived&&dimension.derived.length>=1){
-        me_columns = me_columns.concat(dimension.derived);
-      }
-
-    });
-
-    return me_columns;
-
-  };
-
-
-  $scope.getExtendedColumns = function (measure) {
+  $scope.getCommonMetricColumns = function () {
     //metric from model
     var me_columns = [];
     if($scope.metaModel.model.metrics){
@@ -127,31 +94,23 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams,
$locatio
         me_columns.push(metric);
       })
     }
-    angular.forEach($scope.metaModel.model.dimensions,function(dimension,index){
-        if(dimension.columns){
-          me_columns = me_columns.concat(dimension.columns);
-        }
-    })
 
     return me_columns;
-
   };
 
-  $scope.getExtendedFactColumns = function (measure) {
+  $scope.getExtendedHostColumn = function(){
     var me_columns = [];
-    angular.forEach($scope.metaModel.model.dimensions,function(dimension,index){
+    //add cube dimension column for specific measure
+    angular.forEach($scope.cubeMetaFrame.dimensions,function(dimension,index){
       if($scope.metaModel.model.fact_table !== dimension.table){
         return;
       }
-
-      if(dimension.columns){
-        me_columns = me_columns.concat(dimension.columns);
+      if(dimension.column && dimension.derived == null){
+        me_columns.push(dimension.column);
       }
-    })
-
+    });
     return me_columns;
-
-  };
+  }
 
 
   $scope.getFactColumns = function () {

http://git-wip-us.apache.org/repos/asf/kylin/blob/19f9ef07/webapp/app/js/controllers/cubeMeasures.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeMeasures.js b/webapp/app/js/controllers/cubeMeasures.js
index bb22a42..8db1356 100644
--- a/webapp/app/js/controllers/cubeMeasures.js
+++ b/webapp/app/js/controllers/cubeMeasures.js
@@ -20,37 +20,28 @@
 
 KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubesManager,CubeDescModel,SweetAlert)
{
 
+  $scope.initUpdateMeasureStatus = function(){
+    $scope.updateMeasureStatus = {
+      isEdit:false,
+      editIndex:-1
+    }
+  };
+  $scope.initUpdateMeasureStatus();
 
-  $scope.addNewMeasure = function (measure) {
+  $scope.addNewMeasure = function (measure, index) {
+    if(measure&&index>=0){
+      $scope.updateMeasureStatus.isEdit = true;
+      $scope.updateMeasureStatus.editIndex = index;
+    }
     $scope.nextParameters = [];
-    $scope.newMeasure = (!!measure)? measure:CubeDescModel.createMeasure();
-    //if(!!measure){
-    //  $scope.convertNextParameters();
-    //}
+    $scope.newMeasure = (!!measure)? jQuery.extend(true, {},measure):CubeDescModel.createMeasure();
     if(!!measure && measure.function.parameter.next_parameter){
       $scope.nextPara.value = measure.function.parameter.next_parameter.value;
     }
   };
-  //$scope.convertNextParameters = function(){
-  //  $scope.nextParameters = [];
-  //  var paramater = jQuery.extend(true, {}, $scope.newMeasure.function.parameter);
-  //  while(paramater.next_parameter){
-  //    var paraMeter =
-  //    {
-  //     "type": paramater.next_parameter.type,
-  //     "value":paramater.next_parameter.value,
-  //      "next_parameter":null
-  //    }
-  //    $scope.nextParameters.push(paraMeter);
-  //
-  //    paramater = paramater.next_parameter;
-  //
-  //  }
-  //
-  //}
+
 
   $scope.updateNextParameter = function(){
-    //jQuery.extend(true, {},$scope.newMeasure.function.parameter.next_parameter)
     for(var i= 0;i<$scope.nextParameters.length-1;i++){
       $scope.nextParameters[i].next_parameter=$scope.nextParameters[i+1];
     }
@@ -106,7 +97,8 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubes
 
   $scope.clearNewMeasure = function () {
     $scope.newMeasure = null;
-    $scope.nextPara.value = "";
+    $scope.initUpdateMeasureStatus();
+    $scope.nextParameterInit();
   };
 
   $scope.saveNewMeasure = function () {
@@ -116,22 +108,45 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubes
       return false;
     }
     if($scope.nextPara.value!=="" && ($scope.newMeasure.function.expression == 'EXTENDED_COLUMN'
|| $scope.newMeasure.function.expression == 'TOP_N')){
-      $scope.newMeasure.function.parameter.next_parameter = $scope.nextPara;
+      $scope.newMeasure.function.parameter.next_parameter = jQuery.extend(true,{},$scope.nextPara);
     }
 
-    if ($scope.cubeMetaFrame.measures.indexOf($scope.newMeasure) === -1) {
+    if($scope.updateMeasureStatus.isEdit == true){
+      $scope.cubeMetaFrame.measures[$scope.updateMeasureStatus.editIndex] = $scope.newMeasure;
+    }
+    else {
       $scope.cubeMetaFrame.measures.push($scope.newMeasure);
     }
     $scope.newMeasure = null;
+    $scope.initUpdateMeasureStatus();
+    $scope.nextParameterInit();
     return true;
   };
 
+  $scope.nextParameterInit = function(){
+    $scope.nextPara = {
+      "type":"column",
+      "value":"",
+      "next_parameter":null
+    }
+    if($scope.newMeasure){
+      $scope.newMeasure.function.parameter.next_parameter = null;
+    }
+  }
+
   //map right return type for param
   $scope.measureReturnTypeUpdate = function(){
 
-    if($scope.newMeasure.function.expression == 'TOP_N'||$scope.newMeasure.function.expression
== 'EXTENDED_COLUMN'){
+    if($scope.newMeasure.function.expression == 'TOP_N'){
+      $scope.newMeasure.function.parameter.type= 'column';
+      $scope.newMeasure.function.returntype = "topn(100)";
+      return;
+    }else if($scope.newMeasure.function.expression == 'EXTENDED_COLUMN'){
       $scope.newMeasure.function.parameter.type= 'column';
+      $scope.newMeasure.function.returntype = "extendedcolumn(100)";
       return;
+    }else{
+      $scope.nextParameterInit();
     }
 
     if($scope.newMeasure.function.expression == 'COUNT'){

http://git-wip-us.apache.org/repos/asf/kylin/blob/19f9ef07/webapp/app/js/model/cubeConfig.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/cubeConfig.js b/webapp/app/js/model/cubeConfig.js
index 88e2133..2876f40 100644
--- a/webapp/app/js/model/cubeConfig.js
+++ b/webapp/app/js/model/cubeConfig.js
@@ -41,11 +41,11 @@ KylinApp.constant('cubeConfig', {
     {name: 'STRING', value: 'string'}
   ],
   distinctDataTypes: [
-    {name: 'Error Rate < 9.75%', value: 'hllc10'},
-    {name: 'Error Rate < 4.88%', value: 'hllc12'},
-    {name: 'Error Rate < 2.44%', value: 'hllc14'},
-    {name: 'Error Rate < 1.72%', value: 'hllc15'},
-    {name: 'Error Rate < 1.22%', value: 'hllc16'},
+    {name: 'Error Rate < 9.75%', value: 'hllc(10)'},
+    {name: 'Error Rate < 4.88%', value: 'hllc(12)'},
+    {name: 'Error Rate < 2.44%', value: 'hllc(14)'},
+    {name: 'Error Rate < 1.72%', value: 'hllc(15)'},
+    {name: 'Error Rate < 1.22%', value: 'hllc(16)'},
     {name: 'Precisely (More Memory And Storage Needed)', value: 'bitmap'}
   ],
   topNTypes: [

http://git-wip-us.apache.org/repos/asf/kylin/blob/19f9ef07/webapp/app/partials/cubeDesigner/measures.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/measures.html b/webapp/app/partials/cubeDesigner/measures.html
index 46aeefe..53806b4 100755
--- a/webapp/app/partials/cubeDesigner/measures.html
+++ b/webapp/app/partials/cubeDesigner/measures.html
@@ -56,7 +56,7 @@
                           </td>
                           <td ng-if="state.mode=='edit'">
                               <!--Edit Button -->
-                              <button class="btn btn-xs btn-info" ng-click="addNewMeasure(measure)">
+                              <button class="btn btn-xs btn-info" ng-click="addNewMeasure(measure,
$index)">
                                   <i class="fa fa-pencil"></i>
                               </button>
                               <!--Remove Button -->
@@ -152,14 +152,14 @@
                                         ng-if="newMeasure.function.parameter.type == 'column'
&& newMeasure.function.expression !== 'EXTENDED_COLUMN'"
                                         ng-model="newMeasure.function.parameter.value"
                                         ng-change="measureReturnTypeUpdate();"
-                                        ng-options="column as column for column in getCommonMetricColumns(newMeasure)"
>
+                                        ng-options="column as column for column in getCommonMetricColumns()"
>
                                   <option value="">-- Select a Column --</option>
                                 </select>
                                 <select class="form-control" chosen
                                         ng-if="newMeasure.function.expression == 'EXTENDED_COLUMN'"
                                         ng-model="newMeasure.function.parameter.value"
                                         ng-change="measureReturnTypeUpdate();"
-                                        ng-options="column as column for column in getFactColumns()"
>
+                                        ng-options="column as column for column in getExtendedHostColumn()"
>
                                   <option value="">-- Select a Column --</option>
                                 </select>
                               </div>
@@ -212,7 +212,7 @@
                           <div class="col-xs-12 col-sm-6">
                             <select class="form-control" chosen ng-if="nextPara.type !==
'constant'" required
                                     ng-model="nextPara.value"
-                                    ng-options="column as column for column in getExtendedFactColumns()"
>
+                                    ng-options="column as column for column in getCommonMetricColumns()"
>
                               <option value=""></option>
                             </select>
                           </div>
@@ -227,7 +227,7 @@
                           <div class="col-xs-12 col-sm-6">
                             <select class="form-control" chosen ng-if="nextPara.type !==
'constant'" required
                                     ng-model="nextPara.value"
-                                    ng-options="column as column for column in getExtendedColumns(newMeasure)"
>
+                                    ng-options="column as column for column in getCommonMetricColumns()"
>
                               <option value=""></option>
                             </select>
                           </div>
@@ -260,14 +260,6 @@
                               </tr>
                             </table>
 
-
-
-                            <!--<button class="btn btn-sm btn-info" ng-click="addNextParameter()"
ng-show="newMeasure.function.expression == 'TOP_N' && nextParameters.length==0"-->
-                                    <!--ng-show="state.mode=='edit'"><i class="fa
fa-plus"> Group by Column</i>-->
-                            <!--</button>-->
-                            <!--<button class="btn btn-sm btn-info" ng-click="addNextParameter()"
ng-show="newMeasure.function.expression == 'EXTENDED_COLUMN' && nextParameters.length==0"-->
-                                    <!--ng-show="state.mode=='edit'"><i class="fa
fa-plus"> Extended Column On Fact Table</i>-->
-                            <!--</button>-->
                           </div>
                         </div>
                       </div>
@@ -285,93 +277,6 @@
 </div>
 
 
-
-
-<script type="text/ng-template" id="nextParameter.html">
-  <div class="modal-header">
-    <h4 tooltip="submit" ng-if="newmea.measure&&newmea.measure.function.expression
== 'EXTENDED_COLUMN'">Add Extended Column</h4>
-    <h4 tooltip="submit" ng-if="newmea.measure&&newmea.measure.function.expression
== 'TOP_N'">Select Group By Column</h4>
-  </div>
-  <div class="modal-body" style="background-color: white">
-
-    <div class="row">
-      <div class="col-md-2"></div>
-      <div class="col-md-8">
-        <div class="row">
-          <div class="form-group">
-            <div class="row" ng-if="newmea.measure&&newmea.measure.function.expression
!== 'TOP_N' && newmea.measure.function.expression !== 'EXTENDED_COLUMN'">
-              <label class="col-xs-12 col-sm-3 control-label no-padding-right font-color-default"><b>Param
Type</b></label>
-              <div class="col-xs-12 col-sm-6">
-                <select class="form-control"
-                        chosen ng-model="nextPara.type" required
-                        ng-options="mpt as mpt for mpt in cubeConfig.measureParamType">
-                  <option value=""></option>
-                </select>
-              </div>
-            </div>
-
-          </div>
-        </div>
-      </div>
-      <div class="col-md-2"></div>
-    </div>
-    <div class="row">
-      <div class="col-md-2"></div>
-      <div class="col-md-8">
-        <div class="row">
-          <div class="form-group">
-
-            <div ng-if="newmea.measure&&newmea.measure.function.expression !==
'TOP_N' && newmea.measure.function.expression !== 'EXTENDED_COLUMN" class="row">
-              <label  class="col-xs-12 col-sm-3 control-label no-padding-right font-color-default"><b>Param
Value</b></label>
-                <!--COUNT_DISTINCT-->
-              <div class="col-xs-12 col-sm-6">
-                <select class="form-control" chosen ng-if="nextPara.type !== 'constant'"
-                        ng-model="nextPara.value"
-                        ng-options="column as column for column in getCommonMetricColumns(newmea.measure)"
>
-                  <option value=""></option>
-                </select>
-               <span class="font-color-default"
-                     ng-if="nextPara.type == 'constant'"
-                     ng-init="nextPara.value = 1"><b>&nbsp;&nbsp;1</b></span>
-              </div>
-            </div>
-
-            <div ng-if="newmea.measure&&newmea.measure.function.expression ==
'TOP_N'" ng-init="nextPara.type='column'" class="row">
-              <label  class="col-xs-12 col-sm-3 control-label no-padding-right font-color-default"><b>Group
By Column</b></label>
-              <!--COUNT_DISTINCT-->
-              <div class="col-xs-12 col-sm-6">
-                <select class="form-control" chosen
-                        ng-model="nextPara.value"
-                        ng-options="column as column for column in getExtendedColumns(newmea.measure)"
>
-                  <option value=""></option>
-                </select>
-              </div>
-            </div>
-
-            <div ng-if="newmea.measure&&newmea.measure.function.expression ==
'EXTENDED_COLUMN'" ng-init="nextPara.type='column'" class="row">
-              <label  class="col-xs-12 col-sm-4 control-label no-padding-right font-color-default"><b>Extended
Column On Fact Table</b></label>
-              <!--COUNT_DISTINCT-->
-              <div class="col-xs-12 col-sm-6">
-                <select class="form-control" chosen
-                        ng-model="nextPara.value"
-                        ng-options="column as column for column in getExtendedColumns(newmea.measure)"
>
-                  <option value=""></option>
-                </select>
-              </div>
-            </div>
-
-            </div>
-          </div>
-        </div>
-      </div>
-      <div class="col-md-2"></div>
-    </div>
-  </div>
-  <div class="modal-footer">
-    <button class="btn btn-success" ng-click="ok()">OK</button>
-    <button class="btn btn-primary" ng-click="cancel()">Close</button>
-  </div>
-</script>
 <script type="text/ng-template" id="expressionTip.html">
   <p>All cubes have to contain one measure for Count(1), suggest use "_Count_" as name
(Has been generated automatically)</p>
 </script>


Mime
View raw message