Improve code quality
This commit is contained in:
parent
c880c5e6bb
commit
85dcb06014
@ -24,7 +24,6 @@ import {
|
|||||||
import { AsyncWidget } from "../widgets/AsyncWidget";
|
import { AsyncWidget } from "../widgets/AsyncWidget";
|
||||||
import { RouterLink } from "../widgets/RouterLink";
|
import { RouterLink } from "../widgets/RouterLink";
|
||||||
import { VirtWebRouteContainer } from "../widgets/VirtWebRouteContainer";
|
import { VirtWebRouteContainer } from "../widgets/VirtWebRouteContainer";
|
||||||
import { ServerApi } from "../api/ServerApi";
|
|
||||||
|
|
||||||
export function NetworkFiltersListRoute(): React.ReactElement {
|
export function NetworkFiltersListRoute(): React.ReactElement {
|
||||||
const [list, setList] = React.useState<NWFilter[] | undefined>();
|
const [list, setList] = React.useState<NWFilter[] | undefined>();
|
||||||
|
@ -4,7 +4,6 @@ import {
|
|||||||
mdiHome,
|
mdiHome,
|
||||||
mdiInformation,
|
mdiInformation,
|
||||||
mdiLan,
|
mdiLan,
|
||||||
mdiSecurity,
|
|
||||||
mdiSecurityNetwork,
|
mdiSecurityNetwork,
|
||||||
} from "@mdi/js";
|
} from "@mdi/js";
|
||||||
import Icon from "@mdi/react";
|
import Icon from "@mdi/react";
|
||||||
@ -17,9 +16,9 @@ import {
|
|||||||
ListItemText,
|
ListItemText,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { Outlet, useLocation } from "react-router-dom";
|
import { Outlet, useLocation } from "react-router-dom";
|
||||||
|
import { isDebug } from "../utils/DebugUtils";
|
||||||
import { RouterLink } from "./RouterLink";
|
import { RouterLink } from "./RouterLink";
|
||||||
import { VirtWebAppBar } from "./VirtWebAppBar";
|
import { VirtWebAppBar } from "./VirtWebAppBar";
|
||||||
import { isDebug } from "../utils/DebugUtils";
|
|
||||||
|
|
||||||
export function BaseAuthenticatedPage(): React.ReactElement {
|
export function BaseAuthenticatedPage(): React.ReactElement {
|
||||||
return (
|
return (
|
||||||
|
@ -23,10 +23,10 @@ interface DetailsProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function NetworkDetails(p: DetailsProps): React.ReactElement {
|
export function NetworkDetails(p: DetailsProps): React.ReactElement {
|
||||||
const [cardsList, setCardsList] = React.useState<string[] | any>();
|
const [nicsList, setNicsList] = React.useState<string[] | any>();
|
||||||
|
|
||||||
const load = async () => {
|
const load = async () => {
|
||||||
setCardsList(await ServerApi.GetNetworksList());
|
setNicsList(await ServerApi.GetNetworksList());
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -34,7 +34,7 @@ export function NetworkDetails(p: DetailsProps): React.ReactElement {
|
|||||||
loadKey={"1"}
|
loadKey={"1"}
|
||||||
load={load}
|
load={load}
|
||||||
errMsg="Failed to load the list of host network cards!"
|
errMsg="Failed to load the list of host network cards!"
|
||||||
build={() => <NetworkDetailsInner cardsList={cardsList} {...p} />}
|
build={() => <NetworkDetailsInner nicsList={nicsList} {...p} />}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ enum NetTab {
|
|||||||
Danger,
|
Danger,
|
||||||
}
|
}
|
||||||
|
|
||||||
type DetailsInnerProps = DetailsProps & { cardsList: string[] };
|
type DetailsInnerProps = DetailsProps & { nicsList: string[] };
|
||||||
|
|
||||||
function NetworkDetailsInner(p: DetailsInnerProps): React.ReactElement {
|
function NetworkDetailsInner(p: DetailsInnerProps): React.ReactElement {
|
||||||
const [currTab, setCurrTab] = React.useState(NetTab.General);
|
const [currTab, setCurrTab] = React.useState(NetTab.General);
|
||||||
@ -176,7 +176,7 @@ function NetworkDetailsTabGeneral(p: DetailsInnerProps): React.ReactElement {
|
|||||||
value={p.net.device}
|
value={p.net.device}
|
||||||
options={[
|
options={[
|
||||||
{ label: "Default interface", value: undefined },
|
{ label: "Default interface", value: undefined },
|
||||||
...p.cardsList.map((d) => {
|
...p.nicsList.map((d) => {
|
||||||
return { label: d, value: d };
|
return { label: d, value: d };
|
||||||
}),
|
}),
|
||||||
]}
|
]}
|
||||||
|
Loading…
Reference in New Issue
Block a user