import React, { useState } from "react"; import { Button, ListGroup, Collapse } from "react-bootstrap"; import { Dash, ChevronDown, ChevronRight, CircleFill, } from "react-bootstrap-icons"; import { Container, Row, Col, Table, Card } from "react-bootstrap"; import { atom, useAtomValue } from "jotai"; import { atomWithQuery } from "jotai-tanstack-query"; const diagQueryFn = async () => { const resp = await fetch("api/diagnostics"); if (!resp.ok) { throw new Error("Network response was not ok"); } return resp.json(); }; const diagQueryAtom = atomWithQuery(() => ({ queryKey: ["diagnostics"], queryFn: diagQueryFn, })); const diagAtom = atom((get) => { const diag = get(diagQueryAtom); if (diag.isPending) { return "Loading..."; } if (diag.isError) { return "Error loading!"; } if (!diag.data.status) { return "Failed to get diagnostic information."; } return diag.data.message; }); export function DiagnosticsCard() { const diagnostics = useAtomValue(diagAtom); const diagContent = () => { if (typeof diagnostics === "string" || diagnostics instanceof String) { return
{diagnostics} ;
}
return | Key | Value | {Object.entries(values).map(([key, value]) => (
|---|---|
| {key} | {value} |
{status.name}