Skip to content
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

[ES|QL Editor] Add hideRunQueryButton prop to control run query button visibility #208446

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,14 @@ describe('ESQLEditor', () => {
findTestSubject(component, 'ESQLEditor-run-query-button').simulate('click');
expect(onTextLangQuerySubmit).toHaveBeenCalled();
});

it('should not render the run query button if the hideRunQueryButton prop is set to true and editorIsInline prop is set to true', async () => {
const newProps = {
...props,
hideRunQueryButton: true,
editorIsInline: true,
};
const component = mount(renderESQLEditorComponent({ ...newProps }));
expect(component.find('[data-test-subj="ESQLEditor-run-query-button"]').length).toBe(0);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const ESQLEditor = memo(function ESQLEditor({
isLoading,
isDisabled,
hideRunQueryText,
hideRunQueryButton,
editorIsInline,
disableSubmitAction,
dataTestSubj,
Expand Down Expand Up @@ -679,7 +680,7 @@ export const ESQLEditor = memo(function ESQLEditor({

const editorPanel = (
<>
{Boolean(editorIsInline) && (
{Boolean(editorIsInline) && !hideRunQueryButton && (
<EuiFlexGroup
gutterSize="none"
responsive={false}
Expand Down
2 changes: 2 additions & 0 deletions src/platform/packages/private/kbn-esql-editor/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export interface ESQLEditorProps {
dataTestSubj?: string;
/** Hide the Run query information which appears on the footer*/
hideRunQueryText?: boolean;
/** Hide the Run query button which appears when editor is inlined*/
hideRunQueryButton?: boolean;
/** This is used for applications (such as the inline editing flyout in dashboards)
* which want to add the editor without being part of the Unified search component
* It renders a submit query button inside the editor
Expand Down
Loading