FleetbaseFleetbase

Registry Service

Create registries, register components into other extensions' slots, and register cross-engine components, services, and helpers — via universe.getService('registry').

Registry Service

The registry service is the storage layer behind the menu, widget, and hook services — and the place to register your own component contributions and registries.

You'll touch it for two main reasons:

  1. Inject a component into another extension's slot — e.g., a tab panel into Fleet-Ops's vehicle detail
  2. Create your own registry — so other extensions can plug into yours
// addon/extension.js
import { ExtensionComponent } from '@fleetbase/ember-core/contracts';

export default {
    setupExtension(app, universe) {
        const registryService = universe.getService('registry');
        // …
    },
};

Two-Level Storage

Registries are organized as section → list → items. For example:

  • console:admin (section) → menu-item (list) → admin items
  • console:admin (section) → menu-panel (list) → admin panels
  • fleet-ops:component:order:details (section) → components (list) → renderable components

The menu service writes into <registry>:menu-item lists; the registry service's registerRenderableComponent writes into the components list. You usually don't need to think about lists — the dedicated registrars handle them.

registerRenderableComponent(registryName, component, options?)

Inject a component into a host extension's slot. The host renders it via <RegistryYield>.

import { ExtensionComponent } from '@fleetbase/ember-core/contracts';

registryService.registerRenderableComponent(
    'fleet-ops:component:order:details',
    new ExtensionComponent('@fleetbase/storefront-engine', 'storefront-order-summary')
);

Forms supported for the component argument:

FormExample
ExtensionComponent instancenew ExtensionComponent('@fleetbase/my-engine', 'components/my-tab')
Component class with engineName optionMyComponent + { engineName: '@my-org/my-engine' }
Array of any of the aboveIterates and registers each

Well-Known Renderable-Component Registries

Real engines expose these slots (extracted from the extension.js files of the open-source extensions):

RegistryWhere it renders
fleet-ops:component:order:detailsTabs/panels in the order detail view
fleet-ops:component:driver:detailsTabs/panels in the driver detail view
fleet-ops:component:vehicle:detailsTabs/panels in the vehicle detail view
fleet-ops:component:map:drawerItems in the Fleet-Ops map drawer
fleet-ops:contextmenu:vehicleRight-click context-menu on a vehicle
fleet-ops:contextmenu:driverRight-click context-menu on a driver
fleet-ops:template:settings:routingComponents on the routing settings page
fleet-ops:template:settings:orchestratorComponents on the orchestrator settings page
fleet-ops:component:admin:routing-settingsComponents on the admin routing settings page
fleet-ops:template:operations:orders:new:entities-inputCustom inputs in the new-order entities flow
@fleetbase/consoleApp-wide tour/launcher/guard components (rare — only system extensions use this)

For Fleet-Ops's full list of slots, see fleetops/addon/extension.js#createRegistries.

createRegistry(name) / createRegistries(names)

Create your own registries so other extensions can plug into them.

const registryService = universe.getService('registry');

registryService.createRegistries([
    'my-extension:sidebar',
    'my-extension:order:tabs',
    'my-extension:dashboard:widgets',
]);

Other extensions can then registerRenderableComponent('my-extension:sidebar', …) and your templates yield via <RegistryYield>.

getRenderableComponents(registryName)

Read the components in a registry. Useful when iterating in your own template:

get sidebarComponents() {
    return this.universe.getService('registry').getRenderableComponents('my-extension:sidebar');
}

Lower-Level Registry API

These methods underpin the higher-level registrars. You'll rarely call them directly.

MethodPurpose
register(sectionName, listName, key, value)Base method — write any value to any (section, list, key) slot
lookup(sectionName, listName, key)Read a single item
getRegistry(sectionName, listName)Read an entire list as an array
getSection(sectionName)Read all lists in a section
getAllFromPrefix(sectionName, listName, prefix)Partial-key lookup
hasSection(name) / hasList(section, list)Existence checks
clearList(section, list) / clearSection(section) / clearAll()Removal
createSection(name) / createSections(names)Lower-level section creation

Registering Components, Services, and Helpers Globally

Beyond renderable components, the registry service can also register first-class components, services, and helpers into the host application's container — making them available to every engine:

registerComponent(name, ComponentClass, options?)

Make a component available to all engines by name.

import MyComponent from './components/my-component';
registryService.registerComponent('my-component', MyComponent);

registerService(name, ServiceClass, options?)

Make a service available to all engines by name.

import MyService from './services/my-service';
registryService.registerService('my-service', MyService);

registerHelper(helperName, helperOrTemplateHelper, options?)

Register a Handlebars helper. Supports lazy-loading via the TemplateHelper contract:

import TemplateHelper from '@fleetbase/ember-core/contracts/template-helper';

registryService.registerHelper(
    'calculate-delivery-fee',
    new TemplateHelper('@fleetbase/storefront-engine', 'helpers/calculate-delivery-fee')
);

Most extensions don't need these global registrars — engine-local components, services, and helpers are auto-resolved by Ember within your engine. Use these only when something must be visible to other engines.

Real-World References

ExtensionPatternSource
Fleet-OpsCreates 40+ registries for its own slotsfleetops/addon/extension.js
StorefrontRegisters components into fleet-ops:component:order:detailsstorefront/addon/extension.js
VROOMRegisters fleet-ops:template:settings:routing and fleet-ops:component:admin:routing-settingsvroom/addon/extension.js
ValhallaRegisters settings components into Fleet-Ops routing slotsvalhalla/addon/extension.js
LedgerRegisters an order-details tab into Fleet-Opsledger/addon/extension.js

See Also

Source

Registry Service | Fleetbase