Class PersistSpec

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

public final class PersistSpec extends Object
Save and restore of a dashboard's state topics.

The listed topics are saved per browser under the namespace, 500 ms after the last change. On load the first of these that yields a value wins: an app link decoder, then a #s= share link (with shareLink()), then the saved state when its version matches, then each owner's default. Bump version(int) whenever a payload shape changes; saved state of another version is deleted.

Example:

PersistSpec.page("app.orders").version(1) .topics(Topics.filter("range"), Topics.zoom("daily")) .shareLink();

Since:
10.0.0
  • Method Details

    • page

      public static PersistSpec page(String ns)
      Creates a per-page persistence spec.
      Parameters:
      ns - The storage namespace, matching ^[a-z][a-z0-9.-]{0,63}$.
      Returns:
      A new spec.
    • version

      public PersistSpec version(int value)
      Sets the state version.
      Parameters:
      value - The version, at least 1. Defaults to 1.
      Returns:
      This object.
    • topics

      public PersistSpec topics(String... values)
      Appends the topics to save and restore.
      Parameters:
      values - filter:, zoom: or legend: topics owned by members of the dashboard.
      Returns:
      This object.
    • shareLink

      Enables #s= share links and the "Copy link" button.
      Returns:
      This object.
    • decoder

      public PersistSpec decoder(String name)
      Appends an app link decoder, registered in JS with JuneauDashboard.decoder.register(name, fn).

      The decoder must be registered before juneau-charts.js loads (from the window.JuneauConsoleDashboard pre-load queue in a head script, or from a toolkit pack), because restore runs when the first chart mounts. A page init script is too late.

      Parameters:
      name - The dotted decoder name.
      Returns:
      This object.