Skip to content

Commit bec938f

Browse files
zsxwingtdas
authored andcommitted
[SPARK-7589] [STREAMING] [WEBUI] Make "Input Rate" in the Streaming page consistent with other pages
This PR makes "Input Rate" in the Streaming page consistent with Job and Stage pages. ![screen shot 2015-05-12 at 5 03 35 pm](https://cloud.githubusercontent.com/assets/1000778/7601444/f943f8ac-f8ca-11e4-8280-a715d814f434.png) ![screen shot 2015-05-12 at 5 07 25 pm](https://cloud.githubusercontent.com/assets/1000778/7601445/f9571c0c-f8ca-11e4-9b12-9317cb55c002.png) Author: zsxwing <[email protected]> Closes apache#6102 from zsxwing/SPARK-7589 and squashes the following commits: 2745225 [zsxwing] Make "Input Rate" in the Streaming page consistent with other pages
1 parent 0da254f commit bec938f

File tree

3 files changed

+30
-19
lines changed

3 files changed

+30
-19
lines changed

core/src/main/resources/org/apache/spark/ui/static/streaming-page.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@
5656
.histogram {
5757
width: auto;
5858
}
59+
60+
span.expand-input-rate {
61+
cursor: pointer;
62+
}

core/src/main/resources/org/apache/spark/ui/static/streaming-page.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,19 @@ $(function() {
266266
}
267267
}
268268

269-
if (getParameterFromURL("show-streams-detail") == "true") {
270-
// Show the details for all InputDStream
271-
$('#inputs-table').toggle('collapsed');
272-
$('#triangle').html('&#9660;');
269+
var status = getParameterFromURL("show-streams-detail") == "true";
270+
271+
$("span.expand-input-rate").click(function() {
272+
status = !status;
273+
$("#inputs-table").toggle('collapsed');
274+
// Toggle the class of the arrow between open and closed
275+
$(this).find('.expand-input-rate-arrow').toggleClass('arrow-open').toggleClass('arrow-closed');
276+
window.history.pushState('', document.title, window.location.pathname + '?show-streams-detail=' + status);
277+
});
278+
279+
if (status) {
280+
$("#inputs-table").toggle('collapsed');
281+
// Toggle the class of the arrow between open and closed
282+
$(this).find('.expand-input-rate-arrow').toggleClass('arrow-open').toggleClass('arrow-closed');
273283
}
274284
});

streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -244,17 +244,6 @@ private[ui] class StreamingPage(parent: StreamingTab)
244244
val maxEventRate = eventRateForAllStreams.max.map(_.ceil.toLong).getOrElse(0L)
245245
val minEventRate = 0L
246246

247-
// JavaScript to show/hide the InputDStreams sub table.
248-
val triangleJs =
249-
s"""$$('#inputs-table').toggle('collapsed');
250-
|var status = false;
251-
|if ($$(this).html() == '$BLACK_RIGHT_TRIANGLE_HTML') {
252-
|$$(this).html('$BLACK_DOWN_TRIANGLE_HTML');status = true;}
253-
|else {$$(this).html('$BLACK_RIGHT_TRIANGLE_HTML');status = false;}
254-
|window.history.pushState('',
255-
| document.title, window.location.pathname + '?show-streams-detail=' + status);"""
256-
.stripMargin.replaceAll("\\n", "") // it must be only one single line
257-
258247
val batchInterval = UIUtils.convertToTimeUnit(listener.batchDuration, normalizedUnit)
259248

260249
val jsCollector = new JsCollector
@@ -326,10 +315,18 @@ private[ui] class StreamingPage(parent: StreamingTab)
326315
<td style="vertical-align: middle;">
327316
<div style="width: 160px;">
328317
<div>
329-
{if (hasStream) {
330-
<span id="triangle" onclick={Unparsed(triangleJs)}>{Unparsed(BLACK_RIGHT_TRIANGLE_HTML)}</span>
331-
}}
332-
<strong>Input Rate</strong>
318+
{
319+
if (hasStream) {
320+
<span class="expand-input-rate">
321+
<span class="expand-input-rate-arrow arrow-closed"></span>
322+
<a data-toggle="tooltip" title="Show/hide details of each receiver" data-placement="right">
323+
<strong>Input Rate</strong>
324+
</a>
325+
</span>
326+
} else {
327+
<strong>Input Rate</strong>
328+
}
329+
}
333330
</div>
334331
<div>Avg: {eventRateForAllStreams.formattedAvg} events/sec</div>
335332
</div>

0 commit comments

Comments
 (0)