2024-09-13 05:43:05 -07:00
|
|
|
import { Alert, Table } from "@mantine/core";
|
2024-09-04 08:49:08 -07:00
|
|
|
import { IconBell, IconBellOff, IconInfoCircle } from "@tabler/icons-react";
|
2024-09-03 06:51:32 -07:00
|
|
|
|
|
|
|
import { useSuspenseAPIQuery } from "../api/api";
|
|
|
|
import { AlertmanagersResult } from "../api/responseTypes/alertmanagers";
|
|
|
|
import EndpointLink from "../components/EndpointLink";
|
2024-09-13 05:43:05 -07:00
|
|
|
import InfoPageCard from "../components/InfoPageCard";
|
|
|
|
import InfoPageStack from "../components/InfoPageStack";
|
2024-09-03 06:51:32 -07:00
|
|
|
|
|
|
|
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 (
|
2024-09-13 05:43:05 -07:00
|
|
|
<InfoPageStack>
|
|
|
|
<InfoPageCard title="Active Alertmanagers" icon={IconBell}>
|
2024-09-03 06:51:32 -07:00
|
|
|
{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>
|
|
|
|
)}
|
2024-09-13 05:43:05 -07:00
|
|
|
</InfoPageCard>
|
|
|
|
<InfoPageCard title="Dropped Alertmanagers" icon={IconBellOff}>
|
2024-09-03 06:51:32 -07:00
|
|
|
{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>
|
|
|
|
)}
|
2024-09-13 05:43:05 -07:00
|
|
|
</InfoPageCard>
|
|
|
|
</InfoPageStack>
|
2024-09-03 06:51:32 -07:00
|
|
|
);
|
|
|
|
}
|