Skip to content

Commit

Permalink
Few fixes regarding issues for visualization rendering (#185) (#187)
Browse files Browse the repository at this point in the history
* removed non required dispatching

Signed-off-by: Eric Wei <menwe@amazon.com>

* fix viz rendering issue in app analytics

Signed-off-by: Eric Wei <menwe@amazon.com>

Signed-off-by: Eric Wei <menwe@amazon.com>
(cherry picked from commit 9ec4c21)

Co-authored-by: Eric Wei <menwe@amazon.com>
  • Loading branch information
opensearch-trigger-bot[bot] and mengweieric authored Jan 11, 2023
1 parent b8238ea commit 4bbebfe
Showing 1 changed file with 25 additions and 34 deletions.
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

0 comments on commit 4bbebfe

Please sign in to comment.