KYLIN 1875 UI replace table name with alias

Signed-off-by: lidongsjtu <lid...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/3c49c9e0
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/3c49c9e0
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/3c49c9e0

Branch: refs/heads/KYLIN-2428
Commit: 3c49c9e0c261ad0893c8911cc0f19804afea5516
Parents: 09a0866
Author: chenzhx <346839...@qq.com>
Authored: Fri Feb 10 14:48:47 2017 +0800
Committer: lidongsjtu <lid...@apache.org>
Committed: Fri Feb 10 20:59:55 2017 +0800

----------------------------------------------------------------------
 .../js/controllers/modelConditionsSettings.js   | 42 ++++++++++++++------
 webapp/app/js/controllers/modelDataModel.js     | 10 ++++-
 webapp/app/js/controllers/modelEdit.js          | 13 ------
 webapp/app/js/controllers/modelSchema.js        | 11 -----
 .../app/partials/cubeDesigner/dimensions.html   |  2 +-
 .../modelDesigner/conditions_settings.html      | 32 +++++++++++++--
 .../app/partials/modelDesigner/data_model.html  | 37 +++++++++++------
 .../modelDesigner/model_dimensions.html         |  4 +-
 .../partials/modelDesigner/model_measures.html  |  2 +-
 webapp/app/partials/models/model_edit.html      |  7 +---
 10 files changed, 96 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/3c49c9e0/webapp/app/js/controllers/modelConditionsSettings.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/modelConditionsSettings.js 
