@keycloakify/keycloak-admin-ui
Version:
Repackaged Keycloak Admin UI
23 lines • 2.06 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Button, Flex, FlexItem, Title, TitleSizes, } from "@patternfly/react-core";
import { ListEmptyState } from "../ui-shared";
import { AddStepModal } from "../authentication/components/modals/AddStepModal";
import { AddSubFlowModal } from "../authentication/components/modals/AddSubFlowModal";
import "./empty-execution-state.css";
const SECTIONS = ["addExecution", "addSubFlow"];
export const EmptyExecutionState = ({ flow, onAddExecution, onAddFlow, }) => {
const { t } = useTranslation();
const [show, setShow] = useState();
return (_jsxs(_Fragment, { children: [show === "addExecution" && (_jsx(AddStepModal, { name: flow.alias, type: flow.providerId === "client-flow" ? "client" : "basic", onSelect: (type) => {
if (type) {
onAddExecution(type);
}
setShow(undefined);
} })), show === "addSubFlow" && (_jsx(AddSubFlowModal, { name: flow.alias, onCancel: () => setShow(undefined), onConfirm: (newFlow) => {
onAddFlow(newFlow);
setShow(undefined);
} })), _jsx(ListEmptyState, { message: t("emptyExecution"), instructions: t("emptyExecutionInstructions") }), _jsx("div", { className: "keycloak__empty-execution-state__block", children: SECTIONS.map((section) => (_jsxs(Flex, { className: "keycloak__empty-execution-state__help", children: [_jsxs(FlexItem, { flex: { default: "flex_1" }, children: [_jsx(Title, { headingLevel: "h2", size: TitleSizes.md, children: t(`${section}Title`) }), _jsx("p", { children: t(section) })] }), _jsx(Flex, { alignSelf: { default: "alignSelfCenter" }, children: _jsx(FlexItem, { children: _jsx(Button, { "data-testid": section, variant: "tertiary", onClick: () => setShow(section), children: t(section) }) }) })] }, section))) })] }));
};
//# sourceMappingURL=EmptyExecutionState.js.map