Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-13124] [Web UI] Fixed CSS and JS issues caused by addition of JQuery DataTables #11038

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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