Skip to content

Commit

Permalink
[#noissue] Fix filteredMap merge logic
Browse files Browse the repository at this point in the history
  • Loading branch information
binDongKim committed May 28, 2024
1 parent 872a36e commit e61304b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
4 changes: 3 additions & 1 deletion web-frontend/src/main/v3/packages/atoms/src/scatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ export const scatterDataByApplicationKeyAtom = atom(
const mergedKeys = newData ? getMergedKeys(prevData, newData) : undefined;
const resultData = mergedKeys?.reduce((acc, key) => {
const prevScatterData = prevData?.[key];
const newScatterData = getScatterData(newData[key], prevScatterData);
const newScatterData = newData[key]
? getScatterData(newData[key], prevScatterData)
: prevScatterData;
return {
...acc,
[key]: newScatterData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,17 @@ function mergeTimeSeriesHistogram(
return;
}
if (obj.key === 'Max') {
obj.values.forEach((chartValue, innerIndex: number) => {
old.timeSeriesHistogram[outerIndex].values[innerIndex][1] = Math.max(
old.timeSeriesHistogram[outerIndex].values[innerIndex][1],
chartValue[1],
old.timeSeriesHistogram[outerIndex].values.forEach((value) => {
value[1] = Math.max(
value[1],
obj.values.find((chartValue) => chartValue[0] === value[0])?.[1] || 0,
);
});

return;
}
obj.values.forEach((chartValue, innerIndex: number) => {
old.timeSeriesHistogram[outerIndex].values[innerIndex][1] += chartValue[1];
old.timeSeriesHistogram[outerIndex].values.forEach((value) => {
value[1] += obj.values.find((chartValue) => chartValue[0] === value[0])?.[1] || 0;
});
});
updateAvgTimeSeriesHistogram(old.timeSeriesHistogram);
Expand Down Expand Up @@ -252,16 +253,17 @@ function mergeAgentTimeSeriesHistogramByType(
return;
}
if (obj.key === 'Max') {
obj.values.forEach((chartValue, innerIndex) => {
old[agentId][outerIndex].values[innerIndex][1] = Math.max(
old[agentId][outerIndex].values[innerIndex][1],
chartValue[1],
old[agentId][outerIndex].values.forEach((value) => {
value[1] = Math.max(
value[1],
obj.values.find((chartValue) => chartValue[0] === value[0])?.[1] || 0,
);
});

return;
}
obj.values.forEach((chartValue, innerIndex) => {
old[agentId][outerIndex].values[innerIndex][1] += chartValue[1];
old[agentId][outerIndex].values.forEach((value) => {
value[1] += obj.values.find((chartValue) => chartValue[0] === value[0])?.[1] || 0;
});
});
updateAvgTimeSeriesHistogram(old[agentId]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const getBaseNodeId = ({
const nodeList = applicationMapData.nodeDataArray;
const baseNodeId = `${application?.applicationName}^${application?.serviceType}`;

return nodeList.some(({ key }: { key: string }) => key === baseNodeId)
return nodeList.length === 0 || nodeList.some(({ key }: { key: string }) => key === baseNodeId)
? baseNodeId
: baseNodeId.replace(/(.*)\^(.*)/i, '$1^UNAUTHORIZED');
}
Expand Down

0 comments on commit e61304b

Please sign in to comment.