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

[Backport 2.5] Few fixes regarding issues for visualization rendering #186

Merged
merged 1 commit into from
Jan 10, 2023
Merged
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
59 changes: 25 additions & 34 deletions public/components/event_analytics/explorer/explorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,31 +414,35 @@ export const Explorer = ({
curQuery![FILTERED_PATTERN]
);

await dispatch(
changeQuery({
tabId,
query: {
finalQuery,
[RAW_QUERY]: rawQueryStr,
[SELECTED_TIMESTAMP]: curTimestamp,
},
})
);

// search
if (finalQuery.match(PPL_STATS_REGEX)) {
const cusVisIds = userVizConfigs ? Object.keys(userVizConfigs) : [];
getVisualizations();
getAvailableFields(`search source=${curIndex}`);
for (const visId of cusVisIds) {
batch(() => {
dispatch(
changeQuery({
tabId,
query: {
finalQuery,
[RAW_QUERY]: rawQueryStr,
[SELECTED_TIMESTAMP]: curTimestamp,
},
})
);
if (selectedContentTabId === TAB_CHART_ID) {
// parse stats section on every search
const statsTokens = queryManager.queryParser().parse(rawQueryStr).getStats();
const updatedDataConfig = getDefaultVisConfig(statsTokens);
dispatch(
changeVisualizationConfig({
changeVizConfig({
tabId,
vizId: visId,
data: { ...userVizConfigs[visId] },
vizId: curVisId,
data: { dataConfig: { ...updatedDataConfig } },
})
);
}
});

// search
if (finalQuery.match(PPL_STATS_REGEX)) {
getVisualizations();
getAvailableFields(`search source=${curIndex}`);
} else {
if (!selectedIntervalRef.current || selectedIntervalRef.current.text === 'Auto') {
findAutoInterval(startingTime, endingTime);
Expand Down Expand Up @@ -1122,21 +1126,8 @@ export const Explorer = ({
await updateQueryInStore(tempQuery);
}
await fetchData();

if (selectedContentTabId === TAB_CHART_ID) {
// parse stats section on every search
const statsTokens = queryManager.queryParser().parse(tempQuery).getStats();
const updatedDataConfig = getDefaultVisConfig(statsTokens);
await dispatch(
changeVizConfig({
tabId,
vizId: curVisId,
data: { dataConfig: { ...updatedDataConfig } },
})
);
}
},
[tempQuery, query, selectedContentTabId, curVisId]
[tempQuery, query]
);

const handleQueryChange = async (newQuery: string) => setTempQuery(newQuery);
Expand Down