@devtron-labs/devtron-fe-common-lib 0.0.58-beta-7 → 0.0.58-beta-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Pages/GlobalConfigurations/BuildInfra/types.d.ts +0 -1
- package/dist/index.js +5 -7
- package/package.json +1 -1
- package/src/Pages/GlobalConfigurations/BuildInfra/BuildInfraFormAction.tsx +8 -6
- package/src/Pages/GlobalConfigurations/BuildInfra/services.tsx +0 -1
- package/src/Pages/GlobalConfigurations/BuildInfra/types.tsx +0 -1
package/dist/index.js
CHANGED
|
@@ -29125,7 +29125,6 @@ var getBuildInfraProfilePayload = function (profileInput) {
|
|
|
29125
29125
|
}, []);
|
|
29126
29126
|
var payload = {
|
|
29127
29127
|
name: profileInput.name,
|
|
29128
|
-
id: profileInput.id,
|
|
29129
29128
|
description: profileInput.description,
|
|
29130
29129
|
type: profileInput.type,
|
|
29131
29130
|
configurations: configurations,
|
|
@@ -29614,17 +29613,16 @@ var BuildInfraFormAction = function (_a) {
|
|
|
29614
29613
|
};
|
|
29615
29614
|
handleProfileInputChange({ action: actionType, data: data });
|
|
29616
29615
|
};
|
|
29617
|
-
|
|
29618
|
-
var _b = React.useMemo(function () {
|
|
29616
|
+
var unitOptions = React.useMemo(function () {
|
|
29619
29617
|
var _a, _b;
|
|
29620
29618
|
var units = (_b = (_a = Object.values(profileUnitsMap)) === null || _a === void 0 ? void 0 : _a.map(function (unit) { return ({
|
|
29621
29619
|
label: unit.name,
|
|
29622
29620
|
value: String(unit.conversionFactor),
|
|
29623
29621
|
}); })) !== null && _b !== void 0 ? _b : [];
|
|
29624
|
-
|
|
29625
|
-
|
|
29626
|
-
|
|
29627
|
-
return (jsxRuntime.jsxs("div", __assign({ className: "flexbox-col dc__gap-4 dc__mxw-420 w-100 dc__align-start" }, { children: [jsxRuntime.jsx("label", __assign({ htmlFor: "".concat(actionType, "-input"), className: "fs-13 fw-4 lh-20 cn-7 ".concat(isRequired ? 'dc__required-field' : '') }, { children: label })), jsxRuntime.jsxs("div", __assign({ className: "w-100 flexbox dc__align-items-center" }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex-grow-1" }, { children: jsxRuntime.jsx("input", { "data-testid": actionType, name: actionType, type: "number", step: BUILD_INFRA_INPUT_CONSTRAINTS.STEP, min: BUILD_INFRA_INPUT_CONSTRAINTS.MIN, className: "form__input dc__no-right-border dc__no-right-radius", placeholder: placeholder, value: currentValue, onChange: handleInputChange, required: isRequired, autoComplete: "off", id: "".concat(actionType, "-input") }) })), profileUnitsMap && (jsxRuntime.jsx(ReactSelect, { name: "".concat(actionType, "-unit"), className: "bcn-0 dc__mxw-120", options: unitOptions, value: currentUnit, onChange: handleUnitChange, isSearchable: false, components: {
|
|
29622
|
+
return units.sort(function (a, b) { return Number(a.value) - Number(b.value); });
|
|
29623
|
+
}, [profileUnitsMap]);
|
|
29624
|
+
var currentUnit = React.useMemo(function () { return unitOptions.find(function (unit) { return unit.label === currentUnitName; }); }, [unitOptions, currentUnitName]);
|
|
29625
|
+
return (jsxRuntime.jsxs("div", __assign({ className: "flexbox-col dc__gap-4 dc__mxw-420 w-100 dc__align-start" }, { children: [jsxRuntime.jsx("label", __assign({ htmlFor: "".concat(actionType, "-input"), className: "fs-13 fw-4 lh-20 cn-7 ".concat(isRequired ? 'dc__required-field' : '') }, { children: label })), jsxRuntime.jsxs("div", __assign({ className: "w-100 flexbox dc__align-items-center" }, { children: [jsxRuntime.jsx("div", __assign({ className: "flex-grow-1" }, { children: jsxRuntime.jsx("input", { "data-testid": "".concat(actionType, "-input-field"), name: actionType, type: "number", step: BUILD_INFRA_INPUT_CONSTRAINTS.STEP, min: BUILD_INFRA_INPUT_CONSTRAINTS.MIN, className: "form__input dc__no-right-border dc__no-right-radius", placeholder: placeholder, value: currentValue, onChange: handleInputChange, required: isRequired, autoComplete: "off", id: "".concat(actionType, "-input") }) })), profileUnitsMap && (jsxRuntime.jsx(ReactSelect, { name: "".concat(actionType, "-unit"), className: "bcn-0 dc__mxw-120", options: unitOptions, value: currentUnit, onChange: handleUnitChange, isSearchable: false, components: {
|
|
29628
29626
|
IndicatorSeparator: null,
|
|
29629
29627
|
ClearIndicator: null,
|
|
29630
29628
|
}, styles: unitSelectorStyles() }))] })), error && (jsxRuntime.jsxs("div", __assign({ className: "form__error" }, { children: [jsxRuntime.jsx(SvgIcWarning, { className: "form__icon form__icon--error" }), error] })))] })));
|
package/package.json
CHANGED
|
@@ -36,18 +36,20 @@ const BuildInfraFormAction: FunctionComponent<BuildInfraFormActionProps> = ({
|
|
|
36
36
|
handleProfileInputChange({ action: actionType, data })
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
const { unitOptions, currentUnit } = useMemo(() => {
|
|
39
|
+
const unitOptions = useMemo(() => {
|
|
41
40
|
const units =
|
|
42
41
|
Object.values(profileUnitsMap)?.map((unit) => ({
|
|
43
42
|
label: unit.name,
|
|
44
43
|
value: String(unit.conversionFactor),
|
|
45
44
|
})) ?? []
|
|
46
|
-
|
|
47
|
-
const _currentUnit = units.find((unit) => unit.label === currentUnitName)
|
|
48
|
-
return { unitOptions: units.sort((a, b) => Number(a.value) - Number(b.value)), currentUnit: _currentUnit }
|
|
45
|
+
return units.sort((a, b) => Number(a.value) - Number(b.value))
|
|
49
46
|
}, [profileUnitsMap])
|
|
50
47
|
|
|
48
|
+
const currentUnit = useMemo(
|
|
49
|
+
() => unitOptions.find((unit) => unit.label === currentUnitName),
|
|
50
|
+
[unitOptions, currentUnitName],
|
|
51
|
+
)
|
|
52
|
+
|
|
51
53
|
return (
|
|
52
54
|
<div className="flexbox-col dc__gap-4 dc__mxw-420 w-100 dc__align-start">
|
|
53
55
|
<label
|
|
@@ -59,7 +61,7 @@ const BuildInfraFormAction: FunctionComponent<BuildInfraFormActionProps> = ({
|
|
|
59
61
|
<div className="w-100 flexbox dc__align-items-center">
|
|
60
62
|
<div className="flex-grow-1">
|
|
61
63
|
<input
|
|
62
|
-
data-testid={actionType}
|
|
64
|
+
data-testid={`${actionType}-input-field`}
|
|
63
65
|
name={actionType}
|
|
64
66
|
type="number"
|
|
65
67
|
step={BUILD_INFRA_INPUT_CONSTRAINTS.STEP}
|