Skip to content

Conversation

Zacqary
Copy link
Contributor

@Zacqary Zacqary commented Oct 14, 2025

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.
Screenshot 2025-10-14 at 5 01 19 PM

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 fail isCompatible but pass couldBecomeCompatible 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.
Screenshot 2025-10-14 at 1 02 54 PM
Screenshot 2025-10-14 at 1 02 36 PM

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.

@Zacqary Zacqary requested a review from a team as a code owner October 14, 2025 18:35
@botelastic botelastic bot added the Feature:Embedding Embedding content via iFrame label Oct 14, 2025
@Zacqary Zacqary closed this Oct 14, 2025
@Zacqary Zacqary reopened this Oct 14, 2025
@Zacqary Zacqary marked this pull request as draft October 14, 2025 18:37
@Zacqary Zacqary added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// Project:Controls and removed Feature:Embedding Embedding content via iFrame labels Oct 14, 2025
@Heenawter
Copy link
Contributor

Heenawter commented Oct 14, 2025

The control is too narrow until we implement #234681.

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 large and grow true without waiting for the attached issue - this will be identical to existing behaviour. The sizing should work as you expect as long as you set the values correctly.

@Zacqary Zacqary force-pushed the 233037-timeslider-embeddable branch from 3e57a9b to b9aa66b Compare October 14, 2025 21:35
@Zacqary Zacqary force-pushed the 233037-timeslider-embeddable branch from b9aa66b to 9fa97ca Compare October 14, 2025 21:39
@Zacqary
Copy link
Contributor Author

Zacqary commented Oct 14, 2025

@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 grow/width settings.

@Zacqary Zacqary marked this pull request as ready for review October 14, 2025 22:03
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

Comment on lines +38 to +47
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);
Copy link
Contributor

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?

Comment on lines +499 to +501
// 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 } : {}),
Copy link
Contributor

@Heenawter Heenawter Oct 14, 2025

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.

@elasticmachine
Copy link
Contributor

elasticmachine commented Oct 14, 2025

💔 Build Failed

Failed CI Steps

History

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Project:Controls Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t//

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants