KYLIN-1569 Select any column when adding a custom aggregation in GUI
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/209aa665 Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/209aa665 Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/209aa665 Branch: refs/heads/yang-m1 Commit: 209aa6657f595020e1201b2d6e79bd549fe91284 Parents: 41fb735 Author: Jason <jiat...@163.com> Authored: Mon Apr 18 12:17:02 2016 +0800 Committer: Jason <jiat...@163.com> Committed: Mon Apr 18 22:50:51 2016 +0800 ---------------------------------------------------------------------- webapp/app/js/controllers/cubeEdit.js | 25 ++++++++++----------- webapp/app/js/controllers/cubeMeasures.js | 4 ++-- webapp/app/partials/cubeDesigner/measures.html | 16 ++++--------- 3 files changed, 18 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kylin/blob/209aa665/webapp/app/js/controllers/cubeEdit.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/cubeEdit.js b/webapp/app/js/controllers/cubeEdit.js index b34393a..2cae518 100755 --- a/webapp/app/js/controllers/cubeEdit.js +++ b/webapp/app/js/controllers/cubeEdit.js @@ -88,8 +88,9 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio return avaColObject; }; - //SUM,COUNT,MAX,MIN - $scope.getCommonMetricColumns = function () { + $scope.getCommonMetricColumns = function (measure) { + var nonCustomMeasures = ['SUM','MIN','MAX','COUNT']; + var expression = measure.function.expression; //metric from model var me_columns = []; @@ -98,18 +99,9 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio me_columns.push(metric); }) } - return me_columns; - }; - //COUNT_DISTINCT,TopN - $scope.getMetricColumns = function () { - - //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 @@ -117,12 +109,19 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio 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.getColumnType = function (_column, table) { var columns = $scope.getColumnsByTable(table); var type; http://git-wip-us.apache.org/repos/asf/kylin/blob/209aa665/webapp/app/js/controllers/cubeMeasures.js ---------------------------------------------------------------------- diff --git a/webapp/app/js/controllers/cubeMeasures.js b/webapp/app/js/controllers/cubeMeasures.js index 11cb1eb..8693bd1 100644 --- a/webapp/app/js/controllers/cubeMeasures.js +++ b/webapp/app/js/controllers/cubeMeasures.js @@ -179,8 +179,8 @@ var NextParameterModalCtrl = function ($scope, scope,para,$modalInstance,cubeCon $modalInstance.dismiss('cancel'); }; - $scope. getMetricColumns = function(){ - return scope.getMetricColumns(); + $scope.getCommonMetricColumns = function(measure){ + return scope.getCommonMetricColumns(measure); } $scope.nextPara = { http://git-wip-us.apache.org/repos/asf/kylin/blob/209aa665/webapp/app/partials/cubeDesigner/measures.html ---------------------------------------------------------------------- diff --git a/webapp/app/partials/cubeDesigner/measures.html b/webapp/app/partials/cubeDesigner/measures.html index 6014a78..f0ae86f 100755 --- a/webapp/app/partials/cubeDesigner/measures.html +++ b/webapp/app/partials/cubeDesigner/measures.html @@ -146,18 +146,10 @@ 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!=='COUNT_DISTINCT'&& newMeasure.function.expression!=='TOP_N'" + ng-if="newMeasure.function.parameter.type == 'column'" ng-model="newMeasure.function.parameter.value" ng-change="measureReturnTypeUpdate();" - ng-options="column as column for column in getCommonMetricColumns()" > - <option value="">-- Select a Column --</option> - </select> - <!--COUNT_DISTINCT--> - <select class="form-control" chosen - ng-if="newMeasure.function.parameter.type == 'column' && (newMeasure.function.expression=='COUNT_DISTINCT' || newMeasure.function.expression=='TOP_N')" - ng-model="newMeasure.function.parameter.value" - ng-change="measureReturnTypeUpdate();" - ng-options="column as column for column in getMetricColumns()" > + ng-options="column as column for column in getCommonMetricColumns(newMeasure)" > <option value="">-- Select a Column --</option> </select> </div> @@ -313,7 +305,7 @@ <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 getMetricColumns()" > + ng-options="column as column for column in getCommonMetricColumns(newmea.measure)" > <option value=""></option> </select> <span class="font-color-default" @@ -328,7 +320,7 @@ <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 getMetricColumns()" > + ng-options="column as column for column in getCommonMetricColumns(newmea.measure)" > <option value=""></option> </select> </div>