You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ma...@apache.org on 2015/05/15 07:22:05 UTC

[36/52] [abbrv] incubator-kylin git commit: try to use abn-tree for loaded table show

try to use abn-tree for loaded table show


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

Branch: refs/heads/0.8.0
Commit: b61dba0454cee877d4f9935e7b578cf51dd5d69e
Parents: db883f4
Author: jiazhong <ji...@ebay.com>
Authored: Thu Mar 26 15:58:21 2015 +0800
Committer: honma <ho...@ebay.com>
Committed: Fri May 15 11:36:53 2015 +0800

----------------------------------------------------------------------
 .../js/directives/kylin_abn_tree_directive.js   |  2 +
 webapp/app/js/model/tableModel.js               | 68 ++++++++++++++------
 webapp/app/partials/models/model_detail.html    |  2 +-
 webapp/app/partials/models/model_schema.html    |  4 +-
 webapp/app/partials/models/models.html          | 21 ++++--
 webapp/app/partials/models/models_tree.html     |  2 +-
 webapp/app/partials/tables/source_metadata.html | 17 +++++
 .../app/partials/tables/source_table_tree.html  | 16 ++---
 webapp/app/partials/tables/table_detail.html    | 32 ++++++++-
 9 files changed, 128 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/b61dba04/webapp/app/js/directives/kylin_abn_tree_directive.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/directives/kylin_abn_tree_directive.js b/webapp/app/js/directives/kylin_abn_tree_directive.js
