iRakson commented on a change in pull request #28439:
URL: https://github.com/apache/spark/pull/28439#discussion_r433030317



##########
File path: 
streaming/src/main/scala/org/apache/spark/streaming/ui/AllBatchesTable.scala
##########
@@ -49,147 +63,152 @@ private[ui] abstract class BatchTableBase(tableId: 
String, batchInterval: Long)
     }.getOrElse(<td>-</td>)
   }
 
-  protected def baseRow(batch: BatchUIData): Seq[Node] = {
-    val batchTime = batch.batchTime.milliseconds
-    val formattedBatchTime = SparkUIUtils.formatBatchTime(batchTime, 
batchInterval)
-    val numRecords = batch.numRecords
-    val schedulingDelay = batch.schedulingDelay
-    val formattedSchedulingDelay = 
schedulingDelay.map(SparkUIUtils.formatDuration).getOrElse("-")
-    val processingTime = batch.processingDelay
-    val formattedProcessingTime = 
processingTime.map(SparkUIUtils.formatDuration).getOrElse("-")
-    val batchTimeId = s"batch-$batchTime"
-
-    <td id={batchTimeId} sorttable_customkey={batchTime.toString}
-        isFailed={batch.isFailed.toString}>
-      <a href={s"batch?id=$batchTime"}>
-        {formattedBatchTime}
-      </a>
-    </td>
-      <td sorttable_customkey={numRecords.toString}>{numRecords.toString} 
records</td>
-      <td 
sorttable_customkey={schedulingDelay.getOrElse(Long.MaxValue).toString}>
-        {formattedSchedulingDelay}
-      </td>
-      <td 
sorttable_customkey={processingTime.getOrElse(Long.MaxValue).toString}>
-        {formattedProcessingTime}
-      </td>
+  private def createOutputOperationProgressBar(batch: BatchUIData): Seq[Node] 
= {
+    SparkUIUtils.makeProgressBar(
+      started = batch.numActiveOutputOp,
+      completed = batch.numCompletedOutputOp,
+      failed = batch.numFailedOutputOp,
+      skipped = 0,
+      reasonToNumKilled = Map.empty,
+      total = batch.outputOperations.size)
   }
 
-  private def batchTable: Seq[Node] = {
-    <table id={tableId} class="table table-bordered table-striped table-sm 
sortable">
-      <thead>
-        {columns}
-      </thead>
-      <tbody>
-        {renderRows}
-      </tbody>
-    </table>
-  }
+  override def tableId: String = s"$tableTag-table"
 
-  def toNodeSeq: Seq[Node] = {
-    batchTable
-  }
+  override def tableCssClass: String =
+    "table table-bordered table-sm table-striped table-head-clickable 
table-cell-width-limited"
 
-  protected def createOutputOperationProgressBar(batch: BatchUIData): 
Seq[Node] = {
-    <td class="progress-cell">
-      {
-      SparkUIUtils.makeProgressBar(
-        started = batch.numActiveOutputOp,
-        completed = batch.numCompletedOutputOp,
-        failed = batch.numFailedOutputOp,
-        skipped = 0,
-        reasonToNumKilled = Map.empty,
-        total = batch.outputOperations.size)
-      }
-    </td>
-  }
+  override def pageSizeFormField: String = s"$tableTag.pageSize"
 
-  /**
-   * Return HTML for all rows of this table.
-   */
-  protected def renderRows: Seq[Node]
-}
+  override def pageNumberFormField: String = s"$tableTag.page"
 
-private[ui] class ActiveBatchTable(
-    runningBatches: Seq[BatchUIData],
-    waitingBatches: Seq[BatchUIData],
-    batchInterval: Long) extends BatchTableBase("active-batches-table", 
batchInterval) {
-
-  private val firstFailureReason = getFirstFailureReason(runningBatches)
+  override def pageLink(page: Int): String = {
+    parameterPath +
+    s"&$tableTag.sort=$encodedSortColumn" +
+    s"&$tableTag.desc=$desc" +
+    s"&$pageNumberFormField=$page" +
+    s"&$pageSizeFormField=$pageSize" +
+    s"#$tableTag"
+  }
 
-  override protected def columns: Seq[Node] = super.columns ++ {
-    <th>Output Ops: Succeeded/Total</th>
-      <th>Status</th> ++ {
-      if (firstFailureReason.nonEmpty) {
-        <th>Error</th>
-      } else {
-        Nil
+  override def goButtonFormPath: String =
+    
s"$parameterPath&$tableTag.sort=$encodedSortColumn&$tableTag.desc=$desc#$tableTag"
+
+  override def dataSource: PagedDataSource[BatchUIData] =
+    new StreamingDataSource(batches, pageSize, sortColumn, desc)
+
+  override def headers: Seq[Node] = {
+    // tuple containing tooltips for header fields
+    val tooltips = ("Time taken by Streaming scheduler to submit jobs of a 
batch",
+      "Time taken to process all jobs of a batch", "Total time taken to handle 
a batch")
+    // headers, sortable and tooltips
+    val headersAndCssClasses: Seq[(String, Boolean, Option[String])] = {
+      Seq(
+        ("Batch Time", true, None),
+        ("Records", true, None),
+        ("Scheduling Delay", true, Some(tooltips._1)),

Review comment:
       I worked on this before working on other pages, i missed this one. I 
will update to literals.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to