Skip to content

Commit

Permalink
[SPARK-13124][WEB UI] Fixed CSS and JS issues caused by addition of J…
Browse files Browse the repository at this point in the history
…Query DataTables

Made sure the old tables continue to use the old css and the new DataTables use the new css. Also fixed it so the Safari Web Inspector doesn't throw errors when on the new DataTables pages.

Author: Alex Bozarth <ajbozart@us.ibm.com>

Closes apache#11038 from ajbozarth/spark13124.
  • Loading branch information
ajbozarth authored and Sergei Lebedev committed Feb 15, 2017
1 parent 75dfa06 commit b627347
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private[history] class HistoryPage(parent: HistoryServer) extends WebUIPage("")
</a>
</div>
</div>
UIUtils.basicSparkPage(content, "History Server")
UIUtils.basicSparkPage(content, "History Server", true)
}

private def makePageLink(showIncomplete: Boolean): String = {
Expand Down
31 changes: 19 additions & 12 deletions core/src/main/scala/org/apache/spark/ui/UIUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -157,22 +157,11 @@ private[spark] object UIUtils extends Logging {
def commonHeaderNodes: Seq[Node] = {
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href={prependBaseUri("/static/bootstrap.min.css")} type="text/css"/>
<link rel="stylesheet"
href={prependBaseUri("/static/jquery.dataTables.1.10.4.min.css")} type="text/css"/>
<link rel="stylesheet"
href={prependBaseUri("/static/dataTables.bootstrap.css")} type="text/css"/>
<link rel="stylesheet" href={prependBaseUri("/static/jsonFormatter.min.css")} type="text/css"/>
<link rel="stylesheet" href={prependBaseUri("/static/vis.min.css")} type="text/css"/>
<link rel="stylesheet" href={prependBaseUri("/static/webui.css")} type="text/css"/>
<link rel="stylesheet" href={prependBaseUri("/static/timeline-view.css")} type="text/css"/>
<script src={prependBaseUri("/static/sorttable.js")} ></script>
<script src={prependBaseUri("/static/jquery-1.11.1.min.js")}></script>
<script src={prependBaseUri("/static/jquery.dataTables.1.10.4.min.js")}></script>
<script src={prependBaseUri("/static/jquery.cookies.2.2.0.min.js")}></script>
<script src={prependBaseUri("/static/jquery.blockUI.min.js")}></script>
<script src={prependBaseUri("/static/dataTables.bootstrap.min.js")}></script>
<script src={prependBaseUri("/static/jsonFormatter.min.js")}></script>
<script src={prependBaseUri("/static/jquery.mustache.js")}></script>
<script src={prependBaseUri("/static/vis.min.js")}></script>
<script src={prependBaseUri("/static/bootstrap-tooltip.js")}></script>
<script src={prependBaseUri("/static/initialize-tooltips.js")}></script>
Expand All @@ -189,6 +178,20 @@ private[spark] object UIUtils extends Logging {
<script src={prependBaseUri("/static/spark-dag-viz.js")}></script>
}

def dataTablesHeaderNodes: Seq[Node] = {
<link rel="stylesheet"
href={prependBaseUri("/static/jquery.dataTables.1.10.4.min.css")} type="text/css"/>
<link rel="stylesheet"
href={prependBaseUri("/static/dataTables.bootstrap.css")} type="text/css"/>
<link rel="stylesheet" href={prependBaseUri("/static/jsonFormatter.min.css")} type="text/css"/>
<script src={prependBaseUri("/static/jquery.dataTables.1.10.4.min.js")}></script>
<script src={prependBaseUri("/static/jquery.cookies.2.2.0.min.js")}></script>
<script src={prependBaseUri("/static/jquery.blockUI.min.js")}></script>
<script src={prependBaseUri("/static/dataTables.bootstrap.min.js")}></script>
<script src={prependBaseUri("/static/jsonFormatter.min.js")}></script>
<script src={prependBaseUri("/static/jquery.mustache.js")}></script>
}

/** Returns a spark page with correctly formatted headers */
def headerSparkPage(
title: String,
Expand Down Expand Up @@ -244,10 +247,14 @@ private[spark] object UIUtils extends Logging {
}

/** Returns a page with the spark css/js and a simple format. Used for scheduler UI. */
def basicSparkPage(content: => Seq[Node], title: String): Seq[Node] = {
def basicSparkPage(
content: => Seq[Node],
title: String,
useDataTables: Boolean = false): Seq[Node] = {
<html>
<head>
{commonHeaderNodes}
{if (useDataTables) dataTablesHeaderNodes else Seq.empty}
<title>{title}</title>
</head>
<body>
Expand Down

0 comments on commit b627347

Please sign in to comment.