Skip to content

Commit 86b3929

Browse files
mengxrandrewor14
authored andcommitted
[SPARK-3844][UI] Truncate appName in WebUI if it is too long
Truncate appName in WebUI if it is too long. Author: Xiangrui Meng <[email protected]> Closes apache#2707 from mengxr/truncate-app-name and squashes the following commits: 87834ce [Xiangrui Meng] move scala import below java c7111dc [Xiangrui Meng] truncate appName in WebUI if it is too long
1 parent b9df8af commit 86b3929

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/main/scala/org/apache/spark/ui/UIUtils.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import java.text.SimpleDateFormat
2121
import java.util.{Locale, Date}
2222

2323
import scala.xml.Node
24+
2425
import org.apache.spark.Logging
2526

2627
/** Utility functions for generating XML pages with spark content. */
@@ -169,6 +170,7 @@ private[spark] object UIUtils extends Logging {
169170
refreshInterval: Option[Int] = None): Seq[Node] = {
170171

171172
val appName = activeTab.appName
173+
val shortAppName = if (appName.length < 36) appName else appName.take(32) + "..."
172174
val header = activeTab.headerTabs.map { tab =>
173175
<li class={if (tab == activeTab) "active" else ""}>
174176
<a href={prependBaseUri(activeTab.basePath, "/" + tab.prefix)}>{tab.name}</a>
@@ -187,7 +189,9 @@ private[spark] object UIUtils extends Logging {
187189
<img src={prependBaseUri("/static/spark-logo-77x50px-hd.png")} />
188190
</a>
189191
<ul class="nav">{header}</ul>
190-
<p class="navbar-text pull-right"><strong>{appName}</strong> application UI</p>
192+
<p class="navbar-text pull-right">
193+
<strong title={appName}>{shortAppName}</strong> application UI
194+
</p>
191195
</div>
192196
</div>
193197
<div class="container-fluid">

0 commit comments

Comments
 (0)