UNPKG

@keycloakify/keycloak-admin-ui

Version:
30 lines 1.32 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { PageSection } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { useAdminClient } from "../admin-client"; import SessionsTable from "../sessions/SessionsTable"; export const ClientSessions = ({ client }) => { const { adminClient } = useAdminClient(); const { t } = useTranslation(); const loader = async (first, max) => { const mapSessionsToType = (type) => (sessions) => sessions.map((session) => ({ type, ...session, })); const allSessions = await Promise.all([ adminClient.clients .listSessions({ id: client.id, first, max }) .then(mapSessionsToType(t("sessionsType.regularSSO"))), adminClient.clients .listOfflineSessions({ id: client.id, first, max, }) .then(mapSessionsToType(t("sessionsType.offline"))), ]); return allSessions.flat(); }; return (_jsx(PageSection, { variant: "light", className: "pf-v5-u-p-0", children: _jsx(SessionsTable, { loader: loader, hiddenColumns: ["clients"], emptyInstructions: t("noSessionsForClient") }) })); }; //# sourceMappingURL=ClientSessions.js.map