@@ -190,26 +181,7 @@ export function NetworkChart({
- {chartDataKey.map((key) => {
- return (
-
- );
- })}
+ {chartButtons}
@@ -219,15 +191,8 @@ export function NetworkChart({
>
} />
)}
- {activeChart !== defaultChart && (
-
- )}
- {activeChart === defaultChart &&
- chartDataKey.map((key) => (
-
- ))}
+ {chartLines}
);
+});
+
+
+const transformData = (data: NezhaAPIMonitor[]) => {
+ const monitorData: ServerMonitorChart = {};
+
+ data.forEach((item) => {
+ const monitorName = item.monitor_name;
+
+ if (!monitorData[monitorName]) {
+ monitorData[monitorName] = [];
+ }
+
+ for (let i = 0; i < item.created_at.length; i++) {
+ monitorData[monitorName].push({
+ created_at: item.created_at[i],
+ avg_delay: item.avg_delay[i],
+ });
+ }
+ });
+
+ return monitorData;
}
+
+const formatData = (rawData: NezhaAPIMonitor[]) => {
+ const result: { [time: number]: ResultItem } = {};
+
+ const allTimes = new Set