Skip to content

Commit

Permalink
fix(slo): handle custom DSL query filters (#198073)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdelemme authored Oct 31, 2024
1 parent 6ef1bce commit aca6907
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const QuerySearchBar = memo(
field.onChange(String(value?.query));
} else {
field.onChange({
...(field.value ?? {}),
filters: field.value?.filters ?? [],
kqlQuery: String(value?.query),
});
}
Expand Down Expand Up @@ -111,15 +111,27 @@ export const QuerySearchBar = memo(
}
onQuerySubmit={(value) => handleQueryChange(value.query, value.dateRange)}
onFiltersUpdated={(filters) => {
const updatedFilters = filters.map((filter) => {
const { $state, meta, ...rest } = filter;
const query = filter?.query ? { ...filter.query } : { ...rest };
return {
meta: {
...meta,
alias: meta?.alias ?? JSON.stringify(query),
},
query,
};
});

if (kqlQuerySchema.is(field.value)) {
field.onChange({
filters,
filters: updatedFilters,
kqlQuery: field.value,
});
} else {
field.onChange({
...(field.value ?? {}),
filters,
kqlQuery: field.value?.kqlQuery ?? '',
filters: updatedFilters,
});
}
}}
Expand Down

0 comments on commit aca6907

Please sign in to comment.