b/webapp/app/js/controllers/modelConditionsSettings.js
index b3e4998..004d5bc 100644
--- a/webapp/app/js/controllers/modelConditionsSettings.js
+++ b/webapp/app/js/controllers/modelConditionsSettings.js
@@ -25,14 +25,18 @@
 KylinApp.controller('ModelConditionsSettingsCtrl', function ($scope, 
$modal,MetaModel,modelsManager,VdmUtil) {
   $scope.modelsManager = modelsManager;
   $scope.availableFactTables = [];
-  
$scope.selectedTables={fact:VdmUtil.getNameSpaceAliasName($scope.modelsManager.selectedModel.partition_desc.partition_date_column)}
-  
$scope.availableFactTables.push(VdmUtil.removeNameSpace($scope.modelsManager.selectedModel.fact_table));
-  var joinTable = $scope.modelsManager.selectedModel.lookups;
-  for (var j = 0; j < joinTable.length; j++) {
-    if(joinTable[j].kind=='FACT'){
-      $scope.availableFactTables.push(joinTable[j].alias);
+  $scope.initSetting = function (){
+    
$scope.selectedTables={fact:VdmUtil.getNameSpaceAliasName($scope.modelsManager.selectedModel.partition_desc.partition_date_column)}
+    
$scope.selectedTablesForPartitionTime={fact:VdmUtil.getNameSpaceAliasName($scope.modelsManager.selectedModel.partition_desc.partition_time_column)}
+    
$scope.availableFactTables.push(VdmUtil.removeNameSpace($scope.modelsManager.selectedModel.fact_table));
+    var joinTable = $scope.modelsManager.selectedModel.lookups;
+    for (var j = 0; j < joinTable.length; j++) {
+      if(joinTable[j].kind=='FACT'){
+        $scope.availableFactTables.push(joinTable[j].alias);
+      }
     }
   }
+
   $scope.isFormatEdit = {editable:false};
   var judgeFormatEditable = function(dateColumn){
     if(dateColumn == null){
@@ -61,6 +65,21 @@ KylinApp.controller('ModelConditionsSettingsCtrl', function 
($scope, $modal,Meta
     return;
 
   };
+
+  $scope.getPartitonColumns = function(alias){
+    var columns = _.filter($scope.getColumnsByAlias(alias),function(column){
+      return 
column.datatype==="date"||column.datatype==="timestamp"||column.datatype==="string"||column.datatype.startsWith("varchar")||column.datatype==="bigint"||column.datatype==="int"||column.datatype==="integer";
+    });
+    return columns;
+  };
+
+  $scope.getPartitonTimeColumns = function(tableName,filterColumn){
+    var columns = 
_.filter($scope.getColumnsByAlias(tableName),function(column){
+      return 
(column.datatype==="time"||column.datatype==="timestamp"||column.datatype==="string"||column.datatype.startsWith("varchar"))&&(tableName+'.'+column.name!=filterColumn);
+    });
+    return columns;
+  };
+
   $scope.partitionChange = function (dateColumn) {
     judgeFormatEditable(dateColumn);
   };
@@ -68,14 +87,13 @@ KylinApp.controller('ModelConditionsSettingsCtrl', function 
($scope, $modal,Meta
       "hasSeparateTimeColumn" : false
   }
 
-  if (($scope.state.mode=='edit')&&($scope.isEdit = !!$scope.route.params)) {
-    
if($scope.modelsManager.selectedModel.partition_desc.partition_time_column){
-      $scope.partitionColumn.hasSeparateTimeColumn = true;
-    }
+  if ($scope.state.mode=='edit'){
+    $scope.initSetting();
     
judgeFormatEditable($scope.modelsManager.selectedModel.partition_desc.partition_date_column);
   }
-
-
+  if($scope.modelsManager.selectedModel.partition_desc.partition_time_column){
+    $scope.partitionColumn.hasSeparateTimeColumn = true;
+  }
   $scope.toggleHasSeparateColumn = function(){
     if($scope.partitionColumn.hasSeparateTimeColumn == false){
       $scope.modelsManager.selectedModel.partition_desc.partition_time_column 
= null;

http://git-wip-us.apache.org/repos/asf/kylin/blob/3c49c9e0/webapp/app/js/controllers/modelDataModel.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/modelDataModel.js 
b/webapp/app/js/controllers/modelDataModel.js
index 07009a2..02c44ea 100644
--- a/webapp/app/js/controllers/modelDataModel.js
+++ b/webapp/app/js/controllers/modelDataModel.js
@@ -269,8 +269,14 @@ KylinApp.controller('ModelDataModelCtrl', function 
($location,$scope, $modal,cub
           break;
         }
       }
-      
if($scope.aliasName.indexOf($scope.newLookup.alias)!=-1&&$scope.aliasName[$scope.lookupState.editingIndex+1]
 != $scope.newLookup.alias){
-        errors.push("Table Alias ["+$scope.newLookup.alias+"] already exist!");
+      if($scope.aliasName.indexOf($scope.newLookup.alias)!=-1){
+        if($scope.lookupState.editingIndex==-1){
+           errors.push("Table Alias ["+$scope.newLookup.alias+"] already 
exist!");
+        }else{
+          if($scope.aliasName[$scope.lookupState.editingIndex+1] != 
$scope.newLookup.alias){
+            errors.push("Table Alias ["+$scope.newLookup.alias+"] already 
exist!");
+          }
+        }
       }
       var errorInfo = "";
       angular.forEach(errors,function(item){

http://git-wip-us.apache.org/repos/asf/kylin/blob/3c49c9e0/webapp/app/js/controllers/modelEdit.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/modelEdit.js 
b/webapp/app/js/controllers/modelEdit.js
index 351e779..ff85f4f 100644
--- a/webapp/app/js/controllers/modelEdit.js
+++ b/webapp/app/js/controllers/modelEdit.js
@@ -37,19 +37,6 @@ KylinApp.controller('ModelEditCtrl', function ($scope, $q, 
$routeParams, $locati
     $scope.modelsManager = modelsManager;
     $scope.cubeConfig = cubeConfig;
 
-    $scope.getPartitonColumns = function(alias){
-        var columns = 
_.filter($scope.getColumnsByAlias(alias),function(column){
-            return 
column.datatype==="date"||column.datatype==="timestamp"||column.datatype==="string"||column.datatype.startsWith("varchar")||column.datatype==="bigint"||column.datatype==="int"||column.datatype==="integer";
-        });
-        return columns;
-    };
-
-    $scope.getPartitonTimeColumns = function(tableName){
-        var columns = 
_.filter($scope.getColumnsByTable(tableName),function(column){
-            return 
column.datatype==="time"||column.datatype==="timestamp"||column.datatype==="string"||column.datatype.startsWith("varchar");
-        });
-        return columns;
-    };
 
     $scope.getColumnsByTable = function (tableName) {
         var temp = [];

http://git-wip-us.apache.org/repos/asf/kylin/blob/3c49c9e0/webapp/app/js/controllers/modelSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/modelSchema.js 
b/webapp/app/js/controllers/modelSchema.js
index f917f1e..41a26bb 100644
--- a/webapp/app/js/controllers/modelSchema.js
+++ b/webapp/app/js/controllers/modelSchema.js
@@ -33,17 +33,6 @@ KylinApp.controller('ModelSchemaCtrl', function ($scope, 
QueryService, UserServi
     $scope.state = {mode: "view"};
   }
 
-  if(!$scope.partitionColumn){
-    $scope.partitionColumn ={
-      "hasSeparateTimeColumn" : false
-    }
-  }
-
-  if($scope.state.mode !== "edit" && 
$scope.modelsManager.selectedModel.partition_desc.partition_time_column){
-    $scope.partitionColumn.hasSeparateTimeColumn = true;
-  }
-
-
 
   $scope.wizardSteps = [
     {title: 'Model Info', src: 'partials/modelDesigner/model_info.html', 
isComplete: false, form: 'model_info_form'},

http://git-wip-us.apache.org/repos/asf/kylin/blob/3c49c9e0/webapp/app/partials/cubeDesigner/dimensions.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubeDesigner/dimensions.html 
b/webapp/app/partials/cubeDesigner/dimensions.html
index d8a8fce..b8bd05f 100644
--- a/webapp/app/partials/cubeDesigner/dimensions.html
+++ b/webapp/app/partials/cubeDesigner/dimensions.html
@@ -39,7 +39,7 @@
                 <tr>
                     <th>ID</th>
                     <th>Name</th>
-                    <th>Table Name</th>
+                    <th>Table Alias</th>
                     <th>Type</th>
                     <th>Column</th>
                     <th ng-if="state.mode=='edit'">Actions</th>

http://git-wip-us.apache.org/repos/asf/kylin/blob/3c49c9e0/webapp/app/partials/modelDesigner/conditions_settings.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/modelDesigner/conditions_settings.html 
b/webapp/app/partials/modelDesigner/conditions_settings.html
index 30fcb67..a39c8b3 100644
--- a/webapp/app/partials/modelDesigner/conditions_settings.html
+++ b/webapp/app/partials/modelDesigner/conditions_settings.html
@@ -79,7 +79,7 @@
               </div>
             </div>
           </div>
-          <!--Partition Time Column-->
+<!--          &lt;!&ndash;Partition Time Column&ndash;&gt;
           <div class="form-group" ng-if="partitionColumn.hasSeparateTimeColumn 
== true">
             <div class="row middle-popover">
               <label class="control-label col-xs-12 col-sm-3 no-padding-right 
font-color-default"><b>Partition Time Column</b>  <i kylinpopover 
placement="right" title="Partition Time Column" 
template="partitionTimeTip.html" class="fa fa-info-circle"></i></label>
@@ -90,16 +90,40 @@
                         ng-if="state.mode=='edit'"
                         data-placement=""
                         
ng-options="modelsManager.selectedModel.fact_table+'.'+columns.name as 
modelsManager.selectedModel.fact_table+'.'+columns.name for columns in 
getPartitonTimeColumns(modelsManager.selectedModel.fact_table)" >
-                  <option value="">--Select Partition Column--</option>
+                  <option value="">&#45;&#45;Select Partition 
Column&#45;&#45;</option>
                 </select>
-                <!--<small class="text-info" 
ng-show="state.mode=='edit'">(Column Type should be TIME Type)</small>-->
+                &lt;!&ndash;<small class="text-info" 
ng-show="state.mode=='edit'">(Column Type should be TIME 
Type)</small>&ndash;&gt;
 
                       <span ng-if="state.mode=='view'">
                           
{{!!(modelsManager.selectedModel.partition_desc.partition_time_column)?modelsManager.selectedModel.partition_desc.partition_time_column:
 ''}}</span>
               </div>
             </div>
-          </div>
+          </div>-->
 
+          <!--Partition Time Column-->
+          <div class="form-group" ng-if="partitionColumn.hasSeparateTimeColumn 
== true">
+            <div class="row middle-popover">
+              <label class="control-label col-xs-12 col-sm-3 no-padding-right 
font-color-default align-right"><b>Partition Time Column </b> <i kylinpopover 
placement="right" ng-title="Partition Time Column" 
template="partitionTimeTip.html" class="fa fa-info-circle"></i> </label>
+              <div class="col-xs-12 col-sm-6">
+                <select style="width: 49%" chosen
+                        ng-model="selectedTablesForPartitionTime.fact"
+                        ng-if="state.mode=='edit'"
+                        data-placement=""
+                        ng-options="alias as alias for alias in 
availableFactTables" >
+                  <option value="">--Select Partition Table--</option>
+                </select>
+                <select style="width: 49%" chosen
+                        
ng-model="modelsManager.selectedModel.partition_desc.partition_time_column"
+                        ng-if="state.mode=='edit'"
+                        data-placement=""
+                        
ng-options="selectedTablesForPartitionTime.fact+'.'+columns.name as 
columns.name for columns in 
getPartitonTimeColumns(selectedTablesForPartitionTime.fact,modelsManager.selectedModel.partition_desc.partition_date_column)">
+                  <option value="">--Select Partition Column--</option>
+                </select>
+                <span ng-if="state.mode=='view'">
+                      
{{!!(modelsManager.selectedModel.partition_desc.partition_time_column)?modelsManager.selectedModel.partition_desc.partition_time_column:
 ''}}</span>
+              </div>
+            </div>
+          </div>
           <!--Time Format-->
           <div class="form-group" ng-if="partitionColumn.hasSeparateTimeColumn 
== true">
             <div class="row">

http://git-wip-us.apache.org/repos/asf/kylin/blob/3c49c9e0/webapp/app/partials/modelDesigner/data_model.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/modelDesigner/data_model.html 
b/webapp/app/partials/modelDesigner/data_model.html
index 167c088..b55935e 100644
--- a/webapp/app/partials/modelDesigner/data_model.html
+++ b/webapp/app/partials/modelDesigner/data_model.html
@@ -23,7 +23,7 @@
     <div class="form-group" ng-class="{'required':state.mode=='edit'}">
         <div class="row">
             <label class="col-xs-12 col-sm-2 control-label 
concube.detailtrol-label no-padding-right font-color-default">
-                <b>Root Fact Table</b>
+                <b>Fact Table</b>
             </label>
             <div class="col-xs-12 col-sm-6" 
ng-class="{'has-error':forms.data_model_form.table_name.$invalid && 
(forms.data_model_form.table_name.$dirty||forms.data_model_form.$submitted)}">
               <select chosen ng-model="FactTable.root" 
ng-if="state.mode=='edit'"
@@ -46,7 +46,7 @@
             <div class="col-xs-6" ng-if="state.mode=='edit'">
                 <button type="button" class="btn btn-primary" 
ng-disabled="!modelsManager.selectedModel.fact_table.length"
                         ng-click="openLookupModal()">
-                    <i class="fa fa-plus"></i> Add Join Table
+                    <i class="fa fa-plus"></i> Add Lookup Table
                 </button>
             </div>
             <div class="col-xs-6" ng-if="state.mode!='edit'">
@@ -63,6 +63,7 @@
             <thead>
             <tr>
                 <th>ID</th>
+                <th>Table Alias</th>
                 <th>Table Name</th>
                 <th>Table Kind</th>
                 <th>Join Type</th>
@@ -75,13 +76,18 @@
                 <td>
                     <b>{{$index + 1}}</b>
                 </td>
-                <!-- Table Name -->
+                <!-- Table Alias -->
                 <td>
                     <span>{{lookup.alias}}</span>
                 </td>
+                <!-- Table Alias -->
+                <td>
+                    <span>{{lookup.table}}</span>
+                </td>
                 <!-- Table Kind -->
                 <td>
-                    <span>{{lookup.kind}}</span>
+                    <span ng-if="lookup.kind=='FACT'">Limited</span>
+                    <span ng-if="lookup.kind=='LOOKUP'">Normal</span>
                 </td>
                 <!-- Join Type -->
                 <td>
@@ -113,10 +119,10 @@
     </div>
     </ng-form>
 
-    <!-- Add Join Table Form -->
+    <!-- Add Lookup Table Form -->
     <script type="text/ng-template" id="dataModelLookupTable.html">
         <div class="modal-header">
-            <h4 class="box-title lighter">{{lookupState.editing ? 'Edit' : 
'Add'}} Join Table</h4>
+            <h4 class="box-title lighter">{{lookupState.editing ? 'Edit' : 
'Add'}} Lookup Table</h4>
         </div>
         <div class="modal-body">
             <div class="row">
@@ -132,10 +138,10 @@
                                       ng-required="true"
                                       data-placeholder="Join Table Name"
                                       class="chosen-select">
-                                <option value=""> &#45;&#45; Select Join Table 
&#45;&#45; </option>
+                                <option value=""> &#45;&#45; From Table 
&#45;&#45; </option>
                               </select>
                               <!--Join Type-->
-                              <select class="form-control"  chosen 
ng-model="newLookup.join.type" style="width:120px;"
+                              <select class="form-control"  chosen 
ng-init="newLookup.join.type='inner'"  ng-model="newLookup.join.type" 
style="width:120px;"
                                             ng-options="joinType.value as 
joinType.name for joinType in cubeConfig.joinTypes">
                                 <option value=""></option>
                               </select>
@@ -144,9 +150,9 @@
                                       ng-options="table.name as 
VdmUtil.removeNameSpace(table.name) for table in tableModel.selectProjectTables"
                                       name="table_name"  
ng-disabled="lookupState.editing"
                                       ng-required="true"  
ng-change="changeJoinTable()"
-                                      data-placeholder="Join Table Name"
+                                      data-placeholder="Lookup Table Name"
                                       class="chosen-select">
-                                <option value=""> &#45;&#45; Select Join Table 
&#45;&#45; </option>
+                                <option value=""> &#45;&#45; Select Lookup 
Table &#45;&#45; </option>
                               </select>
                             </div>
                           </div>
@@ -165,10 +171,12 @@
                     <!--Table Type-->
                     <div class="form-group">
                         <div class="row">
-                          <label class="col-sm-3 control-label 
font-color-default"><b>Table Type</b></label>
+                          <label class="col-sm-3"></label>
                           <div class="col-sm-6">
-                            <label> <input type="radio" 
ng-model="newLookup.kind" value="FACT" > Fact Table </label>
-                            <label> <input type="radio" 
ng-model="newLookup.kind" value="LOOKUP"> Lookup Table </label>
+                            <label>
+                              <input type="checkbox" ng-model="newLookup.kind" 
ng-true-value="FACT" ng-false-value="LOOKUP" >&nbsp;Is Limited
+                            </label>
+                            <i class="fa fa-info-circle" kylinpopover="" 
placement="right" title="" template="isLimited.html"></i>
                           </div>
                         </div>
                     </div>
@@ -243,3 +251,6 @@
 <script type="text/ng-template" id="tableInUse.html">
   <p>This table is in use in Cube.</p>
 </script>
+<script type="text/ng-template" id="isLimited.html">
+  <p>Some lookup table is too big (e.g. >300 MB) for snapshot, thus must be 
marked as limited. Limited lookup table cannot be queried directly and does not 
support derived dimensions.</p>
+</script>

http://git-wip-us.apache.org/repos/asf/kylin/blob/3c49c9e0/webapp/app/partials/modelDesigner/model_dimensions.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/modelDesigner/model_dimensions.html 
b/webapp/app/partials/modelDesigner/model_dimensions.html
index 6249521..cfa422f 100644
--- a/webapp/app/partials/modelDesigner/model_dimensions.html
+++ b/webapp/app/partials/modelDesigner/model_dimensions.html
@@ -27,7 +27,7 @@
                 <thead>
                     <tr>
                         <th>ID</th>
-                        <th>Table Name</th>
+                        <th>Table Alias</th>
                         <th>Columns</th>
                     </tr>
                 </thead>
@@ -56,7 +56,7 @@
                    class="table table-hover list">
                 <tr class="row">
                     <th class="col-xs-1">ID</th>
-                    <th class="col-xs-2">Table Name</th>
+                    <th class="col-xs-2">Table Alias</th>
                     <th class="col-xs-9">Columns</th>
                 </tr>
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/3c49c9e0/webapp/app/partials/modelDesigner/model_measures.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/modelDesigner/model_measures.html 
b/webapp/app/partials/modelDesigner/model_measures.html
index 1bb71b5..bf27914 100644
--- a/webapp/app/partials/modelDesigner/model_measures.html
+++ b/webapp/app/partials/modelDesigner/model_measures.html
@@ -47,7 +47,7 @@
                class="table table-hover list">
           <tr class="row">
             <th class="col-xs-1">ID</th>
-            <th class="col-xs-2">Table Name</th>
+            <th class="col-xs-2">Table Alias</th>
             <th class="col-xs-9">Columns</th>
           </tr>
 

http://git-wip-us.apache.org/repos/asf/kylin/blob/3c49c9e0/webapp/app/partials/models/model_edit.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/model_edit.html 
b/webapp/app/partials/models/model_edit.html
index d0c9814..5dbc3cf 100644
--- a/webapp/app/partials/models/model_edit.html
+++ b/webapp/app/partials/models/model_edit.html
@@ -17,10 +17,7 @@
 -->
 
 <div class="row">
-    <div class="col-xs-3">
-        <div ng-include src="'partials/tables/source_table_tree.html'" 
ng-controller="SourceMetaCtrl"></div>
-    </div>
-    <div class="col-xs-9">
+    <div class="col-xs-12">
         <form role="form" name="cube_form" novalidate>
             <!-- This margin in order to align with table tree in left part -->
             <div style="margin-top: 20px;">
@@ -30,4 +27,4 @@
         </form>
     </div>
 </div>
-</div>
\ No newline at end of file
+</div>

Reply via email to