diff --git a/client-reactjs/src/components/application/dashboard/clusterUsage/charts/CurrentClusterUsageCharts.jsx b/client-reactjs/src/components/application/dashboard/clusterUsage/charts/CurrentClusterUsageCharts.jsx index 8f5cea27c..fef8b66d3 100644 --- a/client-reactjs/src/components/application/dashboard/clusterUsage/charts/CurrentClusterUsageCharts.jsx +++ b/client-reactjs/src/components/application/dashboard/clusterUsage/charts/CurrentClusterUsageCharts.jsx @@ -5,6 +5,7 @@ import { Empty, Select } from 'antd'; import { addQueriesToUrl } from '../../../../common/AddQueryToUrl.js'; import { authHeader, handleError } from '../../../../common/AuthHeader.js'; import MeterGauge from './MeterGauge.jsx'; +import '../index.css'; const { Option } = Select; function CurrentClusterUsageCharts({ selectedCluster, setSelectedCluster }) { @@ -28,7 +29,27 @@ function CurrentClusterUsageCharts({ selectedCluster, setSelectedCluster }) { const response = await fetch(`/api/cluster/currentClusterUsage/${clusterId}`, payload); if (!response.ok) handleError(response); const data = await response.json(); - setCurrentUsage(data); + + const groupedUsage = []; + const groupedData = {}; + + data.forEach((d) => { + const key = d.maxUsage + 'x' + d.meanUsage; + if (groupedData[key]) { + const newEngineList = [...groupedData[key].engines, d.name]; + groupedData[key] = { ...groupedData[key], engines: newEngineList }; + } else { + groupedData[key] = { data: { maxUsage: d.maxUsage, meanUsage: d.meanUsage }, engines: [d.name] }; + } + }); + + if (Object.keys(groupedData).length > 0) { + for (const key in groupedData) { + groupedUsage.push({ data: groupedData[key].data, engines: groupedData[key].engines }); + } + } + + setCurrentUsage(groupedUsage); } catch (err) { setCurrentUsage([]); handleError(err); @@ -42,32 +63,45 @@ function CurrentClusterUsageCharts({ selectedCluster, setSelectedCluster }) { }; return ( -