Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jules/fix ci #5145

Merged
merged 4 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ export function MetricKind(props: SearchComponentProps) {
}

export function AggregationKind(props: SearchComponentProps) {
props;
const defaultAgg = {
histogram: {
interval: "1d",
Expand All @@ -117,12 +116,14 @@ export function AggregationKind(props: SearchComponentProps) {
}
}, []); // Empty dependency array means this runs once after mount

const updateAggregationProp = (newAggregations: ({term: TermAgg} | {histogram: HistogramAgg})[]) => {
useEffect(() => {
// Update search request whenever aggregations change
const metric = props.searchRequest.aggregationConfig.metric;
const updatedAggregation = Object.assign({}, {metric: metric}, ...newAggregations);
const updatedSearchRequest = {...props.searchRequest, aggregationConfig: updatedAggregation};
const updatedAggregation = Object.assign({}, { metric: metric }, ...aggregations);
const updatedSearchRequest = { ...props.searchRequest, aggregationConfig: updatedAggregation };
props.onSearchRequestUpdate(updatedSearchRequest);
};
}, [aggregations]);


const handleAggregationChange = (pos: number, event: SelectChangeEvent) => {
const value = event.target.value;
Expand Down Expand Up @@ -150,7 +151,6 @@ export function AggregationKind(props: SearchComponentProps) {
newAggregations.splice(pos, 1);
}
}
updateAggregationProp(newAggregations);
return newAggregations;
});
};
Expand All @@ -160,7 +160,6 @@ export function AggregationKind(props: SearchComponentProps) {
setAggregations((agg) => {
const newAggregations = [...agg];
newAggregations[pos] = {histogram: {interval:value}};
updateAggregationProp(newAggregations);
return newAggregations;
});
}
Expand All @@ -173,7 +172,6 @@ export function AggregationKind(props: SearchComponentProps) {
if (isTerm(term)) {
term.term.field = value;
}
updateAggregationProp(newAggregations);
return newAggregations;
});
};
Expand All @@ -186,7 +184,6 @@ export function AggregationKind(props: SearchComponentProps) {
if (isTerm(term)) {
term.term.size = Number(value);
}
updateAggregationProp(newAggregations);
return newAggregations;
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export function AggregationResult({searchResponse}: {searchResponse: SearchRespo
data: line.value,
};
});
series;
// we don't customize colors because we would need a full palette.
return (
<LineChart
Expand Down
30 changes: 14 additions & 16 deletions quickwit/quickwit-ui/src/components/SearchResult/SearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,27 @@ interface SearchResultProps {
}

export default function SearchResult(props: SearchResultProps) {
const result = useMemo(() => {
if (props.searchResponse == null || props.index == null) {
return null;
} else if (props.searchResponse.aggregations === undefined) {
return <ResultTable searchResponse={props.searchResponse} index={props.index} />;
} else {
return <AggregationResult searchResponse={props.searchResponse} />;
}
}, [props.searchResponse, props.index]);

if (props.queryRunning) {
return <Loader />
return <Loader />;
}

if (props.searchError !== null) {
return ErrorResponseDisplay(props.searchError);
}

if (props.searchResponse == null || props.index == null) {
return <></>
return <></>;
}
// try to improve typing experience by caching the costly-to-render components
// in practice this doesn't seem to have much impact
const result = useMemo(
() => {
if (props.searchResponse == null || props.index == null) {
return null;
} else if (props.searchResponse.aggregations === undefined) {
return (<ResultTable searchResponse={props.searchResponse} index={props.index} />);
} else {
return (<AggregationResult searchResponse={props.searchResponse} />);
}
},
[props.searchResponse, props.index]
);

return (
<Box sx={{ pt: 1, flexGrow: '1', flexBasis: '0%', overflow: 'hidden'}}>
Expand Down
6 changes: 3 additions & 3 deletions quickwit/quickwit-ui/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4910,9 +4910,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"

caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001541:
version "1.0.30001551"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001551.tgz"
integrity sha512-vtBAez47BoGMMzlbYhfXrMV1kvRF2WP/lqiMuDu1Sb4EE4LKEgjopFDSRtZfdVnslNRpOqV/woE+Xgrwj6VQlg==
version "1.0.30001636"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz"
integrity sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg==

case-sensitive-paths-webpack-plugin@^2.4.0:
version "2.4.0"
Expand Down
Loading