forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Discover] Enhance flyout customization to update content (elastic#16…
…9634) ## 📓 Summary Closes elastic#169394 This PR extends the `flyout` customization extension point to support updating/replacing the content shown in the document flyout. A consumer would need to show/hide/highlight details related to the expanded document, and it might also want to control whether the default content (currently only the UnifiedDocViewer) is shown/hidden. Finally, it could be necessary to perform imperative actions such as adding/removing columns or filter. To get this flexibility at the moment of customizing the content, the existing extension point takes now a `Content` component, where some props are injected. ``` export interface FlyoutContentProps { actions: { setFilter?: DocViewFilterFn; addColumn: (column: string) => void; removeColumn: (column: string) => void; }; doc: DataTableRecord; renderDefaultContent: () => React.ReactNode; } ``` N.B. `renderDefaultContent` is passed as a function instead of a React element to avoid its creation in the Discover flyout in case the consumer doesn't want to display it. Here is a usage example of the new extension point property. ``` customizations.set({ id: 'flyout', Content: ({ actions, doc, renderDefaultContent }) => { return ( <Panel> <HighlightComponent timestamp={doc.flattened['@timestamp']} /> <Columns onAddColumn={actions.addColumns} onAddColumn={actions.removeColumn} /> <Filters onFilter={actions.setFilter} /> {renderDefaultContent()} </Panel> ); }, }); ``` --------- Co-authored-by: Marco Antonio Ghiani <marcoantonio.ghiani@elastic.co>
- Loading branch information
Showing
5 changed files
with
195 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1725,6 +1725,6 @@ | |
"@kbn/ambient-ui-types", | ||
"@kbn/ambient-common-types", | ||
"@kbn/ambient-storybook-types" | ||
] | ||
], | ||
} | ||
} |