Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,26 @@ ember install @fleetbase/fleetops-data

## Usage

[Longer description of how to use the addon in apps.]
Install the addon and the Fleet-Ops models, adapters, serializers and transforms are available to the host application and to every engine that lists it as a dependency.

### Shared resource descriptors

The addon also ships the resource identity descriptors for the resources every extension can see through its models: `driver`, `vehicle`, `customer`, `contact`, `place`, `order`, `vendor` and `fleet`, along with the thin `<Key::Pill>`, `<Key::Summary>`, `<Cell::KeyIdentity>` and `<SelectOption::Key>` wrappers that name the resource type for the generic components in `@fleetbase/ember-ui`.

An instance initializer registers the descriptors with the `resource-registry` service whenever the host or an engine boots, filling in only the keys nobody has registered yet. That means a Storefront or Ledger table can render a driver as an identity cell before the Fleet-Ops engine has loaded:

```js
{
id: 'driver-assigned',
cellComponent: 'table/cell/identity',
resourceType: 'driver',
resourcePath: 'driver_assigned',
}
```

Opening a resource loads the Fleet-Ops engine on demand and hands the record to its action service, so the engine bundle is only fetched when someone clicks. When Fleet-Ops itself boots it replaces these descriptors with its own, which open the same panels directly.

The helpers behind the descriptors and the styled placeholder images are exported from `@fleetbase/fleetops-data/utils/resource-descriptors` and `@fleetbase/fleetops-data/utils/placeholder-images` for other packages that build descriptors.


