Normalize disk size input
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-06-09 18:11:49 +02:00
parent d4bc92f562
commit 0de15af10e
2 changed files with 5 additions and 2 deletions

View File

@ -2,13 +2,14 @@ import { ServerApi } from "../../api/ServerApi";
import { TextInput } from "./TextInput";
export function DiskSizeInput(p: {
editable: boolean;
label?: string;
value: number;
onChange: (size: number) => void;
onChange?: (size: number) => void;
}): React.ReactElement {
return (
<TextInput
editable={true}
editable={p.editable}
label={p.label ?? "Disk size (GB)"}
size={{
min: ServerApi.Config.constraints.disk_size.min / (1000 * 1000 * 1000),

View File

@ -195,6 +195,7 @@ function DiskInfo(p: {
{/* New disk size*/}
{p.disk.resize && !p.disk.deleteType && (
<DiskSizeInput
editable
label="New disk size (GB)"
value={p.disk.size}
onChange={(v) => {
@ -281,6 +282,7 @@ function DiskInfo(p: {
{/* Disk size */}
{(!p.disk.from_image || p.disk.resize === true) && (
<DiskSizeInput
editable
value={p.disk.size}
onChange={(v) => {
p.disk.size = v;