UNPKG

@keycloakify/keycloak-admin-ui

Version:
32 lines 1.62 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { Button, ToolbarItem } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { ListEmptyState } from "../../ui-shared"; import { KeycloakDataTable } from "../../ui-shared"; import { translationFormatter } from "../../utils/translationFormatter"; export function EventsTypeTable({ ariaLabelKey = "userEventsRegistered", eventTypes, addTypes, onSelect, onDelete, }) { const { t } = useTranslation(); const data = eventTypes.map((type) => ({ id: type, name: t(`eventTypes.${type}.name`), description: t(`eventTypes.${type}.description`), })); return (_jsx(KeycloakDataTable, { ariaLabelKey: ariaLabelKey, searchPlaceholderKey: "searchEventType", loader: data, onSelect: onSelect ? onSelect : undefined, canSelectAll: !!onSelect, toolbarItem: addTypes && (_jsx(ToolbarItem, { children: _jsx(Button, { id: "addTypes", onClick: addTypes, "data-testid": "addTypes", children: t("addSavedTypes") }) })), actions: !onDelete ? [] : [ { title: t("remove"), onRowClick: onDelete, }, ], columns: [ { name: "name", displayKey: "eventType", }, { name: "description", cellFormatters: [translationFormatter(t)], }, ], emptyState: _jsx(ListEmptyState, { message: t("emptyEvents"), instructions: t("emptyEventsInstructions") }) })); } //# sourceMappingURL=EventsTypeTable.js.map