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/09/14 10:39:56 UTC
[02/11] kylin git commit: KYLIN-1786 UI for extended columns as
measure
KYLIN-1786 UI for extended columns as measure
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/5bc3830d
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/5bc3830d
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/5bc3830d
Branch: refs/heads/kylin-1.5.4-HBase1.x-release
Commit: 5bc3830dbf3f6da0daebd05df8a24b735e40dd98
Parents: cfa38cd
Author: Jason <ji...@163.com>
Authored: Tue Jul 12 20:38:46 2016 +0800
Committer: shaofengshi <sh...@apache.org>
Committed: Wed Sep 14 17:16:44 2016 +0800
----------------------------------------------------------------------
webapp/app/js/controllers/cubeEdit.js | 52 +++++++++++++++++++++
webapp/app/js/controllers/cubeMeasures.js | 1 -
webapp/app/js/directives/directives.js | 23 +++++++++
webapp/app/partials/cubeDesigner/measures.html | 7 +++
4 files changed, 82 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/5bc3830d/webapp/app/js/controllers/cubeEdit.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeEdit.js b/webapp/app/js/controllers/cubeEdit.js
index e2d0ab5..dd18d64 100755
--- a/webapp/app/js/controllers/cubeEdit.js
+++ b/webapp/app/js/controllers/cubeEdit.js
@@ -172,6 +172,58 @@ KylinApp.controller('CubeEditCtrl', function ($scope, $q, $routeParams, $locatio
};
+ $scope.getExtendedColumns = function (measure) {
+ //metric from model
+ 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 me_columns;
+
+ };
+
+ $scope.getExtendedFactColumns = function (measure) {
+ var me_columns = [];
+ angular.forEach($scope.metaModel.model.dimensions,function(dimension,index){
+ if($scope.metaModel.model.fact_table !== dimension.table){
+ return;
+ }
+
+ if(dimension.columns){
+ me_columns = me_columns.concat(dimension.columns);
+ }
+ })
+
+ return me_columns;
+
+ };
+
+
+ $scope.getFactColumns = function () {
+ var me_columns = [];
+ angular.forEach($scope.cubeMetaFrame.dimensions,function(dimension,index){
+ if($scope.metaModel.model.fact_table !== dimension.table){
+ return;
+ }
+ if(dimension.column && dimension.derived == null){
+ me_columns.push(dimension.column);
+ }
+
+ });
+
+ return me_columns;
+
+ };
+
+
$scope.getColumnType = function (_column, table) {
var columns = $scope.getColumnsByTable(table);
http://git-wip-us.apache.org/repos/asf/kylin/blob/5bc3830d/webapp/app/js/controllers/cubeMeasures.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeMeasures.js b/webapp/app/js/controllers/cubeMeasures.js
index 2f191f9..e4e749d 100644
--- a/webapp/app/js/controllers/cubeMeasures.js
+++ b/webapp/app/js/controllers/cubeMeasures.js
@@ -67,7 +67,6 @@ KylinApp.controller('CubeMeasuresCtrl', function ($scope, $modal,MetaModel,cubes
}
};
-
$scope.updateNextParameter = function(){
for(var i= 0;i<$scope.nextParameters.length-1;i++){
$scope.nextParameters[i].next_parameter=$scope.nextParameters[i+1];
http://git-wip-us.apache.org/repos/asf/kylin/blob/5bc3830d/webapp/app/js/directives/directives.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/directives/directives.js b/webapp/app/js/directives/directives.js
index f5051e8..f6fb91f 100644
--- a/webapp/app/js/directives/directives.js
+++ b/webapp/app/js/directives/directives.js
@@ -380,6 +380,29 @@ KylinApp.directive('kylinPagination', function ($parse, $q) {
};
}
};
+}).directive("extendedcolumntree", function($compile) {
+ return {
+ restrict: "E",
+ transclude: true,
+ scope: {
+ nextpara: '='
+ },
+ template:
+ '<li class="parent_li">Host Column:<b>{{nextpara.value}}</b></b></li>' +
+ '<li class="parent_li">Extended Column:<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);
+ });
+ };
+ }
+ };
}).directive('kylinpopover', function ($compile,$templateCache) {
return {
restrict: "A",
http://git-wip-us.apache.org/repos/asf/kylin/blob/5bc3830d/webapp/app/partials/cubeDesigner/measures.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/measures.html b/webapp/app/partials/cubeDesigner/measures.html
index 56c86be..7aba393 100755
--- a/webapp/app/partials/cubeDesigner/measures.html
+++ b/webapp/app/partials/cubeDesigner/measures.html
@@ -162,6 +162,13 @@
ng-options="column as column for column in getExtendedHostColumn()" >
<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()" >
+ <option value="">-- Select a Column --</option>
+ </select>
</div>
</div>
</div>