You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by zh...@apache.org on 2016/04/18 16:51:12 UTC
[1/2] kylin git commit: KYLIN-1587 show cube level configuration
overwrites properties in CubeDesigner
Repository: kylin
Updated Branches:
refs/heads/yang-m1 41fb735de -> aef842442
KYLIN-1587 show cube level configuration overwrites properties in CubeDesigner
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/aef84244
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/aef84244
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/aef84244
Branch: refs/heads/yang-m1
Commit: aef842442a7d7e2ee1ad931a376b36dd36157ac5
Parents: 209aa66
Author: Jason <ji...@163.com>
Authored: Mon Apr 18 22:50:32 2016 +0800
Committer: Jason <ji...@163.com>
Committed: Mon Apr 18 22:50:51 2016 +0800
----------------------------------------------------------------------
webapp/app/index.html | 1 +
webapp/app/js/controllers/cubeOverwriteProp.js | 71 ++++++++++++++++++++
webapp/app/js/controllers/cubeSchema.js | 49 +++++++-------
.../cubeDesigner/cubeOverwriteProp.html | 70 +++++++++++++++++++
4 files changed, 166 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/aef84244/webapp/app/index.html
----------------------------------------------------------------------
diff --git a/webapp/app/index.html b/webapp/app/index.html
index 82cef34..a25f812 100644
--- a/webapp/app/index.html
+++ b/webapp/app/index.html
@@ -179,6 +179,7 @@
<script src="js/controllers/cubeDimensions.js"></script>
<script src="js/controllers/cubeRefresh.js"></script>
<script src="js/controllers/cubeAdvanceSetting.js"></script>
+<script src="js/controllers/cubeOverwriteProp.js"></script>
<script src="js/controllers/cubeMeasures.js"></script>
<!--New GUI-->
<script src="js/controllers/modelSchema.js"></script>
http://git-wip-us.apache.org/repos/asf/kylin/blob/aef84244/webapp/app/js/controllers/cubeOverwriteProp.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeOverwriteProp.js b/webapp/app/js/controllers/cubeOverwriteProp.js
new file mode 100644
index 0000000..25e99d5
--- /dev/null
+++ b/webapp/app/js/controllers/cubeOverwriteProp.js
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+*/
+
+'use strict';
+
+KylinApp.controller('CubeOverWriteCtrl', function ($scope, $modal,cubeConfig,MetaModel,cubesManager,CubeDescModel) {
+ $scope.cubesManager = cubesManager;
+
+
+ //rowkey
+ $scope.convertedProperties = [];
+
+ for(var key in $scope.cubeMetaFrame.override_kylin_properties){
+ $scope.convertedProperties.push({
+ name:key,
+ value:$scope.cubeMetaFrame.override_kylin_properties[key]
+ });
+ }
+
+
+ $scope.addNewProperty = function () {
+ if($scope.cubeMetaFrame.override_kylin_properties.hasOwnProperty('')){
+ return;
+ }
+ $scope.cubeMetaFrame.override_kylin_properties['']='';
+ $scope.convertedProperties.push({
+ name:'',
+ value:''
+ });
+
+ };
+
+ $scope.refreshPropertiesObj = function(){
+ $scope.cubeMetaFrame.override_kylin_properties = {};
+ angular.forEach($scope.convertedProperties,function(item,index){
+ $scope.cubeMetaFrame.override_kylin_properties[item.name] = item.value;
+ })
+ }
+
+
+ $scope.refreshProperty = function(list,index,item){
+ $scope.convertedProperties[index] = item;
+ $scope.refreshPropertiesObj();
+ }
+
+
+ $scope.removeProperty= function(arr,index,item){
+ if (index > -1) {
+ arr.splice(index, 1);
+ }
+ delete $scope.cubeMetaFrame.override_kylin_properties[item.name];
+ }
+
+
+
+});
http://git-wip-us.apache.org/repos/asf/kylin/blob/aef84244/webapp/app/js/controllers/cubeSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeSchema.js b/webapp/app/js/controllers/cubeSchema.js
index 618e14e..f9d9dc1 100755
--- a/webapp/app/js/controllers/cubeSchema.js
+++ b/webapp/app/js/controllers/cubeSchema.js
@@ -35,6 +35,7 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
$scope.wizardSteps.push({title: 'Advanced Setting', src: 'partials/cubeDesigner/advanced_settings.html', isComplete: false,form:'cube_setting_form'});
}
//$scope.wizardSteps.push({title: 'Streaming', src: 'partials/cubeDesigner/streamingConfig.html', isComplete: false,form:'cube_streaming_form'});
+ $scope.wizardSteps.push({title: 'Configuration Overwrites ', src: 'partials/cubeDesigner/cubeOverwriteProp.html', isComplete: false,form:'cube_overwrite_prop_form'});
$scope.wizardSteps.push({title: 'Overview', src: 'partials/cubeDesigner/overview.html', isComplete: false,form:null});
$scope.curStep = $scope.wizardSteps[0];
@@ -200,8 +201,8 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
break;
case 'cube_setting_form':
return $scope.check_cube_setting();
- case 'cube_streaming_form':
- return $scope.kafka_ad_config_form();
+ case 'cube_overwrite_prop_form':
+ return $scope.cube_overwrite_prop_check();
default:
return true;
break;
@@ -290,31 +291,29 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
}
}
- $scope.kafka_ad_config_form = function(){
- if(!$scope.cubeState.isStreaming){
- return true;
- }
- var errors = [];
- if(!$scope.kafkaMeta.clusters.length){
- errors.push("Cluster can't be null");
- }
- angular.forEach($scope.kafkaMeta.clusters,function(cluster,index){
- if(!cluster.brokers.length){
- errors.push("No broker under Cluster-"+(index+1));
+ $scope.cube_overwrite_prop_check = function(){
+ var errors = [];
+
+ for(var key in $scope.cubeMetaFrame.override_kylin_properties){
+ if(key==''){
+ errors.push("Property name is required.");
+ }
+ if($scope.cubeMetaFrame.override_kylin_properties[key] == ''){
+ errors.push("Property value is required.");
+ }
}
- })
- var errorInfo = "";
- angular.forEach(errors,function(item){
- errorInfo+="\n"+item;
- });
- if(errors.length){
- SweetAlert.swal('', errorInfo, 'warning');
- return false;
- }else{
- return true;
- }
- }
+ var errorInfo = "";
+ angular.forEach(errors,function(item){
+ errorInfo+="\n"+item;
+ });
+ if(errors.length){
+ SweetAlert.swal('', errorInfo, 'warning');
+ return false;
+ }else{
+ return true;
+ }
+ }
// ~ private methods
function initProject() {
http://git-wip-us.apache.org/repos/asf/kylin/blob/aef84244/webapp/app/partials/cubeDesigner/cubeOverwriteProp.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/cubeOverwriteProp.html b/webapp/app/partials/cubeDesigner/cubeOverwriteProp.html
new file mode 100644
index 0000000..c1a1648
--- /dev/null
+++ b/webapp/app/partials/cubeDesigner/cubeOverwriteProp.html
@@ -0,0 +1,70 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+
+<div class="row" ng-controller="CubeOverWriteCtrl" style="padding-left:40px;">
+ <div class="col-xs-8">
+ <ng-form name="forms.cube_overwrite_prop_form" novalidate>
+ <!--Project-->
+ <div ng-repeat=" prop in convertedProperties track by $index " class="form-group">
+ <div class="row">
+ <label class="col-xs-12 col-sm-6 control-label no-padding-right" ng-class="{'has-error':prop.name==''}">
+ <b ng-if="state.mode=='view'">{{prop.name}}</b>
+ <input ng-model="prop.name" placeholder="key" ng-change="refreshProperty(convertedProperties,$index,prop)" class="form-control" ng-if="state.mode=='edit'"/>
+ <small style="font-weight: normal !important;" class="help-block" ng-show="prop.name==''">Property name is required.</small>
+ </label>
+ <div class="col-xs-12 col-sm-5" ng-class="{'has-error':prop.value==''}">
+ <input ng-model="prop.value" placeholder="value" ng-change="refreshProperty(convertedProperties,$index,prop)" class="form-control" ng-if="state.mode=='edit'"/>
+ <small class="help-block" ng-show="prop.value==''">Property value is required.</small>
+ <span ng-if="state.mode=='view'">{{prop.value}}</span>
+ </div>
+ <div class="col-sm-1" ng-if="state.mode=='edit'">
+ <button class="btn btn-xs btn-info" ng-click="removeProperty(convertedProperties,$index,prop)"><i class="fa fa-minus"></i>
+ </button>
+ </div>
+
+ </div>
+ </div>
+ </ng-form>
+ <!--Add Measures Property-->
+ <div class="form-group">
+ <button class="btn btn-sm btn-info" ng-click="addNewProperty();" ng-show="state.mode=='edit'">
+ <i class="fa fa-plus"></i> Property
+ </button>
+ </div>
+
+ </div>
+
+ <!--Tips-->
+ <div class="col-xs-4">
+ <div class="box box-solid">
+ <div class="box-header widget-header-flat">
+ <h4 class="box-title">Tips</h4>
+ </div>
+ <div class="box-body">
+ <div class="row">
+ <div class="col-xs-12">
+ <ol class="text-info">
+ <li>Cube level properties will overwrite configuration in kylin.prperties</li>
+ </ol>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+</div>
[2/2] kylin git commit: KYLIN-1569 Select any column when adding a
custom aggregation in GUI
Posted by zh...@apache.org.
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 <ji...@163.com>
Authored: Mon Apr 18 12:17:02 2016 +0800
Committer: Jason <ji...@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>