Can change network interface type
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2025-05-30 20:30:30 +02:00
parent ef0d77f1d6
commit 22416badcf
3 changed files with 47 additions and 1 deletions

View File

@ -60,6 +60,7 @@ export type VMNetInterface = (
export interface VMNetInterfaceBase {
mac: string;
model: "Virtio" | "E1000";
nwfilterref?: VMNetInterfaceFilter;
}

View File

@ -35,6 +35,7 @@ export function VMNetworksList(p: {
const addNew = () => {
p.vm.networks.push({
type: "UserspaceSLIRPStack",
model: "Virtio",
mac: randomMacAddress(ServerApi.Config.net_mac_prefix),
});
p.onChange?.();
@ -146,6 +147,7 @@ function NetworkInfoWidget(p: {
/>
</ListItem>
<div style={{ marginLeft: "70px" }}>
{/* MAC address input */}
<MACInput
editable={p.editable}
label="MAC Address"
@ -156,6 +158,26 @@ function NetworkInfoWidget(p: {
}}
/>
{/* NIC model */}
<SelectInput
editable={p.editable}
label="NIC Model"
value={p.network.model}
onValueChange={(v) => {
p.network.model = v as any;
p.onChange?.();
}}
options={[
{ label: "e1000", value: "E1000" },
{
label: "virtio",
value: "Virtio",
description:
"Recommended model, but will require specific drivers on OS that do not support it.",
},
]}
/>
{/* Defined network selection */}
{p.network.type === "DefinedNetwork" && (
<SelectInput