Class BadgeDef

java.lang.Object
org.apache.juneau.console.views.BadgeDef

public final class BadgeDef extends Object
A count badge in the page contract, fed by a JSON endpoint and polled by juneau-badges.js.

The endpoint returns {total, mine?, items?[]}. The badge is presentation only: the endpoint must still authorize the caller, and a page should not declare a badge for users who cannot read it.

Example:

var badge = BadgeDef .create("pending") .src("/rest/changes/pending") .scope("beanType", BadgeDef.ScopeBy.NAV, Map.of("suspensions", List.of("Suspension"))) .href("/ui/changes") .stateFilter("beanType") .refreshes("rules-table") .refreshMs(60_000); badge.validate(); // throws IllegalArgumentException with an E-6x message

Since:
10.0.0