Skip to content

[ES|QL] Disable the Save button any time the ES|QL query is changed#267642

Merged
bartoval merged 12 commits into
elastic:mainfrom
bartoval:esql-vlues-save-disabled
May 6, 2026
Merged

[ES|QL] Disable the Save button any time the ES|QL query is changed#267642
bartoval merged 12 commits into
elastic:mainfrom
bartoval:esql-vlues-save-disabled

Conversation

@bartoval
Copy link
Copy Markdown
Contributor

@bartoval bartoval commented May 5, 2026

Summary

Closes #266720

disable.mp4

Fixes the ES|QL values control flyout so the Save button is disabled when the values query has been edited after the last successful run.

Now if the query text changes, it can no longer be saved until the query is run again

@bartoval bartoval self-assigned this May 5, 2026
@bartoval bartoval added bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:ESQL ES|QL related features in Kibana t// v9.5.0 labels May 5, 2026
@bartoval bartoval changed the title [ESQL] Disable save for stale values query [ES|QL] Disable save for stale values query May 5, 2026
@bartoval bartoval changed the title [ES|QL] Disable save for stale values query [ES|QL] Disable the Save button any time the ES|QL query is changed May 5, 2026
});
}, []);

const formIsInvalid = useMemo(() => {
Copy link
Copy Markdown
Contributor Author

@bartoval bartoval May 5, 2026

Choose a reason for hiding this comment

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

No need useMemo here but all constants are wrapped into it in thi file.

import { ChooseColumnPopover } from './choose_column_popover';
import { ControlLabel, ControlSelectionType } from './shared_form_components';

export type ValuesPreviewStatus = 'valid' | 'stale' | 'invalid';
Copy link
Copy Markdown
Contributor Author

@bartoval bartoval May 5, 2026

Choose a reason for hiding this comment

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

It can also simply be a boolean value, or e620cea ,
The latter provides a more comprehensive description of the state.

@bartoval bartoval force-pushed the esql-vlues-save-disabled branch from fa13e4c to e279c9c Compare May 5, 2026 17:33
@bartoval bartoval marked this pull request as ready for review May 6, 2026 04:23
@bartoval bartoval requested a review from a team as a code owner May 6, 2026 04:23
@infra-vault-gh-plugin-prod
Copy link
Copy Markdown

Pinging @elastic/kibana-esql (Team:ESQL)

Copy link
Copy Markdown
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Works very nice, just some small comments from me

import type { ISearchGeneric } from '@kbn/search-types';
import type { monaco } from '@kbn/monaco';
import { ValueControlForm } from './value_control_form';
import type { monaco } from '@kbn/code-editor';
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.

If we are changing this to code-editor lets change all the occurences because now we have reference both in code editor and monaco

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.

Let's add at least one test here to test the new behavior

const [variableType, setVariableType] = useState<ESQLVariableType>(initialVariableType);

const [formIsInvalid, setFormIsInvalid] = useState(false);
const [valueControlFormStatus, setValueControlFormStatus] = useState<ValueControlFormStatus>({
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 bit optimistic, sometimes we initialize in wrong queries (when the user tries to create the control from the query) so this won't be valid. till the validation runs and disables the button the user can click save. I would initialize to stale


export type ValuesPreviewStatus = 'valid' | 'stale' | 'invalid';

export interface ValueControlFormStatus {
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 are we overcomplicating the state here? We dont need the ValueControlFormStatus, just the valuesPreviewStatus: ValuesPreviewStatus;

import { ChooseColumnPopover } from './choose_column_popover';
import { ControlLabel, ControlSelectionType } from './shared_form_components';

export type ValuesPreviewStatus = 'valid' | 'stale' | 'invalid';
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.

Isnt a boolean enough? IsValid is enough. We dont have any plans to have a different UI for stale and invalid

@bartoval bartoval force-pushed the esql-vlues-save-disabled branch 2 times, most recently from da48d54 to 61aad7f Compare May 6, 2026 07:53
@bartoval bartoval force-pushed the esql-vlues-save-disabled branch from 61aad7f to 4d01b43 Compare May 6, 2026 08:06
Copy link
Copy Markdown
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

I didnt test again but it looks good to me, thanks Val

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
esql 896.1KB 896.2KB +94.0B

History

cc @bartoval

@bartoval bartoval merged commit 88c4f06 into elastic:main May 6, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:ESQL ES|QL related features in Kibana t// v9.5.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ES|QL Controls] Can be saved in a broken state

3 participants