Skip to content

Commit

Permalink
fix(instance) remove read and write limits for custom storage volumes (
Browse files Browse the repository at this point in the history
  • Loading branch information
edlerd authored Oct 22, 2024
2 parents 9551af3 + 4a72af1 commit f056bda
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 117 deletions.
82 changes: 0 additions & 82 deletions src/components/forms/DiskDeviceFormCustom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,88 +191,6 @@ const DiskDeviceFormCustom: FC<Props> = ({ formik, project, profiles }) => {
}),
);
}

rows.push(
getConfigurationRowBase({
className: "no-border-top inherited-with-form",
configuration: (
<Label forId={`devices.${index}.limits.read`}>Read limit</Label>
),
inherited: readOnly ? (
<div className="custom-disk-read-mode">
<div className="mono-font custom-disk-value">
<b>
{formVolume.limits?.read
? `${formVolume.limits.read} IOPS`
: "none"}
</b>
</div>
{editButton(`devices.${index}.limits.read`)}
</div>
) : (
<div className="custom-disk-device-limits">
<Input
id={`devices.${index}.limits.read`}
name={`devices.${index}.limits.read`}
onBlur={formik.handleBlur}
onChange={(e) => {
void formik.setFieldValue(
`devices.${index}.limits.read`,
e.target.value,
);
}}
value={formVolume.limits?.read}
type="number"
placeholder="Enter number"
className="u-no-margin--bottom"
/>
<div>IOPS</div>
</div>
),
override: "",
}),
);

rows.push(
getConfigurationRowBase({
className: "no-border-top inherited-with-form",
configuration: (
<Label forId={`devices.${index}.limits.write`}>Write limit</Label>
),
inherited: readOnly ? (
<div className="custom-disk-read-mode">
<div className="mono-font custom-disk-value">
<b>
{formVolume.limits?.write
? `${formVolume.limits.write} IOPS`
: "none"}
</b>
</div>
{editButton(`devices.${index}.limits.write`)}
</div>
) : (
<div className="custom-disk-device-limits">
<Input
id={`devices.${index}.limits.write`}
name={`devices.${index}.limits.write`}
onBlur={formik.handleBlur}
onChange={(e) => {
void formik.setFieldValue(
`devices.${index}.limits.write`,
e.target.value,
);
}}
value={formVolume.limits?.write}
type="number"
placeholder="Enter number"
className="u-no-margin--bottom"
/>
<div>IOPS</div>
</div>
),
override: "",
}),
);
});

return (
Expand Down
22 changes: 0 additions & 22 deletions src/components/forms/DiskDeviceFormInherited.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,28 +92,6 @@ const DiskDeviceFormInherited: FC<Props> = ({ formik, inheritedVolumes }) => {
isDeactivated: isNoneDevice,
}),
);

rows.push(
getInheritedDeviceRow({
label: "Read limit",
inheritValue: item.disk["limits.read"]
? `${item.disk["limits.read"]} IOPS`
: "none",
readOnly: readOnly,
isDeactivated: isNoneDevice,
}),
);

rows.push(
getInheritedDeviceRow({
label: "Write limit",
inheritValue: item.disk["limits.write"]
? `${item.disk["limits.write"]} IOPS`
: "none",
readOnly: readOnly,
isDeactivated: isNoneDevice,
}),
);
});

return inheritedVolumes.length > 0 ? (
Expand Down
13 changes: 0 additions & 13 deletions src/util/formDevices.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,6 @@ export const formDeviceToPayload = (devices: FormDevice[]) => {
[name]: item.bare,
};
}
if ("limits" in item) {
if (item.limits?.read) {
item["limits.read"] = item.limits.read;
}
if (item.limits?.write) {
item["limits.write"] = item.limits.write;
}
delete item.limits;
}
if (item.type === "disk") {
const { bare, ...rest } = item;
item = { ...bare, ...rest };
Expand Down Expand Up @@ -148,10 +139,6 @@ export const parseDevices = (devices: LxdDevices): FormDevice[] => {
pool: item.pool,
source: "source" in item ? item.source : undefined,
size: "size" in item ? item.size : undefined,
limits: {
read: "limits.read" in item ? item["limits.read"] : undefined,
write: "limits.write" in item ? item["limits.write"] : undefined,
},
type: "disk",
bare: item,
};
Expand Down

0 comments on commit f056bda

Please sign in to comment.