@openshift-assisted/ui-lib
Version:
React component library for the Assisted Installer UI
34 lines • 3.42 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const react_core_1 = require("@patternfly/react-core");
const formik_1 = require("formik");
const ip_address_1 = require("ip-address");
const common_1 = require("../../../../../common");
const useTemptiflySync_1 = require("../../hooks/useTemptiflySync");
const use_translation_wrapper_1 = require("../../../../../common/hooks/use-translation-wrapper");
require("./NetworkForm.css");
const AdvancedNetworkFields_1 = tslib_1.__importDefault(require("../../../../../common/components/clusterConfiguration/AdvancedNetworkFields"));
const NetworkForm = ({ onValuesChanged }) => {
const { values } = (0, formik_1.useFormikContext)();
(0, useTemptiflySync_1.useTemptiflySync)({ values, onValuesChanged });
const isClusterCIDRIPv6 = ip_address_1.Address6.isValid(values.clusterNetworkCidr || '');
const { t } = (0, use_translation_wrapper_1.useTranslation)();
return (React.createElement(react_core_1.Form, null,
React.createElement(react_core_1.FormGroup, { label: t('ai:API server publishing strategy') },
React.createElement(react_core_1.Grid, { hasGutter: true },
React.createElement(react_core_1.GridItem, null,
React.createElement(common_1.RadioField, { name: "apiPublishingStrategy", label: "LoadBalancer", value: "LoadBalancer", description: t(`ai:Exposes the service externally using a cloud provider's load balancer`) })),
React.createElement(react_core_1.GridItem, null,
React.createElement(common_1.RadioField, { name: "apiPublishingStrategy", label: "NodePort", value: "NodePort", className: "ai-nodeport-fields", description: t(`ai:Exposes the service on each node's IP at a static port`), body: values.apiPublishingStrategy === 'NodePort' && (React.createElement(react_core_1.Grid, { hasGutter: true },
React.createElement(react_core_1.GridItem, null,
React.createElement(common_1.InputField, { isRequired: true, name: "nodePortAddress", label: t('ai:Host address'), labelIcon: React.createElement(common_1.PopoverIcon, { position: "right", bodyContent: t('ai:Address is the host/ip that the NodePort service is exposed over.') }) })),
React.createElement(react_core_1.GridItem, null,
React.createElement(common_1.NumberInputField, { label: t('ai:Host port'), idPostfix: "nodePortPort", name: "nodePortPort", minValue: 0, maxValue: 65535, labelIcon: React.createElement(common_1.PopoverIcon, { position: "right", bodyContent: t('ai:Port of the NodePort service. If set to 0, the port is dynamically assigned when the service is created.') }) })))) })))),
React.createElement(common_1.CheckboxField, { name: "isAdvanced", label: t('ai:Use advanced networking'), className: "ai-advanced-fields", body: values.isAdvanced && React.createElement(AdvancedNetworkFields_1.default, { isClusterCIDRIPv6: isClusterCIDRIPv6 }), helperText: t('ai:Configure advanced networking properties (e.g. CIDR ranges).') }),
React.createElement(common_1.ProxyFields, null),
React.createElement(common_1.UploadSSH, { isRequired: true })));
};
exports.default = NetworkForm;
//# sourceMappingURL=NetworkForm.js.map