You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2016/11/06 09:30:44 UTC
[08/49] kylin git commit: KYLIN Add derived checkbox for lookup table
columns on Auto Generate Dimensions panel
KYLIN Add derived checkbox for lookup table columns on Auto Generate Dimensions panel
Signed-off-by: Jason <ji...@163.com>
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/81c6bd9f
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/81c6bd9f
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/81c6bd9f
Branch: refs/heads/KYLIN-1971
Commit: 81c6bd9f770b06e28a869b5f04eb7192bbb42949
Parents: ca976f3
Author: chenzhx <34...@qq.com>
Authored: Fri Oct 28 15:45:22 2016 +0800
Committer: Jason <ji...@163.com>
Committed: Mon Oct 31 17:08:56 2016 +0800
----------------------------------------------------------------------
webapp/app/js/controllers/cubeDimensions.js | 110 +++++++++++++++----
.../app/partials/cubeDesigner/dimensions.html | 26 ++---
2 files changed, 100 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/81c6bd9f/webapp/app/js/controllers/cubeDimensions.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeDimensions.js b/webapp/app/js/controllers/cubeDimensions.js
index ba71c96..7cb850b 100644
--- a/webapp/app/js/controllers/cubeDimensions.js
+++ b/webapp/app/js/controllers/cubeDimensions.js
@@ -74,11 +74,12 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
cols[i].isLookup = false;
// Default not selected and not disabled.
- factSelectAvailable[cols[i].name] = {name:cols[i].name ,selected: false, disabled: false};
+ factSelectAvailable[cols[i].name] = {name:cols[i].name ,selected: false};
}
$scope.availableColumns[factTable] = cols;
+ factSelectAvailable.all=false;
$scope.selectedColumns[factTable] = factSelectAvailable;
$scope.availableTables.push(factTable);
@@ -96,10 +97,11 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
cols2[k].isLookup = true;
// Default not selected and not disabled.
- lookupSelectAvailable[cols2[k].name] = {name:cols2[k].name,selected: false, disabled: false};
+ lookupSelectAvailable[cols2[k].name] = {name:cols2[k].name,selected: false};
}
$scope.availableColumns[lookups[j].table] = cols2;
+ lookupSelectAvailable.all=false;
$scope.selectedColumns[lookups[j].table] = lookupSelectAvailable;
if($scope.availableTables.indexOf(lookups[j].table)==-1){
$scope.availableTables.push(lookups[j].table);
@@ -111,14 +113,22 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
$scope.initColumnStatus = function () {
angular.forEach($scope.cubeMetaFrame.dimensions, function (dim) {
var cols = dimCols(dim);
-
angular.forEach(cols, function (colName) {
if(dim.derived){
- $scope.selectedColumns[dim.table][colName] = {name:dim.name, selected: true, disabled: true,normal:"false"};
+ $scope.selectedColumns[dim.table][colName] = {name:dim.name, selected: true, normal:"false"};
}else{
- $scope.selectedColumns[dim.table][colName] = {name:dim.name, selected: true, disabled: true,normal:"true"};
+ $scope.selectedColumns[dim.table][colName] = {name:dim.name, selected: true, normal:"true"};
}
- });
+ });
+ });
+ angular.forEach($scope.selectedColumns,function(value,table){
+ var all=true;
+ angular.forEach(value,function(col){
+ if(col.selected==false&&typeof col=="object"){
+ all=false;
+ }
+ });
+ $scope.selectedColumns[table].all=all;
});
};
@@ -300,9 +310,9 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
var cols = dimCols(dim);
angular.forEach(cols, function (colName) {
if(dim.table==$scope.metaModel.model.fact_table){
- $scope.selectedColumns[dim.table][colName] = {name:colName,selected: false, disabled: false};
+ $scope.selectedColumns[dim.table][colName] = {name:colName,selected: false};
}else{
- $scope.selectedColumns[dim.table][colName] = {name:colName,selected: false, disabled: false};
+ $scope.selectedColumns[dim.table][colName] = {name:colName,selected: false};
}
});
};
@@ -395,25 +405,77 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
};
$scope.autoChange= function(table,name){
- if($scope.selectedColumns[table][name].selected==false){
- $scope.selectedColumns[table][name].normal=null;
- if(table==$scope.metaModel.model.fact_table){
- $scope.selectedColumns[table][name].name=name;
- }else{
- $scope.selectedColumns[table][name].name=name;
- }
- }else{
- if($scope.metaModel.model.fact_table!=table){
- $scope.selectedColumns[table][name].normal="false";
- }
- }
+ if($scope.metaModel.model.fact_table==table){
+ if($scope.selectedColumns[table][name].selected==false){
+ $scope.selectedColumns[table].all=false;
+ }else{
+ var all=true;
+ angular.forEach($scope.selectedColumns[table],function(col){
+ if(col.selected==false&&typeof col=="object"){
+ all=false;
+ }
+ });
+ $scope.selectedColumns[table].all=all;
+ }
+ }
+ else{
+ if($scope.selectedColumns[table][name].selected==false){
+ $scope.selectedColumns[table].all=false;
+ $scope.selectedColumns[table][name].normal=null;
+ $scope.selectedColumns[table][name].name=name;
+ }else{
+ var all=true;
+ angular.forEach($scope.selectedColumns[table],function(col){
+ if(col.selected==false&&typeof col=="object"){
+ all=false;
+ }
+ });
+ $scope.selectedColumns[table].all=all;
+ if($scope.metaModel.model.fact_table!=table){
+ $scope.selectedColumns[table][name].normal="false";
+ }
+ }
+ }
+ }
+ $scope.autoChangeAll= function(table){
+ if($scope.metaModel.model.fact_table==table){
+ if($scope.selectedColumns[table].all==true){
+ angular.forEach($scope.selectedColumns[table],function(col){
+ if(typeof col==="object"){
+ col.selected=true;
+ }
+ })
+ }else{
+ angular.forEach($scope.selectedColumns[table],function(col){
+ if(typeof col==="object"){
+ col.selected=false;
+ }
+ })
+ }
+ }else{
+ if($scope.selectedColumns[table].all==true){
+ angular.forEach($scope.selectedColumns[table],function(col){
+ if(col.selected==false&&typeof col==="object"){
+ col.selected=true;
+ $scope.autoChange(table,col.name);
+ }
+ })
+ }else{
+ angular.forEach($scope.selectedColumns[table],function(col){
+ if(typeof col==="object"){
+ col.selected=false;
+ $scope.autoChange(table,col.name);
+ }
+ })
+ }
+ }
}
$scope.checkAutoDimension=function(){
var nameNull=false;
angular.forEach($scope.selectedColumns, function (value, table) {
angular.forEach(value, function (status, colName) {
- if (status.selected) {
+ if (status.selected&&typeof status=="object") {
if(status.name==""){
SweetAlert.swal('', "The name is requested.", 'warning');
nameNull=true;
@@ -442,8 +504,10 @@ KylinApp.controller('CubeDimensionsCtrl', function ($scope, $modal,MetaModel,cub
var selectedCols = $scope.getSelectedCols();
angular.forEach($scope.selectedColumns, function (value, table) {
angular.forEach(value, function (status, colName) {
- status.selected=false;
- status.normal=null;
+ if(typeof status=="object"){
+ status.selected=false;
+ status.normal=null;
+ }
});
});
};
http://git-wip-us.apache.org/repos/asf/kylin/blob/81c6bd9f/webapp/app/partials/cubeDesigner/dimensions.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/dimensions.html b/webapp/app/partials/cubeDesigner/dimensions.html
index d826575..62ca5c9 100644
--- a/webapp/app/partials/cubeDesigner/dimensions.html
+++ b/webapp/app/partials/cubeDesigner/dimensions.html
@@ -225,20 +225,22 @@
<script type="text/ng-template" id="autoGenDimension.html">
<div class="modal-header large-popover">
<h4 class="box-title lighter">Auto Generate Dimensions <i kylinpopover placement="right" title="Auto Generate Rules" template="AutoDimensionsTip.html" class="fa fa-info-circle"></i> <small>This is a helper for you to batch generate dimensions.</small></h4>
+ <div class="col-xs-12">
+ Visit <a href="http://kylin.apache.org/docs/howto/howto_optimize_cubes.html" target="_blank">derived column</a> for more about derived column.
+ </div>
</div>
<div class="modal-body">
<div class="row">
<div class="col-xs-12">
<div class="box box-solid">
- <div class="box-header"><h4>Columns</h4></div>
<div class="box-body">
<ul class="list-unstyled columns-region">
- <accordion close-others=false>
<!--FactTable-->
- <div ng-repeat="table in availableTables track by $index" ng-if="$index == 0" accordion-group class="panel-default " heading="{{table}}{{dataKylin.cube.cubeDSFactTable}}" is-open=true>
- <table class="table table-striped table-hover ng-scope">
+ <div ng-repeat="table in availableTables track by $index" ng-if="$index == 0" class="panel-default " >
+ <h4>{{table}}[FactTable]</h4>
+ <table class="table table-striped table-hover ng-scope" >
<tr >
- <td class="col-xs-1"></td>
+ <td class="col-xs-1"><label><input type="checkbox" ng-model="selectedColumns[table].all" ng-change="autoChangeAll(table)">Select All</label></td>
<td class="col-xs-4"><label>Name</label></td>
<td class="col-xs-3"><label>Columns</label></td>
<td colspan="2" class="col-xs-4"></td>
@@ -246,8 +248,7 @@
<tr ng-repeat="col in availableColumns[table] track by col.table + '.' + col.name" >
<td >
<label class="dim-checkbox-label">
- <input type="checkbox" ng-model="selectedColumns[table][col.name].selected"
- ng-disabled="selectedColumns[table][col.name].disabled" >
+ <input type="checkbox" ng-model="selectedColumns[table][col.name].selected" ng-change="autoChange(table,col.name)">
</label>
</td>
<td >
@@ -256,14 +257,16 @@
<td>
{{col.name}}
</td>
+ <td colspan="2"></td>
</tr>
</table>
</div>
<!--LookUp Table-->
- <div ng-repeat="table in availableTables track by $index" ng-if="$index > 0" accordion-group class="panel-default" heading="{{table}}{{dataKylin.cube.cubeDSLookupTable}}">
+ <div ng-repeat="table in availableTables track by $index" ng-if="$index > 0" class="panel-default" >
+ <h4>{{table}}[LookupTable]</h4>
<table class="table table-striped table-hover ng-scope">
<tr class="row" >
- <td class="col-xs-1"></td>
+ <td class="col-xs-1"><label><input type="checkbox" ng-model="selectedColumns[table].all" ng-change="autoChangeAll(table)">Select All</label></td>
<td class="col-xs-4"><label>Name</label></td>
<td class="col-xs-3"><label>Columns</label></td>
<td colspan="2" class="col-xs-4"></td>
@@ -271,8 +274,7 @@
<tr ng-repeat="col in availableColumns[table] track by col.table + '.' + col.name" class="row">
<td class=>
<label class="dim-checkbox-label">
- <input type="checkbox" ng-model="selectedColumns[table][col.name].selected"
- ng-disabled="selectedColumns[table][col.name].disabled" ng-change="autoChange(table,col.name)">
+ <input type="checkbox" ng-model="selectedColumns[table][col.name].selected" ng-change="autoChange(table,col.name)">
</label>
</td>
<td >
@@ -290,7 +292,6 @@
</tr>
</table>
</div>
- </accordion>
</ul>
</div>
</div>
@@ -308,7 +309,6 @@
<div class="row">
<div class="col-xs-12">
<ol class="text-info">
- <li>Column is disabled once there is already a dimension referred this column.</li>
<li>In fact table: one normal dimension will be auto generated per column.</li>
<li>In lookup table: you can choose to generate a derived column or a normal column.</li>
</ol>