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:08 UTC

[12/26] incubator-kylin git commit: enable visulization in cubeWizard

enable visulization in cubeWizard


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

Branch: refs/heads/streaming
Commit: 4b65f02bf0d6a7abc7829da5a376724d2ad63d9f
Parents: 504f6bf
Author: jiazhong <ji...@ebay.com>
Authored: Sat Feb 28 15:39:30 2015 +0800
Committer: jiazhong <ji...@ebay.com>
Committed: Sat Feb 28 15:39:30 2015 +0800

----------------------------------------------------------------------
 webapp/app/js/services/tree.js | 106 +++++++++++++++++++-----------------
 1 file changed, 56 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-kylin/blob/4b65f02b/webapp/app/js/services/tree.js
----------------------------------------------------------------------
diff --git a/webapp/app/js/services/tree.js b/webapp/app/js/services/tree.js
index 0eaf5e7..0a565af 100755
--- a/webapp/app/js/services/tree.js
+++ b/webapp/app/js/services/tree.js
@@ -69,62 +69,68 @@ KylinApp.service('CubeGraphService', function () {
             };
           }
 
-          //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;
+
+      angular.forEach(cube.detail.dimensions, function (dimension, index) {
+        // for dimension on lookup table
+        if(cube.model.fact_table!==dimension.table){
+            var lookup = _.find(graphData.children,function(item){
+              return item.name === dimension.table;
+            });
+
+          angular.forEach(lookup.join.primary_key, function(pk, index){
+                  for (var i = 0; i < lookup._children.length; i++) {
+                      if(lookup._children[i].name == pk)
+                          break;
+                  }
+                  if(i == lookup._children.length) {
+                    lookup._children.push({
+                          "type": "column",
+                          "name": pk
+                      });
+                  }
+          });
+
+          if (dimension.derived&&dimension.derived.length)
+          {
+              angular.forEach(dimension.derived, function(derived, index){
+                  for (var i = 0; i < lookup._children.length; i++) {
+                      if(lookup._children[i].name == derived)
+                          break;
+                  }
+                  if(i == lookup._children.length) {
+                    lookup._children.push({
+                          "type": "column",
+                          "name": derived + "(DERIVED)"
+                      });
+                  }
+              });
+          }
+
+          if (dimension.hierarchy)
+          {
+              angular.forEach(dimension.column, function(hierarchy, index){
+                  for (var i = 0; i < lookup._children.length; i++) {
+                      if(lookup._children[i].name == hierarchy)
+                          break;
+                  }
+                  if(i == lookup._children.length) {
+                    lookup._children.push({
+                          "type": "column",
+                          "name": hierarchy + "(HIERARCHY)"
+                      });
+                  }
+              });
+          }
+
+        };
+      });
+        cube.graph.columnsCount = 0;
         cube.graph.tree = tree;
         cube.graph.root = graphData;
         cube.graph.svg = svg;