FleetbaseFleetbase

Resource Layouts

<Layout::Resource::Tabular>, <Layout::Resource::Card>, <Layout::Resource::CardsGrid>, and <Layout::Resource::Panel> — pre-built page layouts for resource list views.

Resource Layouts

@fleetbase/ember-ui ships four pre-built page layouts for rendering a resource list. They are higher-level wrappers around <Table>, search, filters, bulk actions, and pagination — drop one in and you get a complete resource page.

LayoutComponentWhen to use
Tabular<Layout::Resource::Tabular>Standard list/detail page (the default for most resources)
Card<Layout::Resource::Card>Single-card detail view
CardsGrid<Layout::Resource::CardsGrid>Grid of cards (e.g. media gallery, store grid)
Panel<Layout::Resource::Panel>Sectioned panel layout

Tabular Example

<Layout::Resource::Tabular
  @title="Drivers"
  @searchQuery={{this.q}}
  @onSearch={{this.onSearch}}
  @onReload={{this.onReload}}
  @columns={{this.columns}}
  @rows={{this.rows}}
  @table={{this.table}}
  @onRowClick={{this.openDriver}}
/>

<Layout::Resource::Tabular> renders:

  • Section header with @title, search input, refresh button
  • Filters picker (driven by columns marked filterable)
  • Visible-column picker (let the user hide/show columns)
  • Bulk-action dropdown (when rows are selected)
  • The actual <Table> with sortable columns and pagination
  • Optional bulk-search dropdown for advanced multi-field search

Common Arguments

ArgumentDescription
@titleHeader title
@columnsColumn descriptors (passed to <Table>)
@rowsRow data
@tableThe ember-light-table model object
@searchQueryBound to the search input
@onSearchSearch callback
@onReloadRefresh button callback
@onRowClickClick callback for each row
@onSubmitBulkSearchOptional advanced search
@bulkSearchValueBound to advanced search
@withoutHeaderSkip the entire header row
@hideColumnsPickerSkip the visible-column picker
@registryA table registry such as fleet-ops:driver:table. Merges the columns, row actions, bulk actions and toolbar buttons other extensions registered there. See Resource View Registries
@actionButtonsToolbar buttons: { id, text, icon, type, onClick, permission }, a dropdown with items, or a component
@bulkActionsItems for the Bulk Actions menu: { id, label, icon, fn, permission }
@searchDisabledDisable the search input

Plus a long tail of *Class and *Width overrides for each subsection.

Extra Header Controls

Use the <:header> block for controls that belong in the header before the standard ones, such as a mode toggle:

<Layout::Resource::Tabular @title="API Keys" @data={{@model}} @columns={{this.columns}}>
  <:header>
    <Toggle @isToggled={{this.isTestMode}} @onToggle={{this.toggleTestMode}} @label="Test mode" />
  </:header>
</Layout::Resource::Tabular>

Extension Registries

Pass @registry and other extensions can extend the view without changing it:

Layout@registryMerges
<Layout::Resource::Tabular><extension>:<resource>:tableColumns, row actions, bulk actions, toolbar buttons
<Layout::Resource::TabularActions><extension>:<resource>:tableToolbar buttons and bulk actions (merge columns in your controller)
<Layout::Resource::Panel><extension>:<resource>:detailsHeader buttons, and items in the "…" menu

Cells, filters and toolbar components that other extensions register can come from their own engines, as ExtensionComponents. The shared renderers <Layout::Resource::ActionButtons @buttons> and <Layout::Resource::BulkActions @actions> are available for headers you lay out yourself. See Making Views Extensible.

Real-World Usage

Look at any of the resource list controllers in fleet-ops or storefront — they all use <Layout::Resource::Tabular> as their root template:

  • fleet-ops/addon/templates/management/drivers/index.hbs
  • fleet-ops/addon/templates/management/vehicles/index.hbs
  • storefront/addon/templates/networks/index.hbs

Studying any of these is the fastest way to see the full set of arguments in action.

Source

Resource Layouts | Fleetbase