Merge pull request #2409 from bluewave-labs/Capture-version-on-details-page

Capture version on details page
This commit is contained in:
Alexander Holliday authored and GitHub committed 2025-06-10 08:59:26 +08:00
commit a85d2c8559
5 files changed
+33 -2

No files matched your search

@@ -7,14 +7,22 @@ import { formatDurationRounded } from "../../Utils/timeUtils";
import ConfigButton from "./ConfigButton"; import ConfigButton from "./ConfigButton";
import SkeletonLayout from "./skeleton"; import SkeletonLayout from "./skeleton";
import PropTypes from "prop-types"; import PropTypes from "prop-types";
import { useTranslation } from "react-i18next";
const MonitorStatusHeader = ({ path, isLoading = false, isAdmin, monitor }) => { const MonitorStatusHeader = ({ path, isLoading = false, isAdmin, monitor }) => {
const theme = useTheme(); const theme = useTheme();
const { t } = useTranslation();
const { statusColor, determineState } = useUtils(); const { statusColor, determineState } = useUtils();
if (isLoading) { if (isLoading) {
return <SkeletonLayout />; return <SkeletonLayout />;
} }
const intervalText = t("monitorStatus.checkingEvery", {
interval: formatDurationRounded(monitor?.interval),
});
const captureVersion = monitor?.stats?.aggregateData?.latestCheck?.capture?.version;
return ( return (
<Stack <Stack
direction="row" direction="row"
@@ -36,7 +44,16 @@ const MonitorStatusHeader = ({ path, isLoading = false, isAdmin, monitor }) => {
</Typography> </Typography>
<Dot /> <Dot />
<Typography> <Typography>
Checking every {formatDurationRounded(monitor?.interval)}. {intervalText}
{captureVersion && (
<>
{" "}
{t("monitorStatus.withCaptureAgent", {
version: captureVersion,
})}
</>
)}
.
</Typography> </Typography>
</Stack> </Stack>
</Stack> </Stack>
@@ -17,7 +17,6 @@ const useHardwareMonitorsFetch = ({ monitorId, dateRange }) => {
monitorId: monitorId, monitorId: monitorId,
dateRange: dateRange, dateRange: dateRange,
}); });
response.data.data;
setMonitor(response.data.data); setMonitor(response.data.data);
} catch (error) { } catch (error) {
setNetworkError(true); setNetworkError(true);
+4
View File
@@ -649,5 +649,9 @@
"ping": "Enter the IP address or hostname to ping (e.g., 192.168.1.100 or example.com) and add a clear display name that appears on the dashboard.", "ping": "Enter the IP address or hostname to ping (e.g., 192.168.1.100 or example.com) and add a clear display name that appears on the dashboard.",
"docker": "Enter the Docker ID of your container. Docker IDs must be the full 64 char Docker ID. You can run docker inspect <short_id> to get the full container ID.", "docker": "Enter the Docker ID of your container. Docker IDs must be the full 64 char Docker ID. You can run docker inspect <short_id> to get the full container ID.",
"port": "Enter the URL or IP of the server, the port number and a clear display name that appears on the dashboard." "port": "Enter the URL or IP of the server, the port number and a clear display name that appears on the dashboard."
},
"monitorStatus": {
"checkingEvery": "Checking every {{interval}}",
"withCaptureAgent": "with Capture agent {{version}}"
} }
} }
+10
View File
@@ -35,6 +35,11 @@ const errorSchema = mongoose.Schema({
err: { type: String, default: "" }, err: { type: String, default: "" },
}); });
const captureSchema = mongoose.Schema({
version: { type: String, default: "" },
mode: { type: String, default: "" },
});
const HardwareCheckSchema = mongoose.Schema( const HardwareCheckSchema = mongoose.Schema(
{ {
...BaseCheckSchema.obj, ...BaseCheckSchema.obj,
@@ -59,6 +64,11 @@ const HardwareCheckSchema = mongoose.Schema(
type: [errorSchema], type: [errorSchema],
default: () => [], default: () => [],
}, },
capture: {
type: captureSchema,
default: () => ({}),
},
}, },
{ timestamps: true } { timestamps: true }
); );
+1
View File
@@ -243,6 +243,7 @@ class StatusService {
check.disk = disk ?? {}; check.disk = disk ?? {};
check.host = host ?? {}; check.host = host ?? {};
check.errors = errors ?? []; check.errors = errors ?? [];
check.capture = payload?.capture ?? {};
} }
return check; return check;
}; };