## Contributing
Expand Down
1 change: 1 addition & 0 deletions addon/components/cell/contact-identity.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Table::Cell::Identity @row={{@row}} @column={{@column}} @value={{@value}} @onClick={{@onClick}} @resourceType="contact" ...attributes />
1 change: 1 addition & 0 deletions addon/components/cell/customer-identity.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Table::Cell::Identity @row={{@row}} @column={{@column}} @value={{@value}} @onClick={{@onClick}} @resourceType="customer" ...attributes />
1 change: 1 addition & 0 deletions addon/components/cell/driver-identity.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Table::Cell::Identity @row={{@row}} @column={{@column}} @value={{@value}} @onClick={{@onClick}} @resourceType="driver" ...attributes />
1 change: 1 addition & 0 deletions addon/components/cell/fleet-identity.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Table::Cell::Identity @row={{@row}} @column={{@column}} @value={{@value}} @onClick={{@onClick}} @resourceType="fleet" ...attributes />
1 change: 1 addition & 0 deletions addon/components/cell/order-identity.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Table::Cell::Identity @row={{@row}} @column={{@column}} @value={{@value}} @onClick={{@onClick}} @resourceType="order" ...attributes />
1 change: 1 addition & 0 deletions addon/components/cell/place-identity.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Table::Cell::Identity @row={{@row}} @column={{@column}} @value={{@value}} @onClick={{@onClick}} @resourceType="place" ...attributes />
1 change: 1 addition & 0 deletions addon/components/cell/vehicle-identity.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Table::Cell::Identity @row={{@row}} @column={{@column}} @value={{@value}} @onClick={{@onClick}} @resourceType="vehicle" ...attributes />
1 change: 1 addition & 0 deletions addon/components/cell/vendor-identity.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Table::Cell::Identity @row={{@row}} @column={{@column}} @value={{@value}} @onClick={{@onClick}} @resourceType="vendor" ...attributes />
24 changes: 24 additions & 0 deletions addon/components/contact/pill.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Resource::Pill
@resource={{(or @contact @resource)}}
@resourceType="contact"
@title={{@title}}
@titleFallback={{@titleFallback}}
@subtitle={{@subtitle}}
@showOnlineIndicator={{@showOnlineIndicator}}
@noPopover={{@noPopover}}
@popoverPlacement={{@popoverPlacement}}
@static={{@static}}
@onClick={{@onClick}}
@onView={{@onView}}
@anchorClass={{@anchorClass}}
@imageClass={{@imageClass}}
@imageWrapperClass={{@imageWrapperClass}}
@contentWrapperClass={{@contentWrapperClass}}
@titleClass={{@titleClass}}
@subtitleClass={{@subtitleClass}}
@useBlock={{(has-block)}}
...attributes
as |resource|
>
{{yield resource}}
</Resource::Pill>
9 changes: 9 additions & 0 deletions addon/components/contact/summary.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Resource::Summary
@resource={{(or @contact @resource)}}
@resourceType="contact"
@onView={{@onView}}
@showView={{@showView}}
@onClose={{@onClose}}
@titleFallback={{@titleFallback}}
...attributes
/>
24 changes: 24 additions & 0 deletions addon/components/customer/pill.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Resource::Pill
@resource={{(or @customer @resource)}}
@resourceType="customer"
@title={{@title}}
@titleFallback={{@titleFallback}}
@subtitle={{@subtitle}}
@showOnlineIndicator={{@showOnlineIndicator}}
@noPopover={{@noPopover}}
@popoverPlacement={{@popoverPlacement}}
@static={{@static}}
@onClick={{@onClick}}
@onView={{@onView}}
@anchorClass={{@anchorClass}}
@imageClass={{@imageClass}}
@imageWrapperClass={{@imageWrapperClass}}
@contentWrapperClass={{@contentWrapperClass}}
@titleClass={{@titleClass}}
@subtitleClass={{@subtitleClass}}
@useBlock={{(has-block)}}
...attributes
as |resource|
>
{{yield resource}}
</Resource::Pill>
9 changes: 9 additions & 0 deletions addon/components/customer/summary.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Resource::Summary
@resource={{(or @customer @resource)}}
@resourceType="customer"
@onView={{@onView}}
@showView={{@showView}}
@onClose={{@onClose}}
@titleFallback={{@titleFallback}}
...attributes
/>
24 changes: 24 additions & 0 deletions addon/components/driver/pill.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Resource::Pill
@resource={{(or @driver @resource)}}
@resourceType="driver"
@title={{@title}}
@titleFallback={{@titleFallback}}
@subtitle={{@subtitle}}
@showOnlineIndicator={{@showOnlineIndicator}}
@noPopover={{@noPopover}}
@popoverPlacement={{@popoverPlacement}}
@static={{@static}}
@onClick={{@onClick}}
@onView={{@onView}}
@anchorClass={{@anchorClass}}
@imageClass={{@imageClass}}
@imageWrapperClass={{@imageWrapperClass}}
@contentWrapperClass={{@contentWrapperClass}}
@titleClass={{@titleClass}}
@subtitleClass={{@subtitleClass}}
@useBlock={{(has-block)}}
...attributes
as |resource|
>
{{yield resource}}
</Resource::Pill>
9 changes: 9 additions & 0 deletions addon/components/driver/summary.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Resource::Summary
@resource={{(or @driver @resource)}}
@resourceType="driver"
@onView={{@onView}}
@showView={{@showView}}
@onClose={{@onClose}}
@titleFallback={{@titleFallback}}
...attributes
/>
24 changes: 24 additions & 0 deletions addon/components/fleet/pill.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Resource::Pill
@resource={{(or @fleet @resource)}}
@resourceType="fleet"
@title={{@title}}
@titleFallback={{@titleFallback}}
@subtitle={{@subtitle}}
@showOnlineIndicator={{@showOnlineIndicator}}
@noPopover={{@noPopover}}
@popoverPlacement={{@popoverPlacement}}
@static={{@static}}
@onClick={{@onClick}}
@onView={{@onView}}
@anchorClass={{@anchorClass}}
@imageClass={{@imageClass}}
@imageWrapperClass={{@imageWrapperClass}}
@contentWrapperClass={{@contentWrapperClass}}
@titleClass={{@titleClass}}
@subtitleClass={{@subtitleClass}}
@useBlock={{(has-block)}}
...attributes
as |resource|
>
{{yield resource}}
</Resource::Pill>
9 changes: 9 additions & 0 deletions addon/components/fleet/summary.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Resource::Summary
@resource={{(or @fleet @resource)}}
@resourceType="fleet"
@onView={{@onView}}
@showView={{@showView}}
@onClose={{@onClose}}
@titleFallback={{@titleFallback}}
...attributes
/>
24 changes: 24 additions & 0 deletions addon/components/order/pill.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Resource::Pill
@resource={{(or @order @resource)}}
@resourceType="order"
@title={{@title}}
@titleFallback={{@titleFallback}}
@subtitle={{@subtitle}}
@showOnlineIndicator={{@showOnlineIndicator}}
@noPopover={{@noPopover}}
@popoverPlacement={{@popoverPlacement}}
@static={{@static}}
@onClick={{@onClick}}
@onView={{@onView}}
@anchorClass={{@anchorClass}}
@imageClass={{@imageClass}}
@imageWrapperClass={{@imageWrapperClass}}
@contentWrapperClass={{@contentWrapperClass}}
@titleClass={{@titleClass}}
@subtitleClass={{@subtitleClass}}
@useBlock={{(has-block)}}
...attributes
as |resource|
>
{{yield resource}}
</Resource::Pill>
9 changes: 9 additions & 0 deletions addon/components/order/summary.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Resource::Summary
@resource={{(or @order @resource)}}
@resourceType="order"
@onView={{@onView}}
@showView={{@showView}}
@onClose={{@onClose}}
@titleFallback={{@titleFallback}}
...attributes
/>
24 changes: 24 additions & 0 deletions addon/components/place/pill.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Resource::Pill
@resource={{(or @place @resource)}}
@resourceType="place"
@title={{@title}}
@titleFallback={{@titleFallback}}
@subtitle={{@subtitle}}
@showOnlineIndicator={{@showOnlineIndicator}}
@noPopover={{@noPopover}}
@popoverPlacement={{@popoverPlacement}}
@static={{@static}}
@onClick={{@onClick}}
@onView={{@onView}}
@anchorClass={{@anchorClass}}
@imageClass={{@imageClass}}
@imageWrapperClass={{@imageWrapperClass}}
@contentWrapperClass={{@contentWrapperClass}}
@titleClass={{@titleClass}}
@subtitleClass={{@subtitleClass}}
@useBlock={{(has-block)}}
...attributes
as |resource|
>
{{yield resource}}
</Resource::Pill>
9 changes: 9 additions & 0 deletions addon/components/place/summary.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Resource::Summary
@resource={{(or @place @resource)}}
@resourceType="place"
@onView={{@onView}}
@showView={{@showView}}
@onClose={{@onClose}}
@titleFallback={{@titleFallback}}
...attributes
/>
12 changes: 12 additions & 0 deletions addon/components/select-option/contact.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Resource::SelectOption
@option={{or @option @model @contact}}
@resourceType="contact"
@compact={{@compact}}
@title={{@title}}
@details={{@details}}
@photo={{@photo}}
@fallbackPhoto={{@fallbackPhoto}}
@icon={{@icon}}
@shape={{@shape}}
...attributes
/>
12 changes: 12 additions & 0 deletions addon/components/select-option/customer.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Resource::SelectOption
@option={{or @option @model @customer}}
@resourceType="customer"
@compact={{@compact}}
@title={{@title}}
@details={{@details}}
@photo={{@photo}}
@fallbackPhoto={{@fallbackPhoto}}
@icon={{@icon}}
@shape={{@shape}}
...attributes
/>
12 changes: 12 additions & 0 deletions addon/components/select-option/driver.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Resource::SelectOption
@option={{or @option @model @driver}}
@resourceType="driver"
@compact={{@compact}}
@title={{@title}}
@details={{@details}}
@photo={{@photo}}
@fallbackPhoto={{@fallbackPhoto}}
@icon={{@icon}}
@shape={{@shape}}
...attributes
/>
12 changes: 12 additions & 0 deletions addon/components/select-option/fleet.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Resource::SelectOption
@option={{or @option @model @fleet}}
@resourceType="fleet"
@compact={{@compact}}
@title={{@title}}
@details={{@details}}
@photo={{@photo}}
@fallbackPhoto={{@fallbackPhoto}}
@icon={{@icon}}
@shape={{@shape}}
...attributes
/>
12 changes: 12 additions & 0 deletions addon/components/select-option/order.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Resource::SelectOption
@option={{or @option @model @order}}
@resourceType="order"
@compact={{@compact}}
@title={{@title}}
@details={{@details}}
@photo={{@photo}}
@fallbackPhoto={{@fallbackPhoto}}
@icon={{@icon}}
@shape={{@shape}}
...attributes
/>
12 changes: 12 additions & 0 deletions addon/components/select-option/place.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Resource::SelectOption
@option={{or @option @model @place}}
@resourceType="place"
@compact={{@compact}}
@title={{@title}}
@details={{@details}}
@photo={{@photo}}
@fallbackPhoto={{@fallbackPhoto}}
@icon={{@icon}}
@shape={{@shape}}
...attributes
/>
12 changes: 12 additions & 0 deletions addon/components/select-option/vehicle.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Resource::SelectOption
@option={{or @option @model @vehicle}}
@resourceType="vehicle"
@compact={{@compact}}
@title={{@title}}
@details={{@details}}
@photo={{@photo}}
@fallbackPhoto={{@fallbackPhoto}}
@icon={{@icon}}
@shape={{@shape}}
...attributes
/>
12 changes: 12 additions & 0 deletions addon/components/select-option/vendor.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Resource::SelectOption
@option={{or @option @model @vendor}}
@resourceType="vendor"
@compact={{@compact}}
@title={{@title}}
@details={{@details}}
@photo={{@photo}}
@fallbackPhoto={{@fallbackPhoto}}
@icon={{@icon}}
@shape={{@shape}}
...attributes
/>
Loading
Loading