@keycloakify/keycloak-admin-ui
Version:
Repackaged Keycloak Admin UI
23 lines • 3.63 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Button, DataListCell, DataListControl, DataListDragButton, DataListItem, DataListItemCells, DataListItemRow, DataListToggle, Draggable, Text, TextVariants, Tooltip, } from "@patternfly/react-core";
import { TrashIcon } from "@patternfly/react-icons";
import { useTranslation } from "react-i18next";
import { AddFlowDropdown } from "../../authentication/components/AddFlowDropdown";
import { EditFlow } from "../../authentication/components/EditFlow";
import { ExecutionConfigModal } from "../../authentication/components/ExecutionConfigModal";
import { FlowRequirementDropdown } from "../../authentication/components/FlowRequirementDropdown";
import { FlowTitle } from "../../authentication/components/FlowTitle";
import "./flow-row.css";
export const FlowRow = ({ builtIn, execution, onRowClick, onRowChange, onAddExecution, onAddFlow, onDelete, }) => {
var _a, _b;
const { t } = useTranslation();
const hasSubList = !!((_a = execution.executionList) === null || _a === void 0 ? void 0 : _a.length);
return (_jsxs(_Fragment, { children: [_jsx(Draggable, { hasNoWrapper: true, children: _jsx(DataListItem, { className: "keycloak__authentication__flow-item", id: execution.id, isExpanded: !execution.isCollapsed, "aria-labelledby": `title-id-${execution.id}`, children: _jsxs(DataListItemRow, { className: "keycloak__authentication__flow-row", "aria-level": execution.level + 1, role: "heading", "aria-labelledby": execution.id, children: [_jsx(DataListControl, { children: _jsx(DataListDragButton, { "aria-label": t("dragHelp") }) }), hasSubList && (_jsx(DataListToggle, { onClick: () => onRowClick(execution), isExpanded: !execution.isCollapsed, id: `toggle1-${execution.id}`, "aria-controls": execution.executionList[0].id })), _jsx(DataListItemCells, { dataListCells: [
_jsxs(DataListCell, { children: [!execution.authenticationFlow && (_jsx(FlowTitle, { id: execution.id, alias: execution.alias, title: execution.displayName }, execution.id)), execution.authenticationFlow && (_jsxs(_Fragment, { children: [execution.displayName, " ", _jsx("br", {}), " ", _jsxs(Text, { component: TextVariants.small, children: [execution.alias, " ", execution.description] })] }))] }, `${execution.id}-name`),
_jsx(DataListCell, { children: _jsx(FlowRequirementDropdown, { flow: execution, onChange: onRowChange }) }, `${execution.id}-requirement`),
_jsxs(DataListCell, { children: [_jsx(ExecutionConfigModal, { execution: execution }), execution.authenticationFlow && !builtIn && (_jsxs(_Fragment, { children: [_jsx(AddFlowDropdown, { execution: execution, onAddExecution: onAddExecution, onAddFlow: onAddFlow }), _jsx(EditFlow, { execution: execution, onRowChange: onRowChange })] })), !builtIn && (_jsx(Tooltip, { content: t("delete"), children: _jsx(Button, { variant: "plain", "data-testid": `${execution.displayName}-delete`, "aria-label": t("delete"), onClick: () => onDelete(execution), children: _jsx(TrashIcon, {}) }) }))] }, `${execution.id}-config`),
] })] }) }) }, `draggable-${execution.id}`), !execution.isCollapsed &&
hasSubList &&
((_b = execution.executionList) === null || _b === void 0 ? void 0 : _b.map((ex) => (_jsx(FlowRow, { builtIn: builtIn, execution: ex, onRowClick: onRowClick, onRowChange: onRowChange, onAddExecution: onAddExecution, onAddFlow: onAddFlow, onDelete: onDelete }, ex.id))))] }));
};
//# sourceMappingURL=FlowRow.js.map