Skip to content

Commit

Permalink
Scroll down to the tasks table if the url contains any sort column
Browse files Browse the repository at this point in the history
  • Loading branch information
zsxwing committed Jul 19, 2015
1 parent a0746d1 commit 410586b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,21 @@ private[ui] class StagePage(parent: StagesTab) extends WebUIPage("stage") {
desc = taskSortDesc
)

val jsForScrollingDownToTaskTable =
<script>
{Unparsed {
"""
|$(function() {
| if (/.*&task.sort=.*$/.test(location.search)) {
| var topOffset = $("#tasks-section").offset().top;
| $("html,body").animate({scrollTop: topOffset}, 200);
| }
|});
""".stripMargin
}
}
</script>

val taskIdsInPage = taskTable.dataSource.pageData.data.map(_.taskId).toSet
// Excludes tasks which failed and have incomplete metrics
val validTasks = tasks.filter(t => t.taskInfo.status == "SUCCESS" && t.taskMetrics.isDefined)
Expand Down Expand Up @@ -490,7 +505,7 @@ private[ui] class StagePage(parent: StagesTab) extends WebUIPage("stage") {
<div>{summaryTable.getOrElse("No tasks have reported metrics yet.")}</div> ++
<h4>Aggregated Metrics by Executor</h4> ++ executorTable.toNodeSeq ++
maybeAccumulableTable ++
<h4>Tasks</h4> ++ taskTable.table
<h4 id="tasks-section">Tasks</h4> ++ taskTable.table ++ jsForScrollingDownToTaskTable
UIUtils.headerSparkPage(stageHeader, content, parent, showVisualization = true)
}
}
Expand Down

0 comments on commit 410586b

Please sign in to comment.