Skip to main content

Rich Table Views (juneau-console-views)

juneau-console-views is the browser-side toolkit behind the console's table cards: a server-driven table view with search, sort, paging, a column chooser, saved View Settings, row actions, bulk mutation, cell popovers, row-detail regions, async-job streaming and shareable links. The server describes a view with plain beans and annotations; a first-party JavaScript runtime (juneau-views.js and its companions) draws it.

A table card from the petstore: toolbar with paging and search, sortable columns with per-column search, and rows

Most adopters never touch the view beans directly. You author a <@card type="datatables"> catalog in a FreeMarker template (see Building a Console Page) and the chrome lifts it into the view contract for you. This section documents what that catalog can express, the security model behind it, and the JuneauViews JavaScript API for pages that need to go further.

PageCovers
Catalog and ColumnsThe datatables catalog, Column, search types and operators, FieldFormat, FieldSpan.
Row Actions and Bulk MutationRowAction, SelectionDef, BulkMutateDef, ActionResult, IdempotencyKey, WritePermit.
Renderers and Cell PopoversRender, built-in renderer ids, CellPopover, custom renderers.
Security ModelSink allowlists, CSRF and loopback boundary, same-origin rules.
JavaScript APIwindow.JuneauViews namespaces and the asset load order.
View Settings and Shareable LinksThe View Settings dialog, page-state persistence, Copy link and ?state=.
Datatable View SettingsDialog tabs and columnConfig.tabs, the schemaVersion guard, settings applied on load, ordered Sort, auto-refresh, Copy link.
RegionsRegionDef, populators, row-detail regions, page-slot regions.
Async JobsAsyncJobsMixin, AsyncJobRegistry, SSE progress and cancel.
Icons and SpritesJuneauViews.icons, the bundled symbol sprites, overriding icons.
Terminal View RegionTerminalViewMixin, TerminalViewLog, FileTerminalViewSource, the report readers, the terminal-view card and region.

Modules and mixins​

ModuleMixin / classServes
juneau-console-viewsViewsMixin/juneau-views.js, -renders.js, -icons.js, -search.js, -pagestate.js, -urlstate.js, -ribbon.js, -regions.js, -helpers.js, -config.js, -terminal-view.js, the CSS, and the symbol sprites.
juneau-console-viewsAsyncJobsMixin/juneau-jobs/{jobId}/stream and /juneau-jobs/{jobId}/cancel.
juneau-console-datatablesDataTablesMixin/juneau-datatables.js, the browser glue for server-side processing.
juneau-rest-serverWebJarsMixin/webjars/*: the jQuery and DataTables WebJars.
The host must compose DataTablesMixin and WebJarsMixin

Every datatables card loads juneau-datatables.js (from DataTablesMixin) and jQuery and DataTables (from WebJarsMixin) before juneau-views.js, in client and server mode. If the host composes neither, those URLs 404 and the table fails loudly. See Card Asset Dependencies.

@Rest(
path="/console",
mixins={ViewsMixin.class, ConsoleChromeMixin.class, DataTablesMixin.class, WebJarsMixin.class}
)
public class ConsoleResource extends BasicRestServlet {}

Contract versions​

The toolkit has three independent, versioned wire contracts, plus the page contract owned by the chrome. Each one is checked separately, and a mismatch fails loudly rather than degrading silently.

ContractKeyCurrentOwnerConstant
Page contract (JSON island #juneau-page)contractVersion"1"PageCapture / juneau-console.jsPageCapture writes it; see Admin-Console Chrome
View metadata (VIEW_META sidecar)contractVersion"5"ViewsMixinViewsMixin.CONTRACT_VERSION
Card slot envelope (SLOT_META)contractVersion"1"ViewsMixinViewsMixin.SLOT_CONTRACT_VERSION
Bar envelopecontractVersion"1"ViewsMixinViewsMixin.BAR_CONTRACT_VERSION

Regions carry their own RegionDef.CONTRACT_VERSION ("1"), independent of all of the above. ViewsMixin.HEADER_CONTRACT_VERSION is also "1". ActionResult and BulkMutateDef carry their own CONTRACT_VERSION ("1" each) for the action-result and bulk-mutate wire shapes.

Omit and inject​

You do not write any of these numbers by hand. When a <@card type="datatables"> catalog is lifted into the contract, the chrome injects the current VIEW_META and slot versions for you; a catalog should omit contractVersion entirely.

A body that is itself a pre-built slot envelope (a top-level view object) is rejected at render time; author the catalog form and let the chrome add the envelope.

note

ConsoleTemplateValidator still reports a literal view.contractVersion that differs from the runtime's (view-contract-version), but such a body no longer renders, so the safe practice is simply to omit the key.

See also​