diff --git a/quickwit/quickwit-ui/src/components/QueryActionBar.tsx b/quickwit/quickwit-ui/src/components/QueryActionBar.tsx index 05da2563a4e..962b0c5b222 100644 --- a/quickwit/quickwit-ui/src/components/QueryActionBar.tsx +++ b/quickwit/quickwit-ui/src/components/QueryActionBar.tsx @@ -27,7 +27,7 @@ export function QueryEditorActionBar(props: SearchComponentProps) { const shouldDisplayTimeRangeSelect = timestamp_field_name ?? false; const handleChange = (_event: React.SyntheticEvent, newTab: number) => { - const updatedSearchRequest = Object.assign({}, props.searchRequest, {aggregation: newTab != 0}); + const updatedSearchRequest = {...props.searchRequest, aggregation: newTab != 0}; props.onSearchRequestUpdate(updatedSearchRequest); }; diff --git a/quickwit/quickwit-ui/src/components/QueryEditor/AggregationEditor.tsx b/quickwit/quickwit-ui/src/components/QueryEditor/AggregationEditor.tsx index 80635f8a2dc..6dbb5194e58 100644 --- a/quickwit/quickwit-ui/src/components/QueryEditor/AggregationEditor.tsx +++ b/quickwit/quickwit-ui/src/components/QueryEditor/AggregationEditor.tsx @@ -51,9 +51,9 @@ export function MetricKind(props: SearchComponentProps) { const handleTypeChange = (event: SelectChangeEvent) => { const value = event.target.value; - const updatedMetric = value != "count" ? Object.assign({}, metricRef.current, {type: value}) : null; - const updatedAggregation = Object.assign({}, props.searchRequest.aggregationConfig, {metric: updatedMetric}); - const updatedSearchRequest = Object.assign({}, props.searchRequest, {aggregationConfig: updatedAggregation}); + const updatedMetric = value != "count" ? {...metricRef.current!, type: value} : null; + const updatedAggregation = {...props.searchRequest.aggregationConfig, metric: updatedMetric}; + const updatedSearchRequest = {...props.searchRequest, aggregationConfig: updatedAggregation}; props.onSearchRequestUpdate(updatedSearchRequest); metricRef.current = updatedMetric; }; @@ -63,9 +63,9 @@ export function MetricKind(props: SearchComponentProps) { if (metricRef.current == null) { return; } - const updatedMetric = Object.assign({}, metricRef.current, {field: value}); - const updatedAggregation = Object.assign({}, props.searchRequest.aggregationConfig, {metric: updatedMetric}); - const updatedSearchRequest = Object.assign({}, props.searchRequest, {aggregationConfig: updatedAggregation}); + const updatedMetric = {...metricRef.current!, field: value}; + const updatedAggregation = {...props.searchRequest.aggregationConfig, metric: updatedMetric}; + const updatedSearchRequest = {...props.searchRequest, aggregationConfig: updatedAggregation}; props.onSearchRequestUpdate(updatedSearchRequest); metricRef.current = updatedMetric; }; @@ -108,7 +108,7 @@ export function AggregationKind(props: SearchComponentProps) { const updateAggregationProp = (newAggregations: ({term: TermAgg} | {histogram: HistogramAgg})[]) => { const metric = props.searchRequest.aggregationConfig.metric; const updatedAggregation = Object.assign({}, {metric: metric}, ...newAggregations); - const updatedSearchRequest = Object.assign({}, props.searchRequest, {aggregationConfig: updatedAggregation}); + const updatedSearchRequest = {...props.searchRequest, aggregationConfig: updatedAggregation}; props.onSearchRequestUpdate(updatedSearchRequest); }; @@ -233,7 +233,7 @@ export function AggregationKind(props: SearchComponentProps) { const aggregationConfig = props.searchRequest.aggregationConfig; if (aggregationConfig.histogram === null && aggregationConfig.term === null) { const initialAggregation = Object.assign({}, ...aggregations); - const initialSearchRequest = Object.assign({}, props.searchRequest, {aggregationConfig: initialAggregation}); + const initialSearchRequest = {...props.searchRequest, aggregationConfig: initialAggregation}; props.onSearchRequestUpdate(initialSearchRequest); } @@ -247,7 +247,7 @@ export function AggregationKind(props: SearchComponentProps) { sx={{ "margin-left": "10px", "min-height": "44px" }} > Auto - 10 secods + 10 seconds 1 minute 5 minutes 10 minutes diff --git a/quickwit/quickwit-ui/src/services/client.ts b/quickwit/quickwit-ui/src/services/client.ts index bbaa4fe0ff3..94d953e6357 100644 --- a/quickwit/quickwit-ui/src/services/client.ts +++ b/quickwit/quickwit-ui/src/services/client.ts @@ -90,7 +90,7 @@ export class Client { if (body !== null) { params.method = "POST"; params.body = body; - params.headers = Object.assign({}, params.headers, {"content-type": "application/json"}); + params.headers = {...params.headers, "content-type": "application/json"}; } const response = await fetch(url, params); if (response.ok) {