Custom order history timeline entries
See original GitHub issueIs your feature request related to a problem? Please describe.
I would like to display custom history entries with a custom HistoryEntryType
.
Example: We have a marketplace and issue a payout for the product owner.
// Add history element to order to document the payout
await this.historyService.createHistoryEntryForOrder(
{
ctx,
type: HistoryEntryType.ORDER_PAYOUT, //< custom type
orderId: order.id,
data: {
// Data to display
title, // display title
link, // to navigate in the admin ui
// Custom data
amount,
service,
payoutId,
ownerId,
},
} as any, //< because we have a custom type
false,
);
But this entry will never be displayed in the admin UI, because the angular switchCase does not contain a default option.
This default option should be a component that takes title
and link
from HistoryEntry.data
and displays it.
All other data should be displayed as JSON inside a popover (like for payments)
Describe the solution you’d like Add a default case for an history entry: https://github.com/vendure-ecommerce/vendure/blob/ce147dc13e139be6d734016f43f7abeed9fac8d9/packages/admin-ui/src/lib/order/src/components/order-history/order-history.component.html#L199
<ng-container *ngSwitchDefault>
<div class="title" *ngIf="entry.data.title">
{{ entry.data.title | translate }}
</div>
<div class="link" *ngIf="entry.data.link" >
<a [routerLink]="entry.data.link"><clr-icon shape="cursor-hand-click"></clr-icon></a>
</div>
<vdr-history-entry-detail *ngIf="entry.data">
<component-to-show-json [data]="entry.data" />
</vdr-history-entry-detail>
</ng-container>
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
My idea would be to add a custom type that requires a few properties to display it in the UI but accepts any string as
type
Note: With this we should do the same for Customer history timeline.