Improve code quality

This commit is contained in:
Pierre HUBERT 2024-01-03 19:23:35 +01:00
parent c880c5e6bb
commit 85dcb06014
3 changed files with 6 additions and 8 deletions

View File

@ -24,7 +24,6 @@ import {
import { AsyncWidget } from "../widgets/AsyncWidget";
import { RouterLink } from "../widgets/RouterLink";
import { VirtWebRouteContainer } from "../widgets/VirtWebRouteContainer";
import { ServerApi } from "../api/ServerApi";
export function NetworkFiltersListRoute(): React.ReactElement {
const [list, setList] = React.useState<NWFilter[] | undefined>();

View File

@ -4,7 +4,6 @@ import {
mdiHome,
mdiInformation,
mdiLan,
mdiSecurity,
mdiSecurityNetwork,
} from "@mdi/js";
import Icon from "@mdi/react";
@ -17,9 +16,9 @@ import {
ListItemText,
} from "@mui/material";
import { Outlet, useLocation } from "react-router-dom";
import { isDebug } from "../utils/DebugUtils";
import { RouterLink } from "./RouterLink";
import { VirtWebAppBar } from "./VirtWebAppBar";
import { isDebug } from "../utils/DebugUtils";
export function BaseAuthenticatedPage(): React.ReactElement {
return (

View File

@ -23,10 +23,10 @@ interface DetailsProps {
}
export function NetworkDetails(p: DetailsProps): React.ReactElement {
const [cardsList, setCardsList] = React.useState<string[] | any>();
const [nicsList, setNicsList] = React.useState<string[] | any>();
const load = async () => {
setCardsList(await ServerApi.GetNetworksList());
setNicsList(await ServerApi.GetNetworksList());
};
return (
@ -34,7 +34,7 @@ export function NetworkDetails(p: DetailsProps): React.ReactElement {
loadKey={"1"}
load={load}
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,
}
type DetailsInnerProps = DetailsProps & { cardsList: string[] };
type DetailsInnerProps = DetailsProps & { nicsList: string[] };
function NetworkDetailsInner(p: DetailsInnerProps): React.ReactElement {
const [currTab, setCurrTab] = React.useState(NetTab.General);
@ -176,7 +176,7 @@ function NetworkDetailsTabGeneral(p: DetailsInnerProps): React.ReactElement {
value={p.net.device}
options={[
{ label: "Default interface", value: undefined },
...p.cardsList.map((d) => {
...p.nicsList.map((d) => {
return { label: d, value: d };
}),
]}