You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2016/03/23 10:15:28 UTC
[44/50] [abbrv] kylin git commit: KYLIN-1378 add topN UI support
KYLIN-1378 add topN UI support
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/bccdd4fd
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/bccdd4fd
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/bccdd4fd
Branch: refs/heads/1.5.x-HBase1.1.3
Commit: bccdd4fda268942661eb7c265b573d6824104574
Parents: 7377eda
Author: Jason <ji...@163.com>
Authored: Fri Mar 11 18:24:49 2016 +0800
Committer: Jason <ji...@163.com>
Committed: Fri Mar 11 18:36:00 2016 +0800
----------------------------------------------------------------------
webapp/app/js/controllers/cubeEdit.js | 6 +-
webapp/app/js/controllers/cubeMeasures.js | 8 +++
webapp/app/js/controllers/streamingConfig.js | 8 +--
webapp/app/js/directives/directives.js | 25 +++++++-
webapp/app/js/model/cubeConfig.js | 11 +++-
webapp/app/partials/cubeDesigner/measures.html | 65 +++++++++++++++++----
6 files changed, 103 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/bccdd4fd/webapp/app/js/controllers/cubeEdit.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeEdit.js b/webapp/app/js/controllers/cubeEdit.js
index 748019f..4e9fdea 100755
--- a/webapp/app/js/controllers/cubeEdit.js
+++ b/webapp/app/js/controllers/cubeEdit.js
@@ -104,7 +104,7 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio
//add cube dimension column for specific measure
angular.forEach($scope.cubeMetaFrame.dimensions,function(dimension,index){
- if(dimension.column){
+ if(dimension.column && dimension.derived == null){
me_columns.push(dimension.column);
}
});
@@ -484,7 +484,9 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio
var newGroup = CubeDescModel.createAggGroup();
newGroup.includes = newUniqAggregationItem;
for(var i=1;i<initJointGroups.length;i++){
- newGroup.select_rule.joint_dims[i-1] = initJointGroups[i];
+ if(initJointGroups[i].length>1){
+ newGroup.select_rule.joint_dims[i-1] = initJointGroups[i];
+ }
}
$scope.cubeMetaFrame.aggregation_groups.push(newGroup);
http://git-wip-us.apache.org/repos/asf/kylin/blob/bccdd4fd/webapp/app/js/controllers/cubeMeasures.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeMeasures.js b/webapp/app/js/controllers/cubeMeasures.js
index f4bfab7..1e81e72 100644
--- a/webapp/app/js/controllers/cubeMeasures.js
+++ b/webapp/app/js/controllers/cubeMeasures.js
@@ -107,6 +107,10 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubes
//map right return type for param
$scope.measureReturnTypeUpdate = function(){
+ if($scope.newMeasure.function.expression == 'TOP_N'){
+ return;
+ }
+
if($scope.newMeasure.function.expression == 'COUNT'){
$scope.newMeasure.function.parameter.type= 'constant';
}
@@ -163,6 +167,10 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubes
var NextParameterModalCtrl = function ($scope, scope,para,$modalInstance,cubeConfig, CubeService, MessageService, $location, SweetAlert,ProjectModel, loadingRequest,ModelService) {
+ $scope.newmea={
+ "measure":scope.newMeasure
+ }
+
$scope.cubeConfig = cubeConfig;
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
http://git-wip-us.apache.org/repos/asf/kylin/blob/bccdd4fd/webapp/app/js/controllers/streamingConfig.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/streamingConfig.js b/webapp/app/js/controllers/streamingConfig.js
index 4e916db..7ba912f 100644
--- a/webapp/app/js/controllers/streamingConfig.js
+++ b/webapp/app/js/controllers/streamingConfig.js
@@ -21,9 +21,11 @@
KylinApp.controller('streamingConfigCtrl', function ($scope,StreamingService, $q, $routeParams, $location, $window, $modal, MessageService, CubeDescService, CubeService, JobService, UserService, ProjectService, SweetAlert, loadingRequest, $log, modelConfig, ProjectModel, ModelService, MetaModel, modelsManager, cubesManager, TableModel, $animate,StreamingModel) {
$scope.tableModel = TableModel;
- $scope.streamingMeta = StreamingModel.createStreamingConfig();
- $scope.kafkaMeta = StreamingModel.createKafkaConfig();
+ if($scope.state.mode=='view') {
+ $scope.streamingMeta = StreamingModel.createStreamingConfig();
+ $scope.kafkaMeta = StreamingModel.createKafkaConfig();
+ }
$scope.addCluster = function () {
@@ -105,8 +107,6 @@ KylinApp.controller('streamingConfigCtrl', function ($scope,StreamingService, $q
})
}
-
-
});
});
http://git-wip-us.apache.org/repos/asf/kylin/blob/bccdd4fd/webapp/app/js/directives/directives.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/directives/directives.js b/webapp/app/js/directives/directives.js
index a9cd956..37c599d 100644
--- a/webapp/app/js/directives/directives.js
+++ b/webapp/app/js/directives/directives.js
@@ -271,4 +271,27 @@ KylinApp.directive('kylinPagination', function ($parse, $q) {
};
}
};
- });
+ }).directive("topntree", function($compile) {
+ return {
+ restrict: "E",
+ transclude: true,
+ scope: {
+ nextpara: '='
+ },
+ template:
+ '<li class="parent_li">Value:<b>{{nextpara.value}}</b>, Type:<b>{{ nextpara.type }}</b></li>' +
+ '<li class="parent_li">Order By:<b>{{nextpara.next_parameter.value}}</b></li>',
+ compile: function(tElement, tAttr, transclude) {
+ var contents = tElement.contents().remove();
+ var compiledContents;
+ return function(scope, iElement, iAttr) {
+ if(!compiledContents) {
+ compiledContents = $compile(contents, transclude);
+ }
+ compiledContents(scope, function(clone, scope) {
+ iElement.append(clone);
+ });
+ };
+ }
+ };
+});
http://git-wip-us.apache.org/repos/asf/kylin/blob/bccdd4fd/webapp/app/js/model/cubeConfig.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/cubeConfig.js b/webapp/app/js/model/cubeConfig.js
index b85789c..7747ecb 100644
--- a/webapp/app/js/model/cubeConfig.js
+++ b/webapp/app/js/model/cubeConfig.js
@@ -20,10 +20,9 @@ KylinApp.constant('cubeConfig', {
//~ Define metadata & class
measureParamType: ['column', 'constant'],
- measureExpressions: ['SUM', 'MIN', 'MAX', 'COUNT', 'COUNT_DISTINCT'],
+ measureExpressions: ['SUM', 'MIN', 'MAX', 'COUNT', 'COUNT_DISTINCT',"TOP_N"],
dimensionDataTypes: ["string", "tinyint", "int", "bigint", "date"],
cubeCapacities: ["SMALL", "MEDIUM", "LARGE"],
-// cubePartitionTypes : ['APPEND', 'UPDATE_INSERT'],
cubePartitionTypes: ['APPEND'],
joinTypes: [
{name: 'Left', value: 'left'},
@@ -50,6 +49,11 @@ KylinApp.constant('cubeConfig', {
{name: 'Error Rate < 1.22%', value: 'hllc16'},
{name: 'Precisely (Only for Integer Family column)', value: 'bitmap'}
],
+ topNTypes: [
+ {name: 'Top 10', value: "topn(10)"},
+ {name: 'Top 100', value: "topn(100)"},
+ {name: 'Top 1000', value: "topn(1000)"}
+ ],
dftSelections: {
measureExpression: 'SUM',
measureParamType: 'column',
@@ -57,7 +61,8 @@ KylinApp.constant('cubeConfig', {
distinctDataType: {name: 'Error Rate < 4.88%', value: 'hllc12'},
cubeCapacity: 'MEDIUM',
queryPriority: {name: 'NORMAL', value: 50},
- cubePartitionType: 'APPEND'
+ cubePartitionType: 'APPEND',
+ topN:{name: 'Top 100', value: "topn(100)"}
},
dictionaries: ["true", "false"],
http://git-wip-us.apache.org/repos/asf/kylin/blob/bccdd4fd/webapp/app/partials/cubeDesigner/measures.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/measures.html b/webapp/app/partials/cubeDesigner/measures.html
index 548cb13..b58f200 100755
--- a/webapp/app/partials/cubeDesigner/measures.html
+++ b/webapp/app/partials/cubeDesigner/measures.html
@@ -43,7 +43,8 @@
<td>
<div class="paraTree">
<ul>
- <parametertree ng-if="measure.function.parameter!=null" nextpara="measure.function.parameter"></parametertree>
+ <parametertree ng-if="measure.function.parameter!=null && measure.function.expression!=='TOP_N'" nextpara="measure.function.parameter"></parametertree>
+ <topntree ng-if="measure.function.parameter!=null && measure.function.expression=='TOP_N'" nextpara="measure.function.parameter"></topntree>
</ul>
</div>
<!--<span ng-if="measure.function.parameter.next_parameter!=null">{{measure.function.parameter.next_parameter |json}}</span>-->
@@ -138,7 +139,7 @@
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'"
+ 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 getCommonMetricColumns()" >
@@ -146,7 +147,7 @@
</select>
<!--COUNT_DISTINCT-->
<select class="form-control" chosen
- ng-if="newMeasure.function.parameter.type == 'column' && newMeasure.function.expression=='COUNT_DISTINCT'"
+ 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()" >
@@ -167,8 +168,15 @@
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>
<span class="font-color-default"
- ng-if="newMeasure.function.expression != 'COUNT_DISTINCT'"
+ ng-if="newMeasure.function.expression != 'COUNT_DISTINCT' && newMeasure.function.expression != 'TOP_N'"
><b> {{newMeasure.function.returntype | uppercase}}</b>
</span>
</div>
@@ -179,7 +187,7 @@
<div class="row">
<label class="col-xs-12 col-sm-3 control-label no-padding-right font-color-default"><b></b></label>
<div class="col-xs-12 col-sm-6">
- <table class="table table-hover table-bordered list" ng-if="nextParameters.length">
+ <table class="table table-hover table-bordered list" ng-if="nextParameters.length" ng-show="newMeasure.function.expression != 'TOP_N'">
<tr>
<th>Type</th>
<th>Value</th>
@@ -199,9 +207,30 @@
</tr>
</table>
- <button class="btn btn-sm btn-info" ng-click="addNextParameter()"
+
+ <table class="table table-hover table-bordered list" ng-if="nextParameters.length" ng-show="newMeasure.function.expression == 'TOP_N'">
+ <tr ng-repeat="n_parameter in nextParameters track by $index">
+ <td><b>Order By Column</b></td>
+ <td>{{n_parameter.value}}</td>
+ <td>
+ <button class="btn btn-xs btn-info" ng-click="editNextParameter(n_parameter)">
+ <i class="fa fa-pencil"></i>
+ </button>
+ <button class="btn btn-xs btn-info" ng-click="removeParameter(nextParameters, $index)"><i class="fa fa-minus"></i>
+ </button>
+
+ </td>
+
+ </tr>
+ </table>
+
+
+ <button class="btn btn-sm btn-info" ng-click="addNextParameter()" ng-show="newMeasure.function.expression != 'TOP_N'"
ng-show="state.mode=='edit'"><i class="fa fa-plus">Parameter</i>
</button>
+ <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"> Order by Column</i>
+ </button>
</div>
</div>
</div>
@@ -242,7 +271,8 @@
<script type="text/ng-template" id="nextParameter.html">
<div class="modal-header">
- <h4 tooltip="submit">Add Parameter</h4>
+ <h4 tooltip="submit" ng-if="newmea.measure&&newmea.measure.function.expression !== 'TOP_N'">Add Parameter</h4>
+ <h4 tooltip="submit" ng-if="newmea.measure&&newmea.measure.function.expression == 'TOP_N'">Select Order By Column</h4>
</div>
<div class="modal-body" style="background-color: white">
@@ -251,7 +281,7 @@
<div class="col-md-8">
<div class="row">
<div class="form-group">
- <div class="row">
+ <div class="row" ng-if="newmea.measure&&newmea.measure.function.expression !== 'TOP_N'">
<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"
@@ -272,8 +302,9 @@
<div class="col-md-8">
<div class="row">
<div class="form-group">
- <div class="row">
- <label class="col-xs-12 col-sm-3 control-label no-padding-right font-color-default"><b>Param Value</b></label>
+
+ <div ng-if="newmea.measure&&newmea.measure.function.expression !== 'TOP_N'" 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'"
@@ -285,8 +316,22 @@
ng-if="nextPara.type == 'constant'"
ng-init="nextPara.value = 1"><b> 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>Order 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 getMetricColumns()" >
+ <option value=""></option>
+ </select>
</div>
</div>
+
+
+ </div>
</div>
</div>
</div>