Github user JoshRosen commented on the pull request:

    https://github.com/apache/spark/pull/2852#issuecomment-60339925
  
    My latest commit cleans up the messy `customCol` and adds a builder-like 
pattern to the columns, too, so you have this nice, declarative-looking style 
for customizing columns' sorting / formatting / markup behavior:
    
    ```scala
      private val workerTable: UITable[WorkerInfo] = {
        val t = new UITableBuilder[WorkerInfo]()
        t.col("ID") (identity) withMarkup  { worker =>
          <a href={worker.webUiAddress}>{worker.id}</a>
        }
        t.col("Address") { worker => s"${worker.host}:${worker.port}"}
        t.col("State") { _.state.toString }
        t.col("Cores") { _.coresUsed } formatWith { c: Int => s"$c Used" }
        t.col("Memory") (identity) sortBy { worker =>
          s"${worker.memory}:${worker.memoryUsed}"
        } withMarkup { worker =>
          Text(Utils.megabytesToString(worker.memory)) ++
          Text(Utils.megabytesToString(worker.memoryUsed))
        }
        t.build()
      }
    ```
    
    I know that a lot of folks dislike the infix syntax; I'm a fan of it here 
for these `sortBy` -> `withMarkup` chains, but I'm pretty flexible on this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to