ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From srima...@apache.org
Subject ambari git commit: AMBARI-12673. Hive View: Visual Explain does not work (Pallav Kulshreshtha via srimanth)
Date Tue, 11 Aug 2015 18:16:10 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 6ae04cb95 -> 12c002c2c


AMBARI-12673. Hive View: Visual Explain does not work (Pallav Kulshreshtha via srimanth)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/12c002c2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/12c002c2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/12c002c2

Branch: refs/heads/trunk
Commit: 12c002c2c17b82d7bd078122bab45bdc97bb854b
Parents: 6ae04cb
Author: Srimanth Gunturi <sgunturi@hortonworks.com>
Authored: Tue Aug 11 11:11:52 2015 -0700
Committer: Srimanth Gunturi <sgunturi@hortonworks.com>
Committed: Tue Aug 11 11:15:52 2015 -0700

----------------------------------------------------------------------
 .../hive-web/app/controllers/visual-explain.js  |  2 +
 .../hive-web/app/templates/visual-explain.hbs   |  2 +
 .../ui/hive-web/app/views/visual-explain.js     | 63 +++++++++++---------
 3 files changed, 40 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/12c002c2/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
index 71e3c87..7ca6804 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/controllers/visual-explain.js
@@ -42,6 +42,8 @@ export default Ember.Controller.extend({
         //this condition should be changed once we change the way of retrieving this json
         if (json['STAGE PLANS']['Stage-1']) {
           self.set('json', json);
+        } else{
+          self.set('json', {})
         }
       }, function (error) {
         self.get('notifyService').error(error);

http://git-wip-us.apache.org/repos/asf/ambari/blob/12c002c2/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/visual-explain.hbs
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/visual-explain.hbs
b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/visual-explain.hbs
index 9cd9126..a415b2c 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/visual-explain.hbs
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/templates/visual-explain.hbs
@@ -23,6 +23,8 @@
     <div class="spinner"></div>
   {{/unless}}
 
+  <div id="no-visual-explain-graph"></div>
+
   <div id="visual-explain-graph">
     {{#each edge in view.edges}}
       <div class="edge">

http://git-wip-us.apache.org/repos/asf/ambari/blob/12c002c2/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
index 8d85e20..fb7fda9 100644
--- a/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
+++ b/contrib/views/hive/src/main/resources/ui/hive-web/app/views/visual-explain.js
@@ -24,6 +24,7 @@ import dagRules from '../utils/dag-rules';
 export default Ember.View.extend({
   verticesGroups: [],
   edges: [],
+  isVisualExplain: false,
 
   willInsertElement: function () {
     this.set('graph', new dagre.graphlib.Graph());
@@ -73,9 +74,12 @@ export default Ember.View.extend({
   }.observes('controller.verticesProgress.@each.value', 'verticesGroups'),
 
   jsonChanged: function () {
-    if (this.get('controller.json')) {
-      this.renderDag();
+
+    var json = this.get('controller.json');
+    if (json && json['STAGE PLANS'] != undefined) {
+      this.isVisualExplain = true;
     }
+    this.renderDag();
   }.observes('controller.json'),
 
   getOffset: function (el) {
@@ -139,8 +143,6 @@ export default Ember.View.extend({
       ruleNode,
       nodeLabelValue,
       self = this;
-    
-    contents = contents || [];  
 
     if (operator.constructor === Array) {
       operator.forEach(function (childOperator) {
@@ -425,40 +427,47 @@ export default Ember.View.extend({
   },
 
   renderDag: function () {
-    var convert = function (inputObj) {
-      var array = [];
-
-      for (var key in inputObj) {
-        if (inputObj.hasOwnProperty(key)) {
-          array.pushObject({
-            name: key,
-            value: inputObj[key]
-          });
+
+    if(this.isVisualExplain){
+      var convert = function (inputObj) {
+        var array = [];
+
+        for (var key in inputObj) {
+          if (inputObj.hasOwnProperty(key)) {
+            array.pushObject({
+              name: key,
+              value: inputObj[key]
+            });
+          }
         }
-      }
 
-      return array;
-    };
+        return array;
+      };
 
-    this.set('edges', []);
+      this.set('edges', []);
 
-    // Create a new directed graph
-    var g = this.get('graph');
+      // Create a new directed graph
+      var g = this.get('graph');
 
-    var graphData = this.get('controller.json')['STAGE PLANS']['Stage-1']['Tez'];
-    var vertices = convert(graphData['Vertices:']);
-    var edges = convert(graphData['Edges:']);
+      var graphData = this.get('controller.json')['STAGE PLANS']['Stage-1']['Tez'];
+      var vertices = convert(graphData['Vertices:']);
+      var edges = convert(graphData['Edges:']);
 
-    // Set an object for the graph label
-    g.setGraph({});
+      // Set an object for the graph label
+      g.setGraph({});
 
-    // Default to assigning a new object as a label for each new edge.
-    g.setDefaultEdgeLabel(function () { return {}; });
+      // Default to assigning a new object as a label for each new edge.
+      g.setDefaultEdgeLabel(function () { return {}; });
 
-    this.setNodes(vertices)
+      this.setNodes(vertices)
         .setEdges(edges)
         .setTableNodesAndEdges(vertices)
         .createNodeGroups()
         .renderEdges();
+
+    } else {
+      $('#no-visual-explain-graph').html('Visual explain is not available.');
+    }
+
   }
 });


Mime
View raw message