Skip to content

Commit

Permalink
Add tooltips for RDDs on job page
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Or committed May 7, 2015
1 parent 14502d5 commit 60e3758
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ function renderDagVizForJob(svgContainer) {
});
});

addTooltipsForRDDs(svgContainer);
drawCrossStageEdges(crossStageEdges, svgContainer);
}

Expand Down Expand Up @@ -424,6 +425,21 @@ function connectRDDs(fromRDDId, toRDDId, edgesContainer, svgContainer) {
edgesContainer.append("path").datum(points).attr("d", line);
}

/* (Job page only) Helper function to add tooltips for RDDs. */
function addTooltipsForRDDs(svgContainer) {
svgContainer.selectAll("g.node").each(function() {
var node = d3.select(this);
var tooltipText = node.attr("name");
if (tooltipText) {
node.select("circle")
.attr("data-toggle", "tooltip")
.attr("data-placement", "right")
.attr("title", tooltipText)
}
});
$("[data-toggle=tooltip]").tooltip({container: "body"});
}

/* Helper function to convert attributes to numeric values. */
function toFloat(f) {
if (f) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,11 @@ private[ui] object RDDOperationGraph extends Logging {
* On the stage page, it is displayed as a box with an embedded label.
*/
private def makeDotNode(node: RDDOperationNode, forJob: Boolean): String = {
val label = s"${node.name} (${node.id})"
if (forJob) {
s"""${node.id} [label=" " shape="circle" padding="5" labelStyle="font-size: 0"]"""
s"""${node.id} [label="$label" shape="circle" padding="5" labelStyle="font-size: 0"]"""
} else {
s"""${node.id} [label="${node.name} (${node.id})" padding="5" labelStyle="font-size: 10"]"""
s"""${node.id} [label="$label" padding="5" labelStyle="font-size: 10"]"""
}
}

Expand Down

0 comments on commit 60e3758

Please sign in to comment.