Permalink
Browse files

* Fix some issues with pinning the tooltip

 * Add map and reduce progress
 * Update the tooltip live when these change.
  • Loading branch information...
1 parent 21fc8a8 commit a24b0397a44bb3d23dbe241f3445d15a02274e60 @philogb committed Jun 11, 2012
@@ -62,9 +62,11 @@ path.chord {
-ms-box-shadow: 0 0 5px rgba(0, 0, 0, 0.6);
}
+/*
.node.JOB_PROGRESS {
- background: blue;
+ background: green;
}
+*/
.node.JOB_FINISHED {
background: #aaa;
@@ -336,7 +336,7 @@ AMBROSE.chordView = function() {
/**
* Select the given job and update global state.
*/
- $(ui).bind("jobSelected JOB_STARTED JOB_FINISHED JOB_FAILED", function(event, data) {
+ $(ui).bind("jobSelected JOB_STARTED JOB_FINISHED JOB_FAILED JOB_PROGRESS", function(event, data) {
view.refreshDisplay(event, data);
})
},
@@ -120,7 +120,7 @@ AMBROSE.dagView = function () {
//add content to the tooltip when a node
//is hovered
onShow: function(tip, node, isLeaf, domElement) {
- var whiteList = ['aliases', 'features', 'jobId', 'status'],
+ var whiteList = ['aliases', 'features', 'jobId', 'status', 'map progress', 'reduce progress'],
data = node.data,
html = "<div class=\"tip-title\">" + node.name
+ "</div><div class=\'closetip\'>&#10006;</div><div class=\"tip-text\"><ul>";
@@ -131,7 +131,7 @@ AMBROSE.dagView = function () {
html += "<li><b>" + k + "</b>: <a href=\"http://hadoop-dw-jt.smf1.twitter.com:50030/jobdetails.jsp?jobid=" +
data[k] + "\" target=\"__blank\">" + data[k] + "</a></li>";
} else {
- html += "<li><b>" + k + "</b>: " + data[k] + "</li>";
+ html += "<li><b>" + k + "</b>: <span id=\"" + data['jobId'] + "_" + k + "\">" + data[k] + "</span></li>";
}
}
}
@@ -149,8 +149,15 @@ AMBROSE.dagView = function () {
style.width = nodeWidth + 'px';
domElement.addEventListener('click', function(e) {
- viz.tooltipPinned = !viz.tooltipPinned;
- viz.tips.tip.classList.toggle('pinned');
+ var tips = viz.tips;
+ if (tips.tip.classList.contains('pinned')) {
+ viz.tooltipPinned = false;
+ tips.tip.classList.remove('pinned');
+ tips.onMouseOut.call(tips, e, window);
+ } else {
+ viz.tooltipPinned = !viz.tooltipPinned;
+ tips.tip.classList.toggle('pinned');
+ }
}, false);
},
// Change node styles when DOM labels are placed
@@ -260,25 +267,47 @@ AMBROSE.dagView = function () {
var type = event.type,
id = data.job.name,
- n = viz.graph.getNode(id);
+ job = data.job,
+ n = viz.graph.getNode(id),
+ $id = function(d) { return document.getElementById(d); },
+ entry;
n.data.status = type;
+ if (job.mapProgress) {
+ n.data['map progress'] = (Math.round(job.mapProgress * 100)) + '%';
+ entry = $id(job.jobId + '_map progress');
+ if (entry) {
+ entry.innerHTML = n.data['map progress'];
+ }
+ }
+
+ if (job.reduceProgress) {
+ n.data['reduce progress'] = (Math.round(job.reduceProgress * 100)) + '%';
+ entry = $id(job.jobId + '_reduce progress');
+ if (entry) {
+ entry.innerHTML = n.data['reduce progress'];
+ }
+ }
+
if (n) {
var label = viz.fx.labels.getLabel(n.id),
update = false;
- label.className = 'node ' + type;
if (type == 'JOB_FINISHED') {
+ label.className = 'node ' + type;
n.eachAdjacency(function(a) {
a.setData('color', '#aaa');
});
update = true;
} else if (type == 'JOB_FAILED') {
+ label.className = 'node ' + type;
n.eachAdjacency(function(a) {
a.setData('color', '#c00');
});
update = true;
+ } else if (type == 'jobSelected') {
+ label.className = 'node ' + type;
}
if (update) {

0 comments on commit a24b039

Please sign in to comment.