Skip to content

[Controls Anywhere] Convert ControlGroupRenderer#236350

Merged
Heenawter merged 42 commits intoelastic:controlsAnywherefrom
Heenawter:controlsAnywhere_control-group-renderer_2025-09-24
Oct 8, 2025
Merged

[Controls Anywhere] Convert ControlGroupRenderer#236350
Heenawter merged 42 commits intoelastic:controlsAnywherefrom
Heenawter:controlsAnywhere_control-group-renderer_2025-09-24

Conversation

@Heenawter
Copy link
Copy Markdown
Contributor

@Heenawter Heenawter commented Sep 24, 2025

Warning

This work is being merged into a feature branch, not main!
Because of this, we only need a review from @elastic/kibana-presentation for now.

Type failures are expected because the feature branch is currently in an incomplete state, where the controls that have not yet been converted (time slider, etc.) are dependent on things that no longer exist.

Closes #235866
Closes #236128

Summary

This PR modifies the ControlGroupRenderer so that it wraps the ControlsRenderer component instead of the old ReactEmbeddableRenderer (since controlGroup is no longer an embeddable). To do this, we must create a parent API that matches the expectations of ControlsRenderer from the props that the consumer provides.

As part of this, I also added the ignoreValidations attribute back as a data control setting (rather than a control group setting, like it used to be), since some solutions relied on validations being turned off. I also ensured that, for legacy dashboards where ignoreValidations was turned on for the control group, I passed this setting to the individual panels.

Important

The time slider has not been converted yet, which means that certain uses of the ControlGroupRenderer (such as the one used in the maps application) could not be tested. However, this is a large enough PR that I don't want to delay merging this first big step. I will keep the attached issue open until I can confirm that the time slider works as expected.

Checklist

@Heenawter Heenawter force-pushed the controlsAnywhere_control-group-renderer_2025-09-24 branch from 2734aa0 to c8d45ae Compare October 1, 2025 17:05
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted the React control example, since it is no longer relevant now that the control group is not an embeddable.

(current) => current.id !== action.id
);
if (isCompatible) {
if (isCompatible && (disabledActions ?? []).indexOf(action.id) === -1) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This ensures that the disabled actions are filtered out even when the actions change via the compatibilityChangesSubject

const expectedChildCount =
Object.values(layout.panels).filter((panel) => {
return panel.gridData.sectionId ? !isSectionCollapsed(panel.gridData.sectionId) : true;
return panel.grid.sectionId ? !isSectionCollapsed(panel.grid.sectionId) : true;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fix for a bad merge conflict

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the duplication between use_children_api and Dashboard's API definition. Essentially, I found I was just creating a subset of the Dashboard API for this - which works well enough, but I'm worried about potential drift. I'm not sure if we should go through the hassle of making some sort of shareable children API, though? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Heenawter Heenawter requested a review from ThomThomson October 7, 2025 18:56
@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod bot requested a review from a team as a code owner October 7, 2025 19:17
… src/core/server/integration_tests/ci_checks'
@elastic-vault-github-plugin-prod elastic-vault-github-plugin-prod bot requested a review from a team as a code owner October 7, 2025 19:37
Copy link
Copy Markdown
Contributor

@rmyz rmyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

infra&services changes LGTM

Comment on lines +28 to +32
/**
* TODO: I added this to avoid circular dependencies; however, we should probably clean up the typings
* expected here so that `controls-renderer` is less depenedent on Dashboard types. i.e. it shouldn't
* need all the layout information, just controls.
*/
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can address this in a follow-up. I don't want to blow up this PR even more by making changes to controls-renderer

HasSerializedChildState<object> &
Partial<PublishesDisabledActionIds> &
Pick<DashboardApi, 'registerChildApi' | 'layout$'> & {
// Pick<DashboardApi, 'registerChildApi' | 'layout$'> &
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am keeping this comment as a reminder - it will be removed

Comment on lines +46 to +48
export interface HasCustomPrepend {
CustomPrependComponent: React.FC<{}>;
}
Copy link
Copy Markdown
Contributor Author

@Heenawter Heenawter Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is controls-schemas but I needed to move this type out of the controls plugin to avoid circular dependencies and this is the best quick place for it.

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Oct 8, 2025

💔 Build Failed

Failed CI Steps

History

Copy link
Copy Markdown
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good! I enjoyed looking through the new control group renderer.

As discussed offline, I would have preferred a messier translation layer to avoid bloating the feature branch with changes in the solutions, but it seems like all the changes to solutions made here are pushing them in the right direction.

# @kbn/control-group-renderer

This is a shared component that allows a group of controls to be rendered via props.
It is a wrapper for the `ControlsRenderer` component, and it is responsible for defining the `parentApi` that
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see this in a package!

"@testing-library/react"
]
},
"include": [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have changes to this file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is CI nonsense. I don't think the larger PR from the feature branch will include this - and if it does, I can attempt to clean it up at that point

<EuiFlexGroup
component="ul"
className={'controlGroup'}
className="controlGroup"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice clean & simple file.

import { BehaviorSubject, Subject, combineLatest, map } from 'rxjs';

import { ControlsRenderer, type ControlsRendererParentApi } from '@kbn/controls-renderer';
import type { StickyControlState } from '@kbn/controls-schemas';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see this type imported from the schemas package!

compressed?: boolean;
}

export const ControlGroupRenderer = ({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really interesting strategy / approach for a compatibility layer between a pure React component and Embeddable react components. I like the approach and the organization a lot.

@Heenawter Heenawter merged commit ec0f8f8 into elastic:controlsAnywhere Oct 8, 2025
11 of 12 checks passed
@Heenawter Heenawter deleted the controlsAnywhere_control-group-renderer_2025-09-24 branch October 8, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team:actionable-obs Formerly "obs-ux-management", responsible for SLO, o11y alerting, significant events, & synthetics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants