[ResponseOps][Alerting] ES query rule DSL editor doesn't update when you copy/paste a query (#162330)

Resolves https://github.com/elastic/kibana/issues/161595


## Summary

Captures changes in the editor when copying/pasting in values.


### To verify

- Create a new Es Query rule using DSL
- Paste runtime mappings in your query and don't type anything else in
the editor
- Verify that the runtime fields are listed in the group by or aggregate
over options below the query
This commit is contained in:
Alexi Doak 2023-07-25 08:51:46 -04:00 committed by GitHub
parent 7429c824bf
commit 89ad530e8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -114,10 +114,10 @@ export const EsQueryExpression: React.FC<
setCombinedFields(sortBy(currentEsFields.concat(runtimeFields), 'name'));
};
const getRuntimeFields = () => {
const getRuntimeFields = (xjson: string) => {
let runtimeMappings;
try {
runtimeMappings = get(JSON.parse(xJson), 'runtime_mappings');
runtimeMappings = get(JSON.parse(xjson), 'runtime_mappings');
} catch (e) {
// ignore error
}
@ -270,7 +270,7 @@ export const EsQueryExpression: React.FC<
onChange={(xjson: string) => {
setXJson(xjson);
setParam('esQuery', convertToJson(xjson));
getRuntimeFields();
getRuntimeFields(xjson);
}}
options={{
ariaLabel: i18n.translate('xpack.stackAlerts.esQuery.ui.queryEditor', {