prometheus/web/ui/mantine-ui/src/pages/AlertmanagerDiscoveryPage.tsx
Julius Volz 0180cf31aa
Some checks failed
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Factor out common icon and card styles
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2024-09-13 14:44:04 +02:00

71 lines
2.3 KiB
TypeScript

import { Alert, Table } from "@mantine/core";
import { IconBell, IconBellOff, IconInfoCircle } from "@tabler/icons-react";
import { useSuspenseAPIQuery } from "../api/api";
import { AlertmanagersResult } from "../api/responseTypes/alertmanagers";
import EndpointLink from "../components/EndpointLink";
import InfoPageCard from "../components/InfoPageCard";
import InfoPageStack from "../components/InfoPageStack";
export const targetPoolDisplayLimit = 20;
export default function AlertmanagerDiscoveryPage() {
// Load the list of all available scrape pools.
const {
data: {
data: { activeAlertmanagers, droppedAlertmanagers },
},
} = useSuspenseAPIQuery<AlertmanagersResult>({
path: `/alertmanagers`,
});
return (
<InfoPageStack>
<InfoPageCard title="Active Alertmanagers" icon={IconBell}>
{activeAlertmanagers.length === 0 ? (
<Alert title="No active alertmanagers" icon={<IconInfoCircle />}>
No active alertmanagers found.
</Alert>
) : (
<Table layout="fixed">
<Table.Tbody>
{activeAlertmanagers.map((alertmanager) => (
<Table.Tr key={alertmanager.url}>
<Table.Td>
<EndpointLink
endpoint={alertmanager.url}
globalUrl={alertmanager.url}
/>
</Table.Td>
</Table.Tr>
))}
</Table.Tbody>
</Table>
)}
</InfoPageCard>
<InfoPageCard title="Dropped Alertmanagers" icon={IconBellOff}>
{droppedAlertmanagers.length === 0 ? (
<Alert title="No dropped alertmanagers" icon={<IconInfoCircle />}>
No dropped alertmanagers found.
</Alert>
) : (
<Table layout="fixed">
<Table.Tbody>
{droppedAlertmanagers.map((alertmanager) => (
<Table.Tr key={alertmanager.url}>
<Table.Td>
<EndpointLink
endpoint={alertmanager.url}
globalUrl={alertmanager.url}
/>
</Table.Td>
</Table.Tr>
))}
</Table.Tbody>
</Table>
)}
</InfoPageCard>
</InfoPageStack>
);
}