UNPKG

@openshift-assisted/ui-lib

Version:

React component library for the Assisted Installer UI

85 lines 9.94 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CimConfigurationForm = void 0; const tslib_1 = require("tslib"); const React = tslib_1.__importStar(require("react")); const react_i18next_1 = require("react-i18next"); const react_core_1 = require("@patternfly/react-core"); const external_link_alt_icon_1 = require("@patternfly/react-icons/dist/js/icons/external-link-alt-icon"); const exclamation_circle_icon_1 = require("@patternfly/react-icons/dist/js/icons/exclamation-circle-icon"); const help_icon_1 = require("@patternfly/react-icons/dist/js/icons/help-icon"); const use_translation_wrapper_1 = require("../../../../common/hooks/use-translation-wrapper"); require("./CimConfigurationForm.css"); const CimConfigurationForm = ({ docConfigUrl, docConfigAwsUrl, isEdit, isInProgressPeriod, dbVolSize, dbVolSizeValidation, setDbVolSize, fsVolSize, fsVolSizeValidation, setFsVolSize, imgVolSize, imgVolSizeValidation, setImgVolSize, configureLoadBalancer, configureLoadBalancerInitial, setConfigureLoadBalancer, }) => { const { t } = (0, use_translation_wrapper_1.useTranslation)(); const getNumber = (v, min) => { const p = parseFloat(v); if (isNaN(p)) { // Do not check for minimum here - keep it on validation return min; } return p; }; const awsHelp = (React.createElement(react_core_1.Popover, { bodyContent: t("ai:If you're running your hub cluster of Amazon Web Services and want to enable the CIM service, we recommend you to configure your load balancer if it is not already configured. Learn more about enabling CIM on AWS."), footerContent: React.createElement("a", { href: docConfigAwsUrl, target: "_blank", rel: "noreferrer" }, React.createElement(react_i18next_1.Trans, { t: t }, "ai:Learn more about enabling CIM on AWS ", React.createElement(external_link_alt_icon_1.ExternalLinkAltIcon, null))) }, React.createElement("button", { type: "button", "aria-label": t('ai:More info for load balancer on Amazon web services'), "aria-describedby": "cim-config-form-aws-title", onClick: (e) => e.preventDefault(), className: "pf-v5-c-form__group-label-help" }, React.createElement(react_core_1.Icon, null, React.createElement(help_icon_1.HelpIcon, null))))); return (React.createElement(react_core_1.Form, null, React.createElement(react_core_1.FormGroup, { fieldId: "cim-config-form-storage-title", label: t('ai:Storage sizes'), className: "cim-config-form-title", labelIcon: React.createElement(react_core_1.Popover, { bodyContent: t('ai:The storage sizes will be used to store different files and data for cluster creation.'), footerContent: React.createElement("a", { href: docConfigUrl, target: "_blank", rel: "noreferrer" }, React.createElement(react_i18next_1.Trans, { t: t }, "ai:Learn more about storage sizes. ", React.createElement(external_link_alt_icon_1.ExternalLinkAltIcon, null))) }, React.createElement("button", { type: "button", "aria-label": t('ai:More info for configure storage sizes'), "aria-describedby": "cim-config-form-storage-title", onClick: (e) => e.preventDefault(), className: "pf-v5-c-form__group-label-help" }, React.createElement(react_core_1.Icon, null, React.createElement(help_icon_1.HelpIcon, null)))) }, t('ai:If there are many clusters, use higher values for the storage fields.')), React.createElement(react_core_1.Flex, { justifyContent: { default: 'justifyContentSpaceBetween' } }, React.createElement(react_core_1.FlexItem, null, React.createElement(react_core_1.FormGroup, { label: t('ai:Database storage'), fieldId: "cim-config-form-storage-db", labelIcon: React.createElement(react_core_1.Popover, { bodyContent: t('ai:Specify how much storage is allocated for storing files such as database tables and database views for the clusters. Recommended is 10Gi or more. The value can not be updated later.') }, React.createElement("button", { type: "button", "aria-label": t('ai:More info for database storage'), "aria-describedby": "cim-config-form-storage-db", onClick: (e) => e.preventDefault(), className: "pf-v5-c-form__group-label-help" }, React.createElement(react_core_1.Icon, null, React.createElement(help_icon_1.HelpIcon, null)))), isRequired: true }, React.createElement("span", { className: "cim-config-form-volume" }, React.createElement(react_core_1.TextInput, { validated: dbVolSizeValidation ? 'error' : 'default', isRequired: true, isDisabled: isEdit /* Not supported by backend */, type: "number", id: "cim-config-form-storage-db", name: "cim-config-form-storage-db", value: dbVolSize, onChange: (_event, v) => setDbVolSize(getNumber(v, 1)), min: 0 /* Do the validation elsewhere */ }), ' ', "Gi"), dbVolSizeValidation !== undefined && (React.createElement(react_core_1.FormHelperText, null, React.createElement(react_core_1.HelperText, null, React.createElement(react_core_1.HelperTextItem, { icon: React.createElement(exclamation_circle_icon_1.ExclamationCircleIcon, null), variant: "error" }, dbVolSizeValidation)))))), React.createElement(react_core_1.FlexItem, null, React.createElement(react_core_1.FormGroup, { label: t('ai:System storage'), fieldId: "cim-config-form-storage-sys", labelIcon: React.createElement(react_core_1.Popover, { bodyContent: t('ai:Specify how much storage is allocated for storing logs, manifests and "kubeconfig" files for the clusters. Recommended is 100Gi or more. The value can not be updated later.') }, React.createElement("button", { type: "button", "aria-label": t('ai:More info for system storage'), "aria-describedby": "cim-config-form-storage-sys", onClick: (e) => e.preventDefault(), className: "pf-v5-c-form__group-label-help" }, React.createElement(react_core_1.Icon, null, React.createElement(help_icon_1.HelpIcon, null)))), isRequired: true }, React.createElement("span", { className: "cim-config-form-volume" }, React.createElement(react_core_1.TextInput, { validated: fsVolSizeValidation ? 'error' : 'default', isRequired: true, isDisabled: isEdit /* Not supported by backend */, type: "number", id: "cim-config-form-storage-sys", name: "cim-config-form-storage-sys", value: fsVolSize, onChange: (_event, v) => setFsVolSize(getNumber(v, 1)), min: 0 }), ' ', "Gi"), fsVolSizeValidation !== undefined && (React.createElement(react_core_1.FormHelperText, null, React.createElement(react_core_1.HelperText, null, React.createElement(react_core_1.HelperTextItem, { icon: React.createElement(exclamation_circle_icon_1.ExclamationCircleIcon, null), variant: "error" }, fsVolSizeValidation)))))), React.createElement(react_core_1.FlexItem, null, React.createElement(react_core_1.FormGroup, { label: t('ai:Image storage'), fieldId: "cim-config-form-storage-img", labelIcon: React.createElement(react_core_1.Popover, { bodyContent: t('ai:Specify how much storage to allocate for the images of the clusters. There must be 1G of image storage for each instance of Red Hat Enterprise Linux CoreOS that is running. Recommended is 50Gi or more. The value can not be updated later.') }, React.createElement("button", { type: "button", "aria-label": t('ai:More info for image storage'), "aria-describedby": "cim-config-form-storage-img", onClick: (e) => e.preventDefault(), className: "pf-v5-c-form__group-label-help" }, React.createElement(react_core_1.Icon, null, React.createElement(help_icon_1.HelpIcon, null)))), isRequired: true }, React.createElement("span", { className: "cim-config-form-volume" }, React.createElement(react_core_1.TextInput, { validated: imgVolSizeValidation ? 'error' : 'default', isRequired: true, isDisabled: isEdit /* Not supported by backend */, type: "number", id: "cim-config-form-storage-img", name: "cim-config-form-storage-img", value: imgVolSize, onChange: (_event, v) => setImgVolSize(getNumber(v, 10)), min: 0 }), ' ', "Gi"), imgVolSizeValidation !== undefined && (React.createElement(react_core_1.FormHelperText, null, React.createElement(react_core_1.HelperText, null, React.createElement(react_core_1.HelperTextItem, { icon: React.createElement(exclamation_circle_icon_1.ExclamationCircleIcon, null), variant: "error" }, imgVolSizeValidation))))))), React.createElement(react_core_1.Checkbox, { label: React.createElement("span", { className: "cim-config-form-aws-label" }, t('ai:Configure load balancer on Amazon Web Services for me.'), "\u00A0", awsHelp), id: "cim-config-form-aws", className: "cim-config-form-aws", // isRequired name: "aws-loadbalancer-checkbox", isChecked: configureLoadBalancer, isDisabled: isInProgressPeriod || (isEdit && configureLoadBalancerInitial) /* For edit flow, only No to Yes transition is possible */, onChange: (_event, value) => setConfigureLoadBalancer(value) }))); }; exports.CimConfigurationForm = CimConfigurationForm; //# sourceMappingURL=CimConfigurationForm.js.map