index f309995..dd75d15 100644
--- a/webapp/app/js/directives/kylin_abn_tree_directive.js
+++ b/webapp/app/js/directives/kylin_abn_tree_directive.js
@@ -17,6 +17,7 @@
           treeControl: '='
         },
         link: function(scope, element, attrs) {
+            console.log(attrs.iconLeaf);
           var error, expand_all_parents, expand_level, for_all_ancestors, for_each_branch, get_parent, n, on_treeData_change, select_branch, selected_branch, tree;
           error = function(s) {
             console.log('ERROR:' + s);
@@ -193,6 +194,7 @@
               }
               if (!branch.noLeaf && (!branch.children || branch.children.length === 0)) {
                 tree_icon = attrs.iconLeaf;
+
                 if (__indexOf.call(branch.classes, "leaf") < 0) {
                   branch.classes.push("leaf");
                 }

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/b61dba04/webapp/app/js/model/tableModel.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/model/tableModel.js b/webapp/app/js/model/tableModel.js
index 687acb5..b812b24 100755
--- a/webapp/app/js/model/tableModel.js
+++ b/webapp/app/js/model/tableModel.js
@@ -16,7 +16,7 @@
  * limitations under the License.
 */
 
-KylinApp.service('TableModel', function(ProjectModel,$q,TableService) {
+KylinApp.service('TableModel', function(ProjectModel,$q,TableService,$log) {
 
 
     var _this = this;
@@ -43,21 +43,6 @@ KylinApp.service('TableModel', function(ProjectModel,$q,TableService) {
     this.init = function(){
       this.selectedSrcDb = [];
       this.selectedSrcTable = {};
-    }
-
-
-    this.treeOptions = {
-        nodeChildren: "columns",
-        injectClasses: {
-            ul: "a1",
-            li: "a2",
-            liSelected: "a7",
-            iExpanded: "a3",
-            iCollapsed: "a4",
-            iLeaf: "a5",
-            label: "a6",
-            labelSelected: "a8"
-        }
     };
 
     this.aceSrcTbLoaded = function (forceLoad) {
@@ -79,6 +64,9 @@ KylinApp.service('TableModel', function(ProjectModel,$q,TableService) {
         TableService.list(param, function (tables) {
             var tableMap = [];
             angular.forEach(tables, function (table) {
+
+                var tableData = [];
+
                 if (!tableMap[table.database]) {
                     tableMap[table.database] = [];
                 }
@@ -102,10 +90,50 @@ KylinApp.service('TableModel', function(ProjectModel,$q,TableService) {
             _this.selectedSrcDb = [];
             for (var key in  tableMap) {
                 var tables = tableMap[key];
-                _this.selectedSrcDb.push({
-                    "name": key,
-                    "columns": tables
-                });
+
+                var _db_node = {
+                    label:key,
+                    data:tables,
+                    onSelect:function(branch){
+                        $log.info("db "+key +"selected");
+                    }
+                }
+
+
+                angular.forEach(tables,function(_table){
+                        var _table_node_list = [];
+
+                        var _table_node = {
+                            label:_table.name,
+//                            noLeaf:true,
+                            data:_table,
+                            onSelect:function(branch){
+                                // set selected model
+                                _this.selectedSrcTable = branch.data;
+                            }
+                        }
+
+                        var _column_node_list = [];
+                        angular.forEach(_table.columns,function(_column){
+                            _column_node_list.push({
+                                    label:_column.name,
+                                    noLeaf:true,
+                                    data:_column,
+                                    onSelect:function(branch){
+                                        // set selected model
+//                                        _this.selectedSrcTable = branch.data;
+                                        $log.info("selected column info:"+_column.name);
+                                    }
+                                });
+                        });
+                         _table_node.children =_column_node_list;
+                        _table_node_list.push(_table_node);
+
+                        _db_node.children = _table_node_list;
+                    }
+                );
+
+                _this.selectedSrcDb.push(_db_node);
             }
             defer.resolve();
         });

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/b61dba04/webapp/app/partials/models/model_detail.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/model_detail.html b/webapp/app/partials/models/model_detail.html
index 5f2830d..1808d5e 100644
--- a/webapp/app/partials/models/model_detail.html
+++ b/webapp/app/partials/models/model_detail.html
@@ -9,7 +9,7 @@
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
-* Unless required by applicable law or agreed to in writing, software
+* Unless required by applnewAccess.sidicable 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

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/b61dba04/webapp/app/partials/models/model_schema.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/model_schema.html b/webapp/app/partials/models/model_schema.html
index aef280b..67adf69 100644
--- a/webapp/app/partials/models/model_schema.html
+++ b/webapp/app/partials/models/model_schema.html
@@ -72,7 +72,8 @@
 <div ng-show="state.mode=='view'&&!models_treedata.length" style="margin-top:40px;">
     <div class="box box-primary">
         <div class="box-header with-border">
-            <h3 class="box-title">No model</h3>
+            <i class="fa fa-bullhorn"></i>
+            <h3 class="box-title">No models</h3>
         </div>
         <div class="box-body">
             <p>
@@ -86,6 +87,7 @@
 <div ng-show="state.mode=='view'&&!!models_treedata.length&&!model.name" style="margin-top:40px;">
     <div class="box box-primary">
         <div class="box-header with-border">
+            <i class="fa fa-bullhorn"></i>
             <h3 class="box-title">No model selected</h3>
         </div>
         <div class="box-body">

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/b61dba04/webapp/app/partials/models/models.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/models.html b/webapp/app/partials/models/models.html
index e4e7d57..8e592ee 100644
--- a/webapp/app/partials/models/models.html
+++ b/webapp/app/partials/models/models.html
@@ -15,6 +15,19 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 -->
+
+<div class="page-header" style="height: 50px;">
+    <!--Project-->
+    <form class="navbar-form navbar-left" style="margin-top: 0px !important;" ng-if="userService.isAuthorized()">
+        <div class="form-group">
+            <a class="btn btn-xs btn-info" href="projects" tooltip="Manage Project"><i class="fa fa-gears"></i></a>
+            <a class="btn btn-xs btn-primary" ng-if="userService.hasRole('ROLE_ADMIN')||userService.hasRole('ROLE_MODELER')&&kylinConfig.getDeployEnv()!=='PROD'" style="width: 29px" tooltip="Add Project" ng-click="toCreateProj()">
+                <i class="fa fa-plus"></i>
+            </a>
+        </div>
+    </form>
+</div>
+
 <div class="row models-main"  style="padding-top:10px;">
     <!--table_tree-->
 
@@ -28,14 +41,14 @@
             </tab>
         </tabset>
     </div>
-    <div  ng-show="showModels&&!cubeSelected"  class="col-xs-9 models-main">
+    <div  ng-if="showModels&&!cubeSelected"  class="col-xs-9 models-main">
         <div ng-include src="'partials/models/model_detail.html'"></div>
     </div>
-    <div  ng-show="showModels&&cubeSelected"  class="col-xs-9 models-main">
+    <div  ng-if="showModels&&cubeSelected"  class="col-xs-9 models-main">
         <div ng-include src="'partials/cubes/cube_detail.html'"></div>
     </div>
 
-    <div ng-show="!showModels" class="col-xs-9 models-main">
+    <div ng-if="!showModels" class="col-xs-9 models-main">
         <div ng-include src="'partials/tables/table_detail.html'"></div>
     </div>
 
@@ -45,4 +58,4 @@
 <div ng-include="'partials/jobs/job_submit.html'"></div>
 <div ng-include="'partials/jobs/job_refresh.html'"></div>
 <div ng-include="'partials/jobs/job_merge.html'"></div>
-<div ng-include="'partials/projects/project_create.html'"></div>
\ No newline at end of file
+<div ng-include="'partials/projects/project_create.html'"></div>

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/b61dba04/webapp/app/partials/models/models_tree.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/models/models_tree.html b/webapp/app/partials/models/models_tree.html
index 727c498..142ef0b 100644
--- a/webapp/app/partials/models/models_tree.html
+++ b/webapp/app/partials/models/models_tree.html
@@ -40,6 +40,6 @@
                 icon-collapse     = "fa fa-star-o"
                 expand-level      = "2"
                 initial-selection = "">
-            ></abn-tree>
+            </abn-tree>
     </div>
 </div>

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/b61dba04/webapp/app/partials/tables/source_metadata.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/source_metadata.html b/webapp/app/partials/tables/source_metadata.html
index d7b5a1e..8e39c95 100755
--- a/webapp/app/partials/tables/source_metadata.html
+++ b/webapp/app/partials/tables/source_metadata.html
@@ -157,6 +157,23 @@
         </div>
     </div>
 
+
+    <!--show load hive table tip when no models list-->
+    <div ng-show="!models_treedata.length" style="margin-top:40px;">
+        <div class="box box-primary">
+            <div class="box-header with-border">
+                <h3 class="box-title">No tables</h3>
+            </div>
+            <div class="box-body">
+                <p>
+                    <a href="models/add" ng-if="userService.hasRole('ROLE_MODELER')">Click here to load your hive table</a>
+                </p>
+            </div><!-- /.box-body -->
+        </div>
+    </div>
+
+
+
     <script type="text/ng-template" id="addHiveTable.html">
         <div class="modal-header">
             <h4>Load Hive Table Metadata</h4>

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/b61dba04/webapp/app/partials/tables/source_table_tree.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/source_table_tree.html b/webapp/app/partials/tables/source_table_tree.html
index 627234e..deb5a64 100755
--- a/webapp/app/partials/tables/source_table_tree.html
+++ b/webapp/app/partials/tables/source_table_tree.html
@@ -34,13 +34,13 @@
     <div class="space-4"></div>
     <!--tree-->
     <div style="width:100%; height:{{window}}px; overflow:auto;">
-        <treecontrol ng-if="tableModel.selectedSrcDb.length > 0" class="tree-light"
-                     dirSelection="true"
-                     tree-model="tableModel.selectedSrcDb"
-                     options="tableModel.treeOptions"
-                     on-selection="showSelected(node)"
-                     selected-node="tableModel.selectedSrcTable">
-            {{node.name}} {{!!(node.datatype)?'(' + trimType(node.datatype) + ')' : ''}}
-        </treecontrol>
+        <abn-tree
+                tree-data         = "tableModel.selectedSrcDb"
+                tree-control      = "my_tree"
+                icon-leaf         = "fa fa-table"
+                icon-expand       = "fa fa-database"
+                icon-collapse     = "fa fa-database"
+                expand-level      = "3">
+        </abn-tree>
     </div>
 </div>

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/b61dba04/webapp/app/partials/tables/table_detail.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/tables/table_detail.html b/webapp/app/partials/tables/table_detail.html
index 9801eb1..44d2978 100644
--- a/webapp/app/partials/tables/table_detail.html
+++ b/webapp/app/partials/tables/table_detail.html
@@ -1,5 +1,5 @@
 <div  ng-controller="SourceMetaCtrl" class="nav-tabs-custom">
-    <div class="col-xs-12">
+    <div class="col-xs-12" ng-show="models_treedata.length&&tableModel.selectedSrcTable.name">
         <h3 class="text-info">Table Schema:{{ tableModel.selectedSrcTable.name}}</h3>
         <div class="tabbable nav-tabs-custom">
             <ul class="nav nav-tabs">
@@ -120,6 +120,36 @@
         </div>
     </div>
 
+
+    <!--show load hive table tip when no models list-->
+    <div ng-show="!models_treedata.length" style="margin-top:40px;">
+        <div class="box box-primary">
+            <div class="box-header with-border">
+                <i class="fa fa-bullhorn"></i>
+                <h3 class="box-title">No tables</h3>
+            </div>
+            <div class="box-body">
+                <div>
+                    <a tooltip="Load Hive Table" href="javascript:void(0);" ng-if="userService.hasRole('ROLE_MODELER')" ng-click="openModal()">Click here to load your hive table</a>
+                </div>
+            </div><!-- /.box-body -->
+        </div>
+    </div>
+
+    <!--show load hive table tip when no models list-->
+    <div ng-show="models_treedata.length&&!tableModel.selectedSrcTable.name" style="margin-top:40px;">
+        <div class="box box-primary">
+            <div class="box-header with-border">
+                <i class="fa fa-bullhorn"></i>
+                <h3 class="box-title">No table selected</h3>
+            </div>
+            <div class="box-body">
+                Select your table
+            </div><!-- /.box-body -->
+        </div>
+    </div>
+
+
     <script type="text/ng-template" id="addHiveTable.html">
         <div class="modal-header">
             <h4>Load Hive Table Metadata</h4>