Repository: kylin Updated Branches: refs/heads/master b720b8dc9 -> 275f23ccf
KYLIN-2143 allow more options from Extended Columns,COUNT_DISTINCT,RAW_TABLE Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/275f23cc Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/275f23cc Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/275f23cc Branch: refs/heads/master Commit: 275f23ccfab85d6484b0c6e282cffb85fddd826a Parents: b720b8d Author: Jason <jiat...@163.com> Authored: Tue Nov 1 16:51:51 2016 +0800 Committer: Jason <jiat...@163.com> Committed: Tue Nov 1 16:51:51 2016 +0800 ---------------------------------------------------------------------- webapp/app/js/controllers/cubeEdit.js | 34 +++++++- webapp/app/partials/cubeDesigner/measures.html | 96 +++++++++++---------- 2 files changed, 82 insertions(+), 48 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/275f23cc/webapp/app/js/controllers/cubeEdit.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/cubeEdit.js b/webapp/app/js/controllers/cubeEdit.js index 5f46799..06d3120 100755 --- a/webapp/app/js/controllers/cubeEdit.js +++ b/webapp/app/js/controllers/cubeEdit.js @@ -137,18 +137,44 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio return me_columns; }; - $scope.getGroupByColumns = function () { - var groupBy_columns=[]; + $scope.getAllModelDimMeasureColumns = function () { + var me_columns = []; + if($scope.metaModel.model.metrics){ + angular.forEach($scope.metaModel.model.metrics,function(metric,index){ + me_columns.push(metric); + }) + } + + angular.forEach($scope.metaModel.model.dimensions,function(dimension,index){ + if(dimension.columns){ + me_columns = me_columns.concat(dimension.columns); + } + }) + return distinct_array(me_columns); + }; + + $scope.getAllModelDimColumns = function () { + var me_columns = []; angular.forEach($scope.metaModel.model.dimensions,function(dimension,index){ if(dimension.columns){ - groupBy_columns = groupBy_columns.concat(dimension.columns); + me_columns = me_columns.concat(dimension.columns); } }) - return groupBy_columns; + return distinct_array(me_columns); }; + function distinct_array(arrays){ + var arr = []; + for(var item in arrays){ + if(arr.indexOf(arrays[item])==-1){ + arr.push(arrays[item]); + } + } + return arr; + } + $scope.getExtendedHostColumn = function(){ var me_columns = []; http://git-wip-us.apache.org/repos/asf/kylin/blob/275f23cc/webapp/app/partials/cubeDesigner/measures.html ---------------------------------------------------------------------- diff --git a/webapp/app/partials/cubeDesigner/measures.html b/webapp/app/partials/cubeDesigner/measures.html index b4513f2..c85bfd2 100755 --- a/webapp/app/partials/cubeDesigner/measures.html +++ b/webapp/app/partials/cubeDesigner/measures.html @@ -149,15 +149,22 @@ ng-init="newMeasure.function.parameter.value = 1"><b> 1</b></span> <!--!COUNT_DISTINCT--> <select class="form-control" chosen - ng-if="newMeasure.function.parameter.type == 'column' && newMeasure.function.expression !== 'EXTENDED_COLUMN'" - ng-model="newMeasure.function.parameter.value" + ng-if="newMeasure.function.parameter.type == 'column' && (newMeasure.function.expression == 'COUNT_DISTINCT'||newMeasure.function.expression == 'RAW')" + ng-model="newMeasure.function.parameter.value" required ng-change="measureReturnTypeUpdate();" - ng-options="column as column for column in getCommonMetricColumns()" > + ng-options="column as column for column in getAllModelDimMeasureColumns(newMeasure)" > + <option value="">-- Select a Column --</option> + </select> + <select class="form-control" chosen + ng-if="newMeasure.function.parameter.type == 'column' && newMeasure.function.expression !== 'EXTENDED_COLUMN' && newMeasure.function.expression !== 'COUNT_DISTINCT' && newMeasure.function.expression !== 'RAW'" + ng-model="newMeasure.function.parameter.value" required + ng-change="measureReturnTypeUpdate();" + ng-options="column as column for column in getCommonMetricColumns(newMeasure)" > <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-model="newMeasure.function.parameter.value" required ng-change="measureReturnTypeUpdate();" ng-options="column as column for column in getExtendedHostColumn()" > <option value="">-- Select a Column --</option> @@ -165,44 +172,6 @@ </div> </div> </div> - <!--Return Type--> - <div class="form-group middle-popover"> - <div class="row"> - <label class="col-xs-12 col-sm-3 control-label no-padding-right font-color-default"> - <b ng-if="newMeasure.function.expression !== 'EXTENDED_COLUMN'">Return Type</b> - <b ng-if="newMeasure.function.expression == 'EXTENDED_COLUMN'">Maximum length of extended column</b> <i ng-if="newMeasure.function.expression == 'EXTENDED_COLUMN'" title="Maximum Length" class="fa fa-info-circle" kylinpopover placement="right" template="extendedTypeTip.html"></i> - </label> - <div class="col-xs-12 col-sm-6"> - <select class="form-control" - ng-if="newMeasure.function.expression == 'COUNT_DISTINCT'" - ng-init="newMeasure.function.returntype = (!!newMeasure.function.returntype)?newMeasure.function.returntype:cubeConfig.dftSelections.distinctDataType.value" - chosen ng-model="newMeasure.function.returntype" required - ng-options="ddt.value as ddt.name for ddt in cubeConfig.distinctDataTypes"> - <option value=""></option> - </select> - <select class="form-control" - ng-if="newMeasure.function.expression == 'TOP_N'" - ng-init="newMeasure.function.returntype = (!!newMeasure.function.returntype)?newMeasure.function.returntype:cubeConfig.dftSelections.topN.value" - chosen ng-model="newMeasure.function.returntype" required - ng-options="ddt.value as ddt.name for ddt in cubeConfig.topNTypes"> - <option value=""></option> - </select> - - <input extended-column-return - ng-if="newMeasure.function.expression == 'EXTENDED_COLUMN'" - type="text" placeholder="Kylin wonât save more than this number of bytes" class="form-control" - tooltip-trigger="focus" - ng-init="newMeasure.function.returntype=newMeasure.function.returntype?newMeasure.function.returntype:'extendedcolumn(100)'" - ng-model="newMeasure.function.returntype" required /> - - <span class="font-color-default" - ng-if="newMeasure.function.expression != 'COUNT_DISTINCT' && newMeasure.function.expression != 'TOP_N' && newMeasure.function.expression != 'EXTENDED_COLUMN' " - ><b> {{newMeasure.function.returntype | uppercase}}</b> - </span> - </div> - </div> - </div> - <div class="form-group middle-popover" ng-if="newMeasure.function.expression == 'EXTENDED_COLUMN'"> <div class="row"> @@ -212,12 +181,51 @@ <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 getCommonMetricColumns()" > + ng-options="column as column for column in getAllModelDimColumns()" > + <option value="">-- Select a Column --</option> + </select> + </div> + </div> + </div> + + <!--Return Type--> + <div class="form-group middle-popover"> + <div class="row"> + <label class="col-xs-12 col-sm-3 control-label no-padding-right font-color-default"> + <b ng-if="newMeasure.function.expression !== 'EXTENDED_COLUMN'">Return Type</b> + <b ng-if="newMeasure.function.expression == 'EXTENDED_COLUMN'">Maximum length of extended column</b> <i ng-if="newMeasure.function.expression == 'EXTENDED_COLUMN'" title="Maximum Length" class="fa fa-info-circle" kylinpopover placement="right" template="extendedTypeTip.html"></i> + </label> + <div class="col-xs-12 col-sm-6"> + <select class="form-control" + ng-if="newMeasure.function.expression == 'COUNT_DISTINCT'" + ng-init="newMeasure.function.returntype = (!!newMeasure.function.returntype)?newMeasure.function.returntype:cubeConfig.dftSelections.distinctDataType.value" + chosen ng-model="newMeasure.function.returntype" required + ng-options="ddt.value as ddt.name for ddt in cubeConfig.distinctDataTypes"> <option value=""></option> </select> + <select class="form-control" + ng-if="newMeasure.function.expression == 'TOP_N'" + ng-init="newMeasure.function.returntype = (!!newMeasure.function.returntype)?newMeasure.function.returntype:cubeConfig.dftSelections.topN.value" + chosen ng-model="newMeasure.function.returntype" required + ng-options="ddt.value as ddt.name for ddt in cubeConfig.topNTypes"> + <option value=""></option> + </select> + + <input extended-column-return + ng-if="newMeasure.function.expression == 'EXTENDED_COLUMN'" + type="text" placeholder="Kylin wonât save more than this number of bytes" class="form-control" + tooltip-trigger="focus" + ng-init="newMeasure.function.returntype=newMeasure.function.returntype?newMeasure.function.returntype:'extendedcolumn(100)'" + ng-model="newMeasure.function.returntype" required /> + + <span class="font-color-default" + ng-if="newMeasure.function.expression != 'COUNT_DISTINCT' && newMeasure.function.expression != 'TOP_N' && newMeasure.function.expression != 'EXTENDED_COLUMN' " + ><b> {{newMeasure.function.returntype | uppercase}}</b> + </span> </div> </div> </div> + <!--Group by Column--> <div class="form-group" ng-if="newMeasure.function.expression == 'TOP_N'" > <div class="row"> @@ -251,7 +259,7 @@ <td> <select class="form-control" chosen ng-if="nextPara.type !== 'constant'" required ng-model="groupby_column.name" - ng-options="column as column for column in getGroupByColumns()" style="width:200px;"> + ng-options="column as column for column in getAllModelDimColumns()" style="width:200px;"> <option value="">--Select A Column--</option> </select> </td>