Skip to content

Commit

Permalink
[ES|QL Editor] Add hideRunQueryButton prop to control run query but…
Browse files Browse the repository at this point in the history
…ton visibility
  • Loading branch information
e40pud committed Jan 27, 2025
1 parent 10505bd commit 7454fd8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
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

0 comments on commit 7454fd8

Please sign in to comment.