Skip to content

Commit

Permalink
[SPARK-5733] Error Link in Pagination of HistroyPage when showing Inc…
Browse files Browse the repository at this point in the history
…omplete Applications

The links in pagination of HistroyPage is wrong when showing Incomplete Applications.

If "2" is click on the following page "http://history-server:18080/?page=1&showIncomplete=true", it will go to "http://history-server:18080/?page=2" instead of "http://history-server:18080/?page=2&showIncomplete=true".

Author: guliangliang <[email protected]>

Closes apache#4523 from marsishandsome/Spark5733 and squashes the following commits:

9d7b593 [guliangliang] [SPARK-5733] Error Link in Pagination of HistroyPage when showing Incomplete Applications
  • Loading branch information
guliangliang authored and srowen committed Feb 11, 2015
1 parent bd0d6e0 commit 1ac099e
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ private[spark] class HistoryPage(parent: HistoryServer) extends WebUIPage("") {
// page, `...` will be displayed.
if (allApps.size > 0) {
val leftSideIndices =
rangeIndices(actualPage - plusOrMinus until actualPage, 1 < _)
rangeIndices(actualPage - plusOrMinus until actualPage, 1 < _, requestedIncomplete)
val rightSideIndices =
rangeIndices(actualPage + 1 to actualPage + plusOrMinus, _ < pageCount)
rangeIndices(actualPage + 1 to actualPage + plusOrMinus, _ < pageCount,
requestedIncomplete)

<h4>
Showing {actualFirst + 1}-{last + 1} of {allApps.size}
Expand Down Expand Up @@ -122,8 +123,10 @@ private[spark] class HistoryPage(parent: HistoryServer) extends WebUIPage("") {
"Spark User",
"Last Updated")

private def rangeIndices(range: Seq[Int], condition: Int => Boolean): Seq[Node] = {
range.filter(condition).map(nextPage => <a href={"/?page=" + nextPage}> {nextPage} </a>)
private def rangeIndices(range: Seq[Int], condition: Int => Boolean, showIncomplete: Boolean):
Seq[Node] = {
range.filter(condition).map(nextPage =>
<a href={makePageLink(nextPage, showIncomplete)}> {nextPage} </a>)
}

private def appRow(info: ApplicationHistoryInfo): Seq[Node] = {
Expand Down

0 comments on commit 1ac099e

Please sign in to comment.