Turn XML routes into tabs
This commit is contained in:
@ -14,6 +14,7 @@ import { ResAutostartInput } from "../forms/ResAutostartInput";
|
||||
import { SelectInput } from "../forms/SelectInput";
|
||||
import { TextInput } from "../forms/TextInput";
|
||||
import { DHCPHostReservations } from "./DHCPHostReservations";
|
||||
import { XMLAsyncWidget } from "../XMLWidget";
|
||||
|
||||
interface DetailsProps {
|
||||
net: NetworkInfo;
|
||||
@ -42,6 +43,7 @@ enum NetTab {
|
||||
General = 0,
|
||||
IPv4,
|
||||
IPv6,
|
||||
XML,
|
||||
Danger,
|
||||
}
|
||||
|
||||
@ -67,6 +69,11 @@ function NetworkDetailsInner(p: DetailsInnerProps): React.ReactElement {
|
||||
value: NetTab.IPv6,
|
||||
visible: p.editable || !!p.net.ip_v6,
|
||||
},
|
||||
{
|
||||
label: "XML",
|
||||
value: NetTab.XML,
|
||||
visible: !p.editable,
|
||||
},
|
||||
{
|
||||
label: "Danger zone",
|
||||
value: NetTab.Danger,
|
||||
@ -79,6 +86,7 @@ function NetworkDetailsInner(p: DetailsInnerProps): React.ReactElement {
|
||||
{currTab === NetTab.General && <NetworkDetailsTabGeneral {...p} />}
|
||||
{currTab === NetTab.IPv4 && <NetworkDetailsTabIPv4 {...p} />}
|
||||
{currTab === NetTab.IPv6 && <NetworkDetailsTabIPv6 {...p} />}
|
||||
{currTab === NetTab.XML && <NetworkDetailsTabXML {...p} />}
|
||||
{currTab === NetTab.Danger && <NetworkDetailsTabDanger {...p} />}
|
||||
</>
|
||||
);
|
||||
@ -380,6 +388,16 @@ function IPSection(p: {
|
||||
);
|
||||
}
|
||||
|
||||
function NetworkDetailsTabXML(p: DetailsInnerProps): React.ReactElement {
|
||||
return (
|
||||
<XMLAsyncWidget
|
||||
errMsg="Failed to load network XML definition!"
|
||||
identifier={p.net.uuid!}
|
||||
load={() => NetworkApi.GetSingleXML(p.net.uuid!)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function NetworkDetailsTabDanger(p: DetailsInnerProps): React.ReactElement {
|
||||
const confirm = useConfirm();
|
||||
const snackbar = useSnackbar();
|
||||
|
Reference in New Issue
Block a user