UNPKG

@keycloakify/keycloak-account-ui

Version:
45 lines 2.31 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { Badge, Chip, ChipGroup } from "@patternfly/react-core"; import { TableText } from "@patternfly/react-table"; import { useTranslation } from "react-i18next"; import { KeycloakDataTable } from "../../ui-shared/controls/table/KeycloakDataTable"; const OrgDetailLink = ({ link, organization }) => { const { t } = useTranslation(); const Component = link; return (_jsx(TableText, { wrapModifier: "truncate", children: _jsxs(Component, { organization: organization, children: [organization.name, !organization.enabled && (_jsx(Badge, { isRead: true, className: "pf-v5-u-ml-sm", children: t("disabled") }, `${organization.id}-disabled`))] }) })); }; const Domains = (org) => { var _a; const { t } = useTranslation(); return (_jsx(ChipGroup, { numChips: 2, expandedText: t("hide"), collapsedText: t("showRemaining"), children: (_a = org.domains) === null || _a === void 0 ? void 0 : _a.map((dn) => { const name = typeof dn === "string" ? dn : dn.name; return (_jsx(Chip, { isReadOnly: true, children: name }, name)); }) })); }; export const OrganizationTable = ({ loader, toolbarItem, isPaginated = false, onSelect, onDelete, deleteLabel = "delete", link, children, }) => { const { t } = useTranslation(); return (_jsx(KeycloakDataTable, { loader: loader, isPaginated: isPaginated, ariaLabelKey: "organizationList", searchPlaceholderKey: "searchOrganization", toolbarItem: toolbarItem, onSelect: onSelect, canSelectAll: onSelect !== undefined, actions: onDelete ? [ { title: t(deleteLabel), onRowClick: onDelete, }, ] : undefined, columns: [ { name: "name", displayKey: "name", cellRenderer: (row) => (_jsx(OrgDetailLink, { link: link, organization: row })), }, { name: "domains", displayKey: "domains", cellRenderer: Domains, }, { name: "description", displayKey: "description", }, ], emptyState: children })); }; //# sourceMappingURL=OrganizationTable.js.map