UNPKG

@openshift-assisted/ui-lib

Version:

React component library for the Assisted Installer UI

32 lines 2.76 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const react_core_1 = require("@patternfly/react-core"); const React = tslib_1.__importStar(require("react")); const common_1 = require("../../../../common"); const use_translation_wrapper_1 = require("../../../../common/hooks/use-translation-wrapper"); const LabelsSelector_1 = require("../../ClusterDeployment/LabelsSelector"); const formik_1 = require("formik"); const NodePoolAgentsForm = ({ agents, labelName, countName, autoscalingName, maxAgents, useAutoscalingName, isEdit = false, }) => { const { t } = (0, use_translation_wrapper_1.useTranslation)(); const [{ value: minValue }] = (0, formik_1.useField)(`${autoscalingName}.minReplicas`); const [{ value: maxValue }] = (0, formik_1.useField)(`${autoscalingName}.maxReplicas`); const [{ value: useAutoscalingValue }] = (0, formik_1.useField)(useAutoscalingName); const helperText = (React.createElement(React.Fragment, null, t('ai:Maximum availability {{maxAgents}}', { maxAgents }), ' ', React.createElement(common_1.PopoverIcon, { bodyContent: t('ai:Maximum availability is based on the number of hosts available in a given namespace. The number changes dynamically depending on the filtering labels added above.') }))); return (React.createElement(react_core_1.Grid, { hasGutter: true }, !isEdit && (React.createElement(react_core_1.GridItem, null, React.createElement(LabelsSelector_1.LabelSelectorGroup, { agents: agents, name: labelName }))), React.createElement(react_core_1.GridItem, null, React.createElement(common_1.CheckboxField, { name: useAutoscalingName, label: t('ai:Use autoscaling') })), useAutoscalingValue ? (React.createElement(React.Fragment, null, React.createElement(react_core_1.GridItem, null, React.createElement(common_1.NumberInputField, { name: `${autoscalingName}.minReplicas`, label: t('ai:Minimum number of hosts'), isRequired: true, minValue: 1, maxValue: maxValue || maxAgents })), React.createElement(react_core_1.GridItem, null, React.createElement(common_1.NumberInputField, { name: `${autoscalingName}.maxReplicas`, label: t('ai:Maximum number of hosts'), isRequired: true, minValue: minValue || 1, maxValue: maxAgents, helperText: helperText })))) : (React.createElement(react_core_1.GridItem, null, React.createElement(common_1.NumberInputField, { label: t('ai:Number of hosts'), idPostfix: "count", name: countName, isRequired: true, minValue: 0, maxValue: maxAgents, helperText: helperText }))))); }; exports.default = NodePoolAgentsForm; //# sourceMappingURL=NodePoolAgentsForm.js.map