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 2015/03/03 11:08:07 UTC

[11/26] incubator-kylin git commit: update visulization code in cubedesigner to show model partial done

update visulization code in cubedesigner to show model partial done


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

Branch: refs/heads/streaming
Commit: 504f6bf351a5f75cde4eefb70d1040e9056425da
Parents: 10b5029
Author: jiazhong <ji...@ebay.com>
Authored: Sat Feb 28 15:01:39 2015 +0800
Committer: jiazhong <ji...@ebay.com>
Committed: Sat Feb 28 15:01:39 2015 +0800

----------------------------------------------------------------------
 webapp/app/js/controllers/cube.js          |   0
 webapp/app/js/controllers/cubeSchema.js    |   8 +-
 webapp/app/js/services/tree.js             | 159 ++++++++++++------------
 webapp/app/partials/cubes/cube_detail.html |   2 +-
 webapp/bower.json                          |   4 +-
 5 files changed, 90 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/504f6bf3/webapp/app/js/controllers/cube.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cube.js b/webapp/app/js/controllers/cube.js
old mode 100644
new mode 100755

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/504f6bf3/webapp/app/js/controllers/cubeSchema.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/controllers/cubeSchema.js b/webapp/app/js/controllers/cubeSchema.js
index 7bad2d8..17f7b71 100755
--- a/webapp/app/js/controllers/cubeSchema.js
+++ b/webapp/app/js/controllers/cubeSchema.js
@@ -18,7 +18,7 @@
 
 'use strict';
 
-KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserService, ProjectService, AuthenticationService,$filter,ModelService,MetaModel,CubeDescModel) {
+KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserService, ProjectService, AuthenticationService,$filter,ModelService,MetaModel,CubeDescModel,CubeList) {
 
     $scope.projects = [];
     $scope.newDimension = null;
@@ -65,6 +65,12 @@ KylinApp.controller('CubeSchemaCtrl', function ($scope, QueryService, UserServic
 
                     $scope.metaModel.model = model;
 
+                    // add model ref for cube
+                    angular.forEach(CubeList.cubes,function(cube){
+                        if(cube.name===$scope.cubeMetaFrame.name||cube.descriptor===$scope.cubeMetaFrame.name){
+                          cube.model = model;
+                        }
+                    });
                     //convert GMT mills ,to make sure partition date show GMT Date
                     //should run only one time
                     if($scope.metaModel.model.partition_desc&&$scope.metaModel.model.partition_desc.partition_date_start)

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/504f6bf3/webapp/app/js/services/tree.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/tree.js b/webapp/app/js/services/tree.js
old mode 100644
new mode 100755
index bee3ac6..0eaf5e7
--- a/webapp/app/js/services/tree.js
+++ b/webapp/app/js/services/tree.js
@@ -38,92 +38,93 @@ KylinApp.service('CubeGraphService', function () {
 
         var graphData = {
             "type": "fact",
-            "name": cube.detail.fact_table,
+            "name": cube.model.fact_table,
             "children": []
         };
 
-        angular.forEach(cube.detail.dimensions, function (dimension, index) {
-            if (dimension.join && dimension.join.primary_key.length > 0) {
-
-                var dimensionNode;
-
-                /* Loop through the graphData.children array to find out: If the LKP table is already existed */
-                for(var j = 0; j < graphData.children.length; j++ ) {
-                    if(graphData.children[j].name == dimension.table){
-                        dimensionNode = graphData.children[j];
-                        break;
-                    }
-                }
-
-                /* If not existed, create dimensionNode and push it */
-                if(j == graphData.children.length) {
-                    dimensionNode = {
-                        "type": "dimension",
-                        "name": dimension.table,
-                        "join": dimension.join,
-                        "children": [],
-                        "_children": []
-                    };
-                }
-
-                if (dimension.join && dimension.join.primary_key)
-                {
-                    angular.forEach(dimension.join.primary_key, function(pk, index){
-                        for (var i = 0; i < dimensionNode._children.length; i++) {
-                            if(dimensionNode._children[i].name == pk)
-                                break;
-                        }
-                        if(i == dimensionNode._children.length) {
-                            dimensionNode._children.push({
-                                "type": "column",
-                                "name": pk
-                            });
-                        }
-
-                    });
-                }
-
-                if (dimension.derived)
-                {
-                    angular.forEach(dimension.derived, function(derived, index){
-                        for (var i = 0; i < dimensionNode._children.length; i++) {
-                            if(dimensionNode._children[i].name == derived)
-                                break;
-                        }
-                        if(i == dimensionNode._children.length) {
-                            dimensionNode._children.push({
-                                "type": "column",
-                                "name": derived + "(DERIVED)"
-                            });
-                        }
-                    });
-                }
+        cube.graph = (!!cube.graph) ? cube.graph : {};
 
-                if (dimension.hierarchy)
-                {
-                    angular.forEach(dimension.hierarchy, function(hierarchy, index){
-                        for (var i = 0; i < dimensionNode._children.length; i++) {
-                            if(dimensionNode._children[i].name == hierarchy)
-                                break;
-                        }
-                        if(i == dimensionNode._children.length) {
-                            dimensionNode._children.push({
-                                "type": "column",
-                                "name": hierarchy.column + "(HIERARCHY)"
-                            });
-                        }
-                    });
-                }
+      //angular.forEach(cube.detail.dimensions, function (dimension, index) {
+      angular.forEach(cube.model.lookups, function (lookup, index) {
+        if (lookup.join && lookup.join.primary_key.length > 0) {
 
-                if(j == graphData.children.length) {
-                    graphData.children.push(dimensionNode);
-                }
+          var dimensionNode;
 
+          /* Loop through the graphData.children array to find out: If the LKP table is already existed */
+          for(var j = 0; j < graphData.children.length; j++ ) {
+            if(graphData.children[j].name == lookup.table){
+              dimensionNode = graphData.children[j];
+              break;
             }
-        });
-
-        cube.graph = (!!cube.graph) ? cube.graph : {};
-        cube.graph.columnsCount = 0;
+          }
+
+          /* If not existed, create dimensionNode and push it */
+          if(j == graphData.children.length) {
+            dimensionNode = {
+              "type": "dimension",
+              "name": lookup.table,
+              "join": lookup.join,
+              "children": [],
+              "_children": []
+            };
+          }
+
+          //if (dimension.join && dimension.join.primary_key)
+          //{
+          //    angular.forEach(dimension.join.primary_key, function(pk, index){
+          //        for (var i = 0; i < dimensionNode._children.length; i++) {
+          //            if(dimensionNode._children[i].name == pk)
+          //                break;
+          //        }
+          //        if(i == dimensionNode._children.length) {
+          //            dimensionNode._children.push({
+          //                "type": "column",
+          //                "name": pk
+          //            });
+          //        }
+          //
+          //    });
+          //}
+          //
+          //if (dimension.derived)
+          //{
+          //    angular.forEach(dimension.derived, function(derived, index){
+          //        for (var i = 0; i < dimensionNode._children.length; i++) {
+          //            if(dimensionNode._children[i].name == derived)
+          //                break;
+          //        }
+          //        if(i == dimensionNode._children.length) {
+          //            dimensionNode._children.push({
+          //                "type": "column",
+          //                "name": derived + "(DERIVED)"
+          //            });
+          //        }
+          //    });
+          //}
+          //
+          //if (dimension.hierarchy)
+          //{
+          //    angular.forEach(dimension.hierarchy, function(hierarchy, index){
+          //        for (var i = 0; i < dimensionNode._children.length; i++) {
+          //            if(dimensionNode._children[i].name == hierarchy)
+          //                break;
+          //        }
+          //        if(i == dimensionNode._children.length) {
+          //            dimensionNode._children.push({
+          //                "type": "column",
+          //                "name": hierarchy.column + "(HIERARCHY)"
+          //            });
+          //        }
+          //    });
+          //}
+
+          if(j == graphData.children.length) {
+            graphData.children.push(dimensionNode);
+          }
+
+        }
+      });
+      cube.graph.columnsCount = 0;
         cube.graph.tree = tree;
         cube.graph.root = graphData;
         cube.graph.svg = svg;

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/504f6bf3/webapp/app/partials/cubes/cube_detail.html
----------------------------------------------------------------------
diff --git a/webapp/app/partials/cubes/cube_detail.html b/webapp/app/partials/cubes/cube_detail.html
old mode 100644
new mode 100755
index 39a2860..6668b8d
--- a/webapp/app/partials/cubes/cube_detail.html
+++ b/webapp/app/partials/cubes/cube_detail.html
@@ -110,4 +110,4 @@
             </div>
         </div>
     </div>
-</div>
\ No newline at end of file
+</div>

http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/504f6bf3/webapp/bower.json
----------------------------------------------------------------------
diff --git a/webapp/bower.json b/webapp/bower.json
old mode 100644
new mode 100755
index 31ea559..be8eca3
--- a/webapp/bower.json
+++ b/webapp/bower.json
@@ -26,8 +26,8 @@
     "angular-ui-sortable": "0.13.1",
     "underscore": "~1.7.0",
     "fuelux": "~3.5.1",
-     "angular-animate": "1.2",
-     "angular-cookies":"1.2"
+    "angular-animate": "1.2",
+    "angular-cookies":"1.2"
 
   },
   "devDependencies": {