public class UIUtils
extends Object
Constructor and Description |
---|
UIUtils() |
Modifier and Type | Method and Description |
---|---|
static scala.collection.Seq<scala.xml.Node> |
basicSparkPage(javax.servlet.http.HttpServletRequest request,
scala.Function0<scala.collection.Seq<scala.xml.Node>> content,
String title,
boolean useDataTables)
Returns a page with the spark css/js and a simple format.
|
static javax.ws.rs.core.Response |
buildErrorResponse(javax.ws.rs.core.Response.Status status,
String msg) |
static scala.collection.Seq<scala.xml.Node> |
commonHeaderNodes(javax.servlet.http.HttpServletRequest request) |
static scala.collection.Seq<scala.xml.Node> |
dataTablesHeaderNodes(javax.servlet.http.HttpServletRequest request) |
static String |
decodeURLParameter(String urlParam)
Decode URLParameter if URL is encoded by YARN-WebAppProxyServlet.
|
static String |
formatDate(java.util.Date date) |
static String |
formatDate(long timestamp) |
static String |
formatDuration(long milliseconds) |
static String |
formatDurationVerbose(long ms)
Generate a verbose human-readable string representing a duration such as "5 second 35 ms"
|
static String |
formatNumber(double records)
Generate a human-readable string representing a number (e.g.
|
static int |
getTimeZoneOffset() |
static scala.collection.Seq<scala.xml.Node> |
headerSparkPage(javax.servlet.http.HttpServletRequest request,
String title,
scala.Function0<scala.collection.Seq<scala.xml.Node>> content,
org.apache.spark.ui.SparkUITab activeTab,
scala.Option<Object> refreshInterval,
scala.Option<String> helpText,
boolean showVisualization,
boolean useDataTables)
Returns a spark page with correctly formatted headers
|
static <T> scala.collection.Seq<scala.xml.Node> |
listingTable(scala.collection.Seq<String> headers,
scala.Function1<T,scala.collection.Seq<scala.xml.Node>> generateDataRow,
scala.collection.Iterable<T> data,
boolean fixedWidth,
scala.Option<String> id,
scala.collection.Seq<String> headerClasses,
boolean stripeRowsWithCss,
boolean sortable)
Returns an HTML table constructed by generating a row for each object in a sequence.
|
static scala.xml.NodeSeq |
makeDescription(String desc,
String basePathUri,
boolean plainText)
Returns HTML rendering of a job or stage description.
|
static String |
makeHref(boolean proxy,
String id,
String origHref)
Return the correct Href after checking if master is running in the
reverse proxy mode or not.
|
static scala.collection.Seq<scala.xml.Node> |
makeProgressBar(int started,
int completed,
int failed,
int skipped,
scala.collection.immutable.Map<String,Object> reasonToNumKilled,
int total) |
static String |
prependBaseUri(javax.servlet.http.HttpServletRequest request,
String basePath,
String resource) |
static scala.collection.Seq<scala.xml.Node> |
showDagVizForJob(int jobId,
scala.collection.Seq<org.apache.spark.ui.scope.RDDOperationGraph> graphs)
Return a "DAG visualization" DOM element that expands into a visualization for a job.
|
static scala.collection.Seq<scala.xml.Node> |
showDagVizForStage(int stageId,
scala.Option<org.apache.spark.ui.scope.RDDOperationGraph> graph)
Return a "DAG visualization" DOM element that expands into a visualization for a stage.
|
static String |
stripXSS(String requestParameter)
Remove suspicious characters of user input to prevent Cross-Site scripting (XSS) attacks
|
static String |
TABLE_CLASS_NOT_STRIPED() |
static String |
TABLE_CLASS_STRIPED_SORTABLE() |
static String |
TABLE_CLASS_STRIPED() |
static scala.collection.Seq<scala.xml.Node> |
tooltip(String text,
String position) |
static String |
uiRoot(javax.servlet.http.HttpServletRequest request) |
static scala.collection.Seq<scala.xml.Node> |
vizHeaderNodes(javax.servlet.http.HttpServletRequest request) |
public static String TABLE_CLASS_NOT_STRIPED()
public static String TABLE_CLASS_STRIPED()
public static String TABLE_CLASS_STRIPED_SORTABLE()
public static String formatDate(java.util.Date date)
public static String formatDate(long timestamp)
public static String formatDuration(long milliseconds)
public static String formatDurationVerbose(long ms)
public static String formatNumber(double records)
public static String uiRoot(javax.servlet.http.HttpServletRequest request)
public static String prependBaseUri(javax.servlet.http.HttpServletRequest request, String basePath, String resource)
public static scala.collection.Seq<scala.xml.Node> commonHeaderNodes(javax.servlet.http.HttpServletRequest request)
public static scala.collection.Seq<scala.xml.Node> vizHeaderNodes(javax.servlet.http.HttpServletRequest request)
public static scala.collection.Seq<scala.xml.Node> dataTablesHeaderNodes(javax.servlet.http.HttpServletRequest request)
public static scala.collection.Seq<scala.xml.Node> headerSparkPage(javax.servlet.http.HttpServletRequest request, String title, scala.Function0<scala.collection.Seq<scala.xml.Node>> content, org.apache.spark.ui.SparkUITab activeTab, scala.Option<Object> refreshInterval, scala.Option<String> helpText, boolean showVisualization, boolean useDataTables)
public static scala.collection.Seq<scala.xml.Node> basicSparkPage(javax.servlet.http.HttpServletRequest request, scala.Function0<scala.collection.Seq<scala.xml.Node>> content, String title, boolean useDataTables)
public static <T> scala.collection.Seq<scala.xml.Node> listingTable(scala.collection.Seq<String> headers, scala.Function1<T,scala.collection.Seq<scala.xml.Node>> generateDataRow, scala.collection.Iterable<T> data, boolean fixedWidth, scala.Option<String> id, scala.collection.Seq<String> headerClasses, boolean stripeRowsWithCss, boolean sortable)
public static scala.collection.Seq<scala.xml.Node> makeProgressBar(int started, int completed, int failed, int skipped, scala.collection.immutable.Map<String,Object> reasonToNumKilled, int total)
public static scala.collection.Seq<scala.xml.Node> showDagVizForStage(int stageId, scala.Option<org.apache.spark.ui.scope.RDDOperationGraph> graph)
public static scala.collection.Seq<scala.xml.Node> showDagVizForJob(int jobId, scala.collection.Seq<org.apache.spark.ui.scope.RDDOperationGraph> graphs)
public static scala.collection.Seq<scala.xml.Node> tooltip(String text, String position)
public static scala.xml.NodeSeq makeDescription(String desc, String basePathUri, boolean plainText)
Note: In terms of security, only anchor tags with root relative links are supported. So any
attempts to embed links outside Spark UI, or other tags like <script>
will cause in
the whole description to be treated as plain text.
desc
- the original job or stage description string, which may contain html tags.basePathUri
- with which to prepend the relative links; this is used when plainText is
false.plainText
- whether to keep only plain text (i.e. remove html tags) from the original
description string.public static String decodeURLParameter(String urlParam)
urlParam
- (undocumented)public static int getTimeZoneOffset()
public static String makeHref(boolean proxy, String id, String origHref)
proxy
- (undocumented)id
- (undocumented)origHref
- (undocumented)public static String stripXSS(String requestParameter)
For more information about XSS testing: https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet and https://www.owasp.org/index.php/Testing_for_Reflected_Cross_site_scripting_(OTG-INPVAL-001)
requestParameter
- (undocumented)public static javax.ws.rs.core.Response buildErrorResponse(javax.ws.rs.core.Response.Status status, String msg)