Skip to content

Commit

Permalink
Prepare for the demo
Browse files Browse the repository at this point in the history
  • Loading branch information
zsxwing committed Apr 29, 2015
1 parent c81a1ee commit 8e4363c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@

.bar rect:hover {
//fill: rgb(49, 91, 125);
fill: #005580;
//fill: #005580;
fill: rgb(0, 194, 255);
}

.timeline {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,24 @@ function prepareDistribution(values, minY, maxY) {
var maxBarSize = d3.max(data, function(d) { return d.y; });
distributionMaxX = maxBarSize > distributionMaxX? maxBarSize : distributionMaxX;
}

function getUrlParameter(sParam)
{
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++)
{
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam)
{
return sParameterName[1];
}
}
}

$(function() {
if (getUrlParameter("show-receivers-detail") == "true") {
$('#inputs-table').toggle('collapsed');
$('#triangle').html('&#9660;');
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ private[ui] class StreamingPage(parent: StreamingTab)
since
<strong>
{UIUtils.formatDate(startTime)}
</strong>.
</strong>
</div>
<div> </div>
}

private def generateTimeMap(times: Seq[Long]): Seq[Node] = {
Expand Down Expand Up @@ -197,9 +198,11 @@ private[ui] class StreamingPage(parent: StreamingTab)
// JavaScript to show/hide the receiver sub table.
val triangleJs =
s"""$$('#inputs-table').toggle('collapsed');
|if ($$(this).html() == '$BLACK_RIGHT_TRIANGLE_HTML')
|$$(this).html('$BLACK_DOWN_TRIANGLE_HTML');
|else $$(this).html('$BLACK_RIGHT_TRIANGLE_HTML');""".stripMargin.replaceAll("\\n", "")
|var status = false;
|if ($$(this).html() == '$BLACK_RIGHT_TRIANGLE_HTML') {
|$$(this).html('$BLACK_DOWN_TRIANGLE_HTML');status = true;}
|else {$$(this).html('$BLACK_RIGHT_TRIANGLE_HTML');status = false;}
|window.history.pushState('', document.title, window.location.pathname + '?show-receivers-detail=' + status);""".stripMargin.replaceAll("\\n", "")

val timelineDataForEventRateOfAllReceivers =
new TimelineUIData(
Expand Down Expand Up @@ -282,9 +285,9 @@ private[ui] class StreamingPage(parent: StreamingTab)
<tbody>
<tr>
<td style="vertical-align: middle; width: 160px;">
<div style="width: 160px;">
<div style="width: 160px;">
<div>
<span onclick={Unparsed(triangleJs)}>{Unparsed(BLACK_RIGHT_TRIANGLE_HTML)}</span>
<span id="triangle" onclick={Unparsed(triangleJs)}>{Unparsed(BLACK_RIGHT_TRIANGLE_HTML)}</span>
<strong>Input Rate</strong>
</div>
<div>Avg: {eventRateForAllReceivers.formattedAvg} events/sec</div>
Expand Down Expand Up @@ -376,12 +379,12 @@ private[ui] class StreamingPage(parent: StreamingTab)
}.getOrElse(emptyCell)
val receiverLastErrorTime =
listener.receiverLastErrorTime(receiverId).map(UIUtils.formatDate).getOrElse(emptyCell)
val receivedRecords = listener.receivedRecordsWithBatchTime.get(receiverId).getOrElse(Seq())
val receivedRecords = new DoubleStatUIData(listener.receivedRecordsWithBatchTime.get(receiverId).getOrElse(Seq()))

val timelineForEventRate =
new TimelineUIData(
s"receiver-$receiverId-events-timeline",
receivedRecords,
receivedRecords.data,
minX,
maxX,
minY,
Expand All @@ -391,7 +394,7 @@ private[ui] class StreamingPage(parent: StreamingTab)
val distributionForEventsRate =
new DistributionUIData(
s"receiver-$receiverId-events-distribution",
receivedRecords.map(_._2),
receivedRecords.data.map(_._2),
minY,
maxY,
"events/sec").toHtml(jsCollector)
Expand All @@ -402,13 +405,13 @@ private[ui] class StreamingPage(parent: StreamingTab)
<div>
<strong>{receiverName}</strong>
</div>
<div>Avg: {avgReceiverEvents.map(_.toString).getOrElse(emptyCell)} events/sec</div>
<div>Avg: {receivedRecords.formattedAvg} events/sec</div>
</div>
</td>
<td>{receiverActive}</td>
<td>{receiverLocation}</td>
<td>{receiverLastErrorTime}</td>
<td>{receiverLastError}</td>
<td><div style="width: 292px;">{receiverLastError}</div></td>
</tr>
<tr>
<td colspan="3" class="timeline">
Expand Down

0 comments on commit 8e4363c

Please sign in to comment.