Class DashboardSpec

java.lang.Object
org.apache.juneau.console.freemarker.DashboardSpec

public final class DashboardSpec extends Object
A dashboard: a rail of filter sections beside a grid of card panels, with a status header and optional persistence.

Added to a builder page with PageSpec.dashboard(DashboardSpec), which adds the panel and card-section cards to the page and the dashboard toolkit pack. A page has at most one dashboard. Every structural problem is E-77 when the page is built.

Example:

page.dashboard(DashboardSpec.create("orders").title("Orders") .rail(Rail.left().sections( RangeSection.quick("7d", "30d").publishes(Topics.filter("range")))) .grid(2) .panel(daily).panel(byReason).panel("notes", 2) .status(Topics.data("orders")) .persist(PersistSpec.page("app.orders").topics(Topics.filter("range")).shareLink()));

Since:
10.0.0
  • Method Details

    • create

      public static DashboardSpec create(String id)
      Creates a dashboard.
      Parameters:
      id - The dashboard id: the viewId of every section payload, and the default storage namespace dashboard.<id> for the rail width.
      Returns:
      A new dashboard.
    • title

      public DashboardSpec title(String value)
      Sets the heading.
      Parameters:
      value - The title.
      Returns:
      This object.
    • rail

      public DashboardSpec rail(Rail value)
      Sets the rail.
      Parameters:
      value - The rail.
      Returns:
      This object.
    • grid

      public DashboardSpec grid(int value)
      Sets the number of grid columns.
      Parameters:
      value - 1 to 4. Defaults to 2.
      Returns:
      This object.
    • panel

      public DashboardSpec panel(ChartDef chart)
      Appends a chart panel spanning one column.

      The chart is snapshotted when it is added; later changes to the ChartDef are not reflected.

      Parameters:
      chart - The chart.
      Returns:
      This object.
    • panel

      public DashboardSpec panel(ChartDef chart, int span)
      Appends a chart panel.

      The chart is snapshotted when it is added; later changes to the ChartDef are not reflected.

      Parameters:
      chart - The chart.
      span - The columns it spans, 1 to grid(int).
      Returns:
      This object.
    • panel

      public DashboardSpec panel(CardSpec card)
      Appends a card panel spanning one column.
      Parameters:
      card - The card. Not html or datatables; use panel(String) for those.
      Returns:
      This object.
    • panel

      public DashboardSpec panel(CardSpec card, int span)
      Appends a card panel.
      Parameters:
      card - The card. Not html or datatables; use panel(String, int) for those.
      span - The columns it spans, 1 to grid(int).
      Returns:
      This object.
    • panel

      public DashboardSpec panel(String cardId)
      Appends a panel for a card already added to the page (for example with PageSpec.html(...)), spanning one column.
      Parameters:
      cardId - The card id. The card must be on the page before PageSpec.dashboard(DashboardSpec).
      Returns:
      This object.
    • panel

      public DashboardSpec panel(String cardId, int span)
      Appends a panel for a card already added to the page.
      Parameters:
      cardId - The card id. See panel(String).
      span - The columns it spans, 1 to grid(int).
      Returns:
      This object.
    • status

      public DashboardSpec status(String... topics)
      Binds the status header to data sources.
      Parameters:
      topics - data:<sourceId> topics, normally Topics.data(id). Each must be a declared source.
      Returns:
      This object.
    • persist

      Saves and restores state topics.
      Parameters:
      value - The persistence spec.
      Returns:
      This object.
    • toJson

      public Map<String,Object> toJson()
      Checks this dashboard against no page cards and returns its JSON. PageSpec.dashboard calls toJson(Map) instead, so by-id panels resolve.
      Returns:
      The dashboard contract object.
      Throws:
      IllegalArgumentException - E-77 on the first problem.