Skip to content

Commit b731230

Browse files
committed
[SPARK-4463] Add (de)select all button for add'l metrics.
This commit removes the behavior where when a user clicks "Show additional metrics" on the stage page, all of the additional metrics are automatically selected; now, collapsing and expanding the additional metrics has no effect on which options are selected. Instead, there's a "(De)select All" box at the top; checking this box checks all additional metrics (and similarly, unchecking it unchecks all additional metrics). This commit is intended to be backported to 1.2, so that the additional metrics behavior is not confusing to users.
1 parent 0f3ceb5 commit b731230

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

core/src/main/resources/org/apache/spark/ui/static/additional-metrics.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ $(function() {
2626
// Switch the class of the arrow from open to closed.
2727
$(this).find('.expand-additional-metrics-arrow').toggleClass('arrow-open');
2828
$(this).find('.expand-additional-metrics-arrow').toggleClass('arrow-closed');
29-
30-
// If clicking caused the metrics to expand, automatically check all options for additional
31-
// metrics (don't trigger a click when collapsing metrics, because it leads to weird
32-
// toggling behavior).
33-
if (!$(additionalMetricsDiv).hasClass('collapsed')) {
34-
$(this).parent().find('input:checkbox:not(:checked)').trigger('click');
35-
}
3629
});
3730

3831
$("input:checkbox:not(:checked)").each(function() {
@@ -48,6 +41,16 @@ $(function() {
4841
stripeTables();
4942
});
5043

44+
$("#select-all-metrics").click(function() {
45+
if (this.checked) {
46+
// Toggle all un-checked options.
47+
$('input:checkbox:not(:checked)').trigger('click');
48+
} else {
49+
// Toggle all checked options.
50+
$('input:checkbox:checked').trigger('click');
51+
}
52+
});
53+
5154
// Trigger a click on the checkbox if a user clicks the label next to it.
5255
$("span.additional-metric-title").click(function() {
5356
$(this).parent().find('input:checkbox').trigger('click');

core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ private[ui] class StagePage(parent: JobProgressTab) extends WebUIPage("stage") {
114114
</span>
115115
<div class="additional-metrics collapsed">
116116
<ul style="list-style-type:none">
117+
<li>
118+
<input type="checkbox" id="select-all-metrics"/>
119+
<span class="additional-metric-title">(De)select All</span>
120+
</li>
117121
<li>
118122
<span data-toggle="tooltip"
119123
title={ToolTips.SCHEDULER_DELAY} data-placement="right">

0 commit comments

Comments
 (0)