UNPKG

@keycloakify/keycloak-admin-ui

Version:
26 lines 2.25 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { TableToolbar } from "../ui-shared"; import { ExpandableSection, PageSection } from "@patternfly/react-core"; import { Table, Tbody, Td, Th, Thead, Tr } from "@patternfly/react-table"; import { useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { useServerInfo } from "../context/server-info/ServerInfoProvider"; export const ProviderInfo = () => { const { t } = useTranslation(); const serverInfo = useServerInfo(); const [filter, setFilter] = useState(""); const [open, setOpen] = useState([]); const providerInfo = useMemo(() => Object.entries(serverInfo.providers || []).filter(([key]) => key.toLowerCase().includes(filter.toLowerCase())), [filter]); const toggleOpen = (option) => { if (open.includes(option)) { setOpen(open.filter((item) => item !== option)); } else { setOpen([...open, option]); } }; return (_jsx(PageSection, { variant: "light", children: _jsx(TableToolbar, { inputGroupName: "search", inputGroupPlaceholder: t("search"), inputGroupOnEnter: setFilter, children: _jsxs(Table, { variant: "compact", children: [_jsx(Thead, { children: _jsxs(Tr, { children: [_jsx(Th, { width: 20, children: t("spi") }), _jsx(Th, { children: t("providers") })] }) }), _jsx(Tbody, { children: providerInfo.map(([name, { providers }]) => (_jsxs(Tr, { children: [_jsx(Td, { children: name }), _jsx(Td, { children: _jsx("ul", { children: Object.entries(providers).map(([key, { operationalInfo }]) => (_jsxs("li", { children: [key, operationalInfo ? (_jsx(ExpandableSection, { isExpanded: open.includes(key), onToggle: () => toggleOpen(key), toggleText: open.includes(key) ? t("showLess") : t("showMore"), children: _jsx(Table, { borders: false, children: _jsx(Tbody, { children: Object.entries(operationalInfo).map(([key, value]) => (_jsxs(Tr, { children: [_jsx(Td, { children: key }), _jsx(Td, { children: value })] }, key))) }) }) }, key)) : null] }, key))) }) })] }, name))) })] }) }) })); }; //# sourceMappingURL=ProviderInfo.js.map