You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2015/08/11 20:15:08 UTC
ambari git commit: AMBARI-12673. Hive View: Visual Explain does not
work (Pallav Kulshreshtha via srimanth)
Repository: ambari
Updated Branches:
refs/heads/branch-2.1.1 f05944b7e -> 605636d30
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/605636d3
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/605636d3
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/605636d3
Branch: refs/heads/branch-2.1.1
Commit: 605636d30ad1d2ccb6688310af237ee50a190020
Parents: f05944b
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Tue Aug 11 11:11:52 2015 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Tue Aug 11 11:11: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/605636d3/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/605636d3/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/605636d3/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.');
+ }
+
}
});