@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.
@@ -246,7 +246,6 @@ export interface CreateBuildInfraServiceConfigurationType {
246
246
  id?: number;
247
247
  }
248
248
  export interface CreateBuildInfraServicePayloadType {
249
- id: number;
250
249
  name: string;
251
250
  description: string;
252
251
  type: BuildInfraProfileVariants;
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
- // would also sort the units in order of conversionFactor
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
- var _currentUnit = units.find(function (unit) { return unit.label === currentUnitName; });
29625
- return { unitOptions: units.sort(function (a, b) { return Number(a.value) - Number(b.value); }), currentUnit: _currentUnit };
29626
- }, [profileUnitsMap]), unitOptions = _b.unitOptions, currentUnit = _b.currentUnit;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.58-beta-7",
3
+ "version": "0.0.58-beta-8",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -36,18 +36,20 @@ const BuildInfraFormAction: FunctionComponent<BuildInfraFormActionProps> = ({
36
36
  handleProfileInputChange({ action: actionType, data })
37
37
  }
38
38
 
39
- // would also sort the units in order of conversionFactor
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}
@@ -143,7 +143,6 @@ const getBuildInfraProfilePayload = (
143
143
 
144
144
  const payload: CreateBuildInfraServicePayloadType = {
145
145
  name: profileInput.name,
146
- id: profileInput.id,
147
146
  description: profileInput.description,
148
147
  type: profileInput.type,
149
148
  configurations,
@@ -292,7 +292,6 @@ export interface CreateBuildInfraServiceConfigurationType {
292
292
  }
293
293
 
294
294
  export interface CreateBuildInfraServicePayloadType {
295
- id: number
296
295
  name: string
297
296
  description: string
298
297
  type: BuildInfraProfileVariants