Fix UX issues and improve Docker monitoring user experience
Critical fixes: 1. Monitor type detection on edit - When editing a Docker monitor, type is now correctly detected from monitor object - Previously defaulted to "hardware" causing incorrect form fields to show - Fix: Detect type from query params on create, from monitor.type on edit 2. Default interval for Docker monitors - Docker monitors now default to 30 seconds (0.5 minutes) on creation - Hardware monitors remain at 15 seconds (0.25 minutes) - Pass monitorType to initializeInfrastructureMonitorForCreate 3. Type-aware fallback links - Hardware tab empty state: links to /infrastructure/create?type=hardware - Docker tab empty state: links to /infrastructure/create?type=docker - Ensures correct form is shown when creating from empty state UX improvements: 4. Enhanced error messaging in Docker container table - Differentiate between "No containers" vs "Docker daemon unavailable" - Show error details when Capture API fails - Display critical errors (docker.client) with red background - Show partial error messages when some containers fail to inspect 5. Display Capture metadata - Show Capture version in container table header - Display error count when errors are present (⚠ N error(s) encountered) - Help users identify API issues vs legitimate empty states 6. Improved empty state handling - "Docker daemon unavailable" - when Docker socket unreachable on Capture server - "No containers found" - when Capture is working but no containers exist - "Partial data available" - when some containers failed to inspect - Show specific error messages from Capture API These changes improve the user experience when: - Editing existing Docker monitors (correct form fields shown) - Creating Docker monitors (proper default interval) - Troubleshooting Capture API issues (clear error messages) - Understanding container availability (version info, error details)
This commit is contained in:
5 files changed
+81
-17
No files matched your search
+64
-9
@@ -3,7 +3,7 @@ import { useTheme } from "@emotion/react";
|
||||
import DataTable from "@/Components/v1/Table/index.jsx";
|
||||
import { StatusLabel } from "@/Components/v1/Label/index.jsx";
|
||||
|
||||
const DockerContainersTable = ({ containers = [] }) => {
|
||||
const DockerContainersTable = ({ containers = [], errors = [], captureVersion }) => {
|
||||
const theme = useTheme();
|
||||
|
||||
// Helper to format uptime
|
||||
@@ -136,7 +136,22 @@ const DockerContainersTable = ({ containers = [] }) => {
|
||||
},
|
||||
];
|
||||
|
||||
// Check if there are critical errors (Docker daemon down)
|
||||
const dockerClientError = errors.find((e) => e.metric && e.metric.includes("docker.client"));
|
||||
|
||||
if (!containers || containers.length === 0) {
|
||||
// Determine the message based on error type
|
||||
let message = "No containers found";
|
||||
let errorDetails = null;
|
||||
|
||||
if (dockerClientError) {
|
||||
message = "Docker daemon unavailable";
|
||||
errorDetails = dockerClientError.err;
|
||||
} else if (errors && errors.length > 0) {
|
||||
message = "Partial data available";
|
||||
errorDetails = "Some containers could not be inspected";
|
||||
}
|
||||
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -144,26 +159,66 @@ const DockerContainersTable = ({ containers = [] }) => {
|
||||
textAlign: "center",
|
||||
border: `1px solid ${theme.palette.divider}`,
|
||||
borderRadius: theme.spacing(2),
|
||||
backgroundColor: dockerClientError ? theme.palette.error.lighter : undefined,
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="body1"
|
||||
color="textSecondary"
|
||||
color={dockerClientError ? "error.main" : "textSecondary"}
|
||||
fontWeight={600}
|
||||
mb={errorDetails ? theme.spacing(2) : 0}
|
||||
>
|
||||
No containers found
|
||||
{message}
|
||||
</Typography>
|
||||
{errorDetails && (
|
||||
<Typography
|
||||
variant="body2"
|
||||
color="textSecondary"
|
||||
>
|
||||
{errorDetails}
|
||||
</Typography>
|
||||
)}
|
||||
{captureVersion && (
|
||||
<Typography
|
||||
variant="caption"
|
||||
color="textSecondary"
|
||||
sx={{ display: "block", marginTop: theme.spacing(4) }}
|
||||
>
|
||||
Capture version: {captureVersion}
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Stack gap={theme.spacing(4)}>
|
||||
<Typography
|
||||
variant="h3"
|
||||
fontWeight={600}
|
||||
>
|
||||
Docker Containers ({containers.length})
|
||||
</Typography>
|
||||
<Box>
|
||||
<Typography
|
||||
variant="h3"
|
||||
fontWeight={600}
|
||||
>
|
||||
Docker Containers ({containers.length})
|
||||
</Typography>
|
||||
{errors && errors.length > 0 && (
|
||||
<Typography
|
||||
variant="caption"
|
||||
color="warning.main"
|
||||
sx={{ display: "block", marginTop: theme.spacing(1) }}
|
||||
>
|
||||
⚠ {errors.length} error(s) encountered while fetching container data
|
||||
</Typography>
|
||||
)}
|
||||
{captureVersion && (
|
||||
<Typography
|
||||
variant="caption"
|
||||
color="textSecondary"
|
||||
sx={{ display: "block", marginTop: theme.spacing(1) }}
|
||||
>
|
||||
Capture version: {captureVersion}
|
||||
</Typography>
|
||||
)}
|
||||
</Box>
|
||||
<DataTable
|
||||
headers={headers}
|
||||
data={containers}
|
||||
|
||||
Reference in new issue
Block a user