diff options
author | zsxwing <zsxwing@gmail.com> | 2015-05-14 23:51:41 -0700 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2015-05-14 23:51:41 -0700 |
commit | cf842d42a70398671c4bc5ebfa70f6fdb8c57c7f (patch) | |
tree | 646df61e446705a6c6ecf8f665b4319b19959d9a | |
parent | daf4ae72fe01b6d9631bfbd061b3846bdf668dfa (diff) | |
download | spark-cf842d42a70398671c4bc5ebfa70f6fdb8c57c7f.tar.gz spark-cf842d42a70398671c4bc5ebfa70f6fdb8c57c7f.tar.bz2 spark-cf842d42a70398671c4bc5ebfa70f6fdb8c57c7f.zip |
[SPARK-7650] [STREAMING] [WEBUI] Move streaming css and js files to the streaming project
cc tdas
Author: zsxwing <zsxwing@gmail.com>
Closes #6160 from zsxwing/SPARK-7650 and squashes the following commits:
fe6ae15 [zsxwing] Fix the import order
a4ffd99 [zsxwing] Merge branch 'master' into SPARK-7650
dc402b6 [zsxwing] Move streaming css and js files to the streaming project
-rw-r--r-- | core/src/main/scala/org/apache/spark/ui/WebUI.scala | 2 | ||||
-rw-r--r-- | streaming/src/main/resources/org/apache/spark/streaming/ui/static/streaming-page.css (renamed from core/src/main/resources/org/apache/spark/ui/static/streaming-page.css) | 0 | ||||
-rw-r--r-- | streaming/src/main/resources/org/apache/spark/streaming/ui/static/streaming-page.js (renamed from core/src/main/resources/org/apache/spark/ui/static/streaming-page.js) | 0 | ||||
-rw-r--r-- | streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala | 4 | ||||
-rw-r--r-- | streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingTab.scala | 12 |
5 files changed, 14 insertions, 4 deletions
diff --git a/core/src/main/scala/org/apache/spark/ui/WebUI.scala b/core/src/main/scala/org/apache/spark/ui/WebUI.scala index 384f2ad26e..1df9cd0fa1 100644 --- a/core/src/main/scala/org/apache/spark/ui/WebUI.scala +++ b/core/src/main/scala/org/apache/spark/ui/WebUI.scala @@ -94,7 +94,7 @@ private[spark] abstract class WebUI( } /** Detach a handler from this UI. */ - protected def detachHandler(handler: ServletContextHandler) { + def detachHandler(handler: ServletContextHandler) { handlers -= handler serverInfo.foreach { info => info.rootHandler.removeHandler(handler) diff --git a/core/src/main/resources/org/apache/spark/ui/static/streaming-page.css b/streaming/src/main/resources/org/apache/spark/streaming/ui/static/streaming-page.css index 19abe889ad..19abe889ad 100644 --- a/core/src/main/resources/org/apache/spark/ui/static/streaming-page.css +++ b/streaming/src/main/resources/org/apache/spark/streaming/ui/static/streaming-page.css diff --git a/core/src/main/resources/org/apache/spark/ui/static/streaming-page.js b/streaming/src/main/resources/org/apache/spark/streaming/ui/static/streaming-page.js index 0ee6752b29..0ee6752b29 100644 --- a/core/src/main/resources/org/apache/spark/ui/static/streaming-page.js +++ b/streaming/src/main/resources/org/apache/spark/streaming/ui/static/streaming-page.js diff --git a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala index 070564aa10..4ee7a486e3 100644 --- a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala +++ b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingPage.scala @@ -166,8 +166,8 @@ private[ui] class StreamingPage(parent: StreamingTab) private def generateLoadResources(): Seq[Node] = { // scalastyle:off <script src={SparkUIUtils.prependBaseUri("/static/d3.min.js")}></script> - <link rel="stylesheet" href={SparkUIUtils.prependBaseUri("/static/streaming-page.css")} type="text/css"/> - <script src={SparkUIUtils.prependBaseUri("/static/streaming-page.js")}></script> + <link rel="stylesheet" href={SparkUIUtils.prependBaseUri("/static/streaming/streaming-page.css")} type="text/css"/> + <script src={SparkUIUtils.prependBaseUri("/static/streaming/streaming-page.js")}></script> // scalastyle:on } diff --git a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingTab.scala b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingTab.scala index f307b54bb9..e0c0f57212 100644 --- a/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingTab.scala +++ b/streaming/src/main/scala/org/apache/spark/streaming/ui/StreamingTab.scala @@ -17,9 +17,11 @@ package org.apache.spark.streaming.ui +import org.eclipse.jetty.servlet.ServletContextHandler + import org.apache.spark.{Logging, SparkException} import org.apache.spark.streaming.StreamingContext -import org.apache.spark.ui.{SparkUI, SparkUITab} +import org.apache.spark.ui.{JettyUtils, SparkUI, SparkUITab} import StreamingTab._ @@ -30,6 +32,8 @@ import StreamingTab._ private[spark] class StreamingTab(val ssc: StreamingContext) extends SparkUITab(getSparkUI(ssc), "streaming") with Logging { + private val STATIC_RESOURCE_DIR = "org/apache/spark/streaming/ui/static" + val parent = getSparkUI(ssc) val listener = ssc.progressListener @@ -38,12 +42,18 @@ private[spark] class StreamingTab(val ssc: StreamingContext) attachPage(new StreamingPage(this)) attachPage(new BatchPage(this)) + var staticHandler: ServletContextHandler = null + def attach() { getSparkUI(ssc).attachTab(this) + staticHandler = JettyUtils.createStaticHandler(STATIC_RESOURCE_DIR, "/static/streaming") + getSparkUI(ssc).attachHandler(staticHandler) } def detach() { getSparkUI(ssc).detachTab(this) + getSparkUI(ssc).detachHandler(staticHandler) + staticHandler = null } } |