Expose filter item from data plugin#94546
Conversation
|
Pinging @elastic/uptime (Team:uptime) |
|
@elasticmachine merge upstream |
Dosant
left a comment
There was a problem hiding this comment.
LGTM, didn't test, one suggest 👇
| function getPanels() { | ||
| const { negate, disabled } = filter.meta; | ||
| return [ | ||
| let mainPanelItems = [ |
There was a problem hiding this comment.
Can we type this EuiContextMenuPanelItemDescriptor & {id: PanelOptions} and then use id for filtering hiddenPanelOptions 🙏
Would be nice to have hiddenPanelOptions type connected to actually panel items and not use an arbitrary data-test-subj string for this
There was a problem hiding this comment.
i tried adding id or using EuiContextMenuPanelItemDescriptor, typescript goes crazy in both cases.
There was a problem hiding this comment.
working with EUI items types can be tricky , so i am not sure, how to solve this.
There was a problem hiding this comment.
Wow, indeed tricky!
To workaround eui types, I ended up with:
type PanelOptions = 'pinFilter' | 'editFilter' | 'negateFilter' | 'disableFilter' | 'deleteFilter';
interface PanelItem {
id: PanelOptions;
euiPanel: EuiContextMenuPanelItemDescriptor;
}
....
let mainPanelItems: PanelItem[] = [
{
id: 'pinFilter',
euiPanel: {
name: isFilterPinned(filter)
? props.intl.formatMessage({
id: 'data.filter.filterBar.unpinFilterButtonLabel',
defaultMessage: 'Unpin',
})
: props.intl.formatMessage({
id: 'data.filter.filterBar.pinFilterButtonLabel',
defaultMessage: 'Pin across all apps',
}),
icon: 'pin',
onClick: () => {
setIsPopoverOpen(false);
onTogglePinned();
},
'data-test-subj': 'pinFilter',
},
},
....
];
And then filter panels by id: 'pinFilter',
to be honest, I still think it is worth it
There was a problem hiding this comment.
^^ i don't think that will work.
There was a problem hiding this comment.
so i am leaving this improvement perhaps for future :)
💚 Build SucceededMetrics [docs]Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: cc @shahzad31 |
Dosant
left a comment
There was a problem hiding this comment.
Change LGTM,
I still think it is worth improving type binding within the component:
https://github.com/elastic/kibana/pull/94546/files#r596662205
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Summary
we are using this component in our exploratory view #94426
so exposing it from data plugin.