FleetbaseFleetbase
Order Presentation

How It Works

How Fleet-Ops matches a presentation profile to an order — the order config, the registry and isEnabled — where a profile applies in the console, and what it leaves alone.

How It Works

Matching a Profile to an Order

How a profile applies: the order's order config names a profile in meta.presentation_profile; Fleet-Ops finds the registered profile with that id; if isEnabled returns true, the profile applies, otherwise the standard view is used

Every time Fleet-Ops renders an order's form, details view or actions, it asks the order-presentation service for the order's profile:

  1. It reads the order's order config. Every order has one: it is the order's type, such as Transport or Equipment rental.
  2. It reads meta.presentation_profile from that config. No value means no profile.
  3. It looks for a registered profile with that id, in the fleet-ops:order-presentation registry, under profiles. Your extension registered it from setupExtension.
  4. It calls the profile's isEnabled(orderConfig), if it has one. The profile applies only if this returns exactly true.

If any step fails, the order gets the standard Fleet-Ops presentation.

Two parts work together, and both are yours:

PartWhere it livesSets
The profileYour extension's addon/extension.jsWhat the form, details and actions look like
The order configThe database, usually created by your extension's server codemeta.presentation_profile: which profile its orders use

Where a Profile Applies

WhereWhat the profile controls
Operations → Orders → NewForm sections, form fields, hidden fields, route title, prepare and release
The create and edit side panelThe same as the new order page
Edit details, in an order's "…" menuOpens the profiled form in a side panel, instead of the standard edit dialog
The order details viewDetails sections
The orders tableHidden actions in each row's "…" menu
The order details "…" menuHidden actions

What a Profile Leaves Alone

  • Orders whose config doesn't name the profile. They render exactly as before.
  • Views that lay the form out themselves. A host that renders Order::Form or Order::Details with a block, such as the customer portal's order form, chooses its own layout; profiles don't apply there.
  • What an order does. Statuses, dispatch and allowed transitions come from the order config's flow and lifecycle, not the profile.
  • Details tabs registered for orders, such as Ledger's Invoice tab, still appear.

A profile replaces the whole form and details layout. For a profiled order, Fleet-Ops doesn't render the registry slots extensions use to inject components into the standard order form and details view (fleet-ops:component:order:form:* and fleet-ops:component:order:details:*). Components other extensions register there don't appear on your order type.

When the Profile Is Looked Up

There is no caching: the profile is looked up each time a form, details view or action menu renders, and isEnabled is called each time. That means:

  • a profile your extension registers later, or an isEnabled result that changes, takes effect the next time the view renders;
  • isEnabled should be fast, and read state your extension has already loaded rather than fetching.

A Profile Is a Plain Object

A profile has no class to extend. It is an object with an id and the parts you want to change. See Profile Object.

Always give a profile both form.sections and details.sections. When a profile applies, its section lists are the whole layout: there is no fallback to the standard layout. A profile without form.sections shows an empty order form, and one without details.sections an empty details view. To keep a view as standard, list the standard sections; see The Order Form.

Everything else is optional: no hidden key hides nothing, and no prepare does nothing.

How It Works | Fleetbase