-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Controls Anywhere] Convert time slider to embeddable #238998
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: controlsAnywhere
Are you sure you want to change the base?
[Controls Anywhere] Convert time slider to embeddable #238998
Conversation
FYI - time slider controls have never had the ability to edit the width and grow settings. So you should be able to add the time slider controls with size |
3e57a9b
to
b9aa66b
Compare
b9aa66b
to
9fa97ca
Compare
@Heenawter I had to hard code the values in the layout manager for now, added a TODO comment so we know to remove when we implement real |
Pinging @elastic/kibana-presentation (Team:Presentation) |
if (!apiCanAddNewPanel(embeddable) || !apiCanPinPanel(embeddable)) | ||
throw new IncompatibleActionError(); | ||
const newPanel = await embeddable.addNewPanel<{}, { uuid: string }>({ | ||
panelType: TIME_SLIDER_CONTROL, | ||
serializedState: { | ||
rawState: {}, | ||
}, | ||
}); | ||
if (!newPanel) throw new Error('Failed tp create time slider panel'); | ||
embeddable.pinPanel(newPanel.uuid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should combine this into a single action - i.e. don't create then pin, just add a new function addPinnedPanel
to the Dashboard API. What do you think @Zacqary?
// TODO Remove this when grow and width settings for pinned controls are implemented | ||
// https://github.com/elastic/kibana/issues/234681 | ||
...(controlToPin.type === TIME_SLIDER_CONTROL ? { width: 'large', grow: true } : {}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to hard code the values in the layout manager for now, added a TODO comment so we know to remove when we implement real grow/width settings.
This is not a TODO
. We definitely shouldn't hardcode the TIME_SLIDER_CONTROL
type check like this (which could be avoided if we go the route of adding a new addPinnedPanel
function instead) but the time slider control should not support editable width and grow state, as I mentioned here. So #234681 is irrelevant here.
💔 Build Failed
Failed CI StepsHistory
|
Summary
Closes #233037
Time slider as embeddable
Converts the time slider to an embeddable, allows it to be added as a panel that immediately pins itself and cannot be unpinned.

Known issues
The control does not highlight itself when added, tracked in #238981.
Conditionally enabled add panel action
This PR adds support for
couldBecomeCompatible
to the Add Panel menu. Actions that failisCompatible
but passcouldBecomeCompatible
will be displayed as disabled menu items.The time slider action is the only thing with an Add Panel trigger that implements


couldBecomeCompatible
, so this doesn't affect any existing actions.Refactoring add panel menu to subscribe to compatibility changes
I did a rewrite of the way the Add Panel flyout renders the group menu. Before I did this, the Time Slider action would be disabled when you opened the menu, and then stay disabled if you deleted your existing Time Slider before closing the menu. This is because
getMenuItemGroups
was only fetching action compatibility once, and wasn't set up to re-render the menu if compatibility changed. The refactor I did enables this behavior to go smoothly:enabledisable.mov
It's an edge case for sure, but if we add any new actions to the panel menu that take advantage of compatibility updates, we want them to work as expected.