This commit is contained in:
@ -19,7 +19,7 @@ export function AsyncWidget(p: {
|
||||
}): React.ReactElement {
|
||||
const [state, setState] = useState(State.Loading);
|
||||
|
||||
const counter = useRef<any | null>(null);
|
||||
const counter = useRef<any>(null);
|
||||
|
||||
const load = async () => {
|
||||
try {
|
||||
|
@ -31,9 +31,11 @@ export function ConfigImportExportButtons(p: {
|
||||
fileEl.click();
|
||||
|
||||
// Wait for a file to be chosen
|
||||
await new Promise((res, _rej) =>
|
||||
{ fileEl.addEventListener("change", () => { res(null); }); }
|
||||
);
|
||||
await new Promise((res) => {
|
||||
fileEl.addEventListener("change", () => {
|
||||
res(null);
|
||||
});
|
||||
});
|
||||
|
||||
if ((fileEl.files?.length ?? 0) === 0) return null;
|
||||
|
||||
|
@ -23,7 +23,7 @@ export function StateActionButton<S>(p: {
|
||||
p.onExecuted();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert("Failed to perform action! " + e);
|
||||
alert(`Failed to perform action! ${e}`);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-disable react-x/no-array-index-key */
|
||||
import { Box, Tab, Tabs } from "@mui/material";
|
||||
|
||||
export interface TabWidgetOption<E> {
|
||||
@ -24,7 +25,9 @@ export function TabsWidget<E>(p: {
|
||||
<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
|
||||
<Tabs
|
||||
value={currTabIndex}
|
||||
onChange={(_ev, newVal) => { updateActiveTab(newVal); }}
|
||||
onChange={(_ev, newVal) => {
|
||||
updateActiveTab(newVal);
|
||||
}}
|
||||
>
|
||||
{activeOptions.map((o, index) => (
|
||||
<Tab key={index} label={o.label} style={{ color: o.color }} />
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
|
||||
import { Paper, Typography } from "@mui/material";
|
||||
import React, { PropsWithChildren } from "react";
|
||||
import Grid from "@mui/material/Grid";
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
||||
import React from "react";
|
||||
import { TextInput } from "./TextInput";
|
||||
|
||||
@ -32,7 +33,7 @@ export function IPInputWithMask(p: {
|
||||
|
||||
const currValue =
|
||||
p.ipAndMask ??
|
||||
(p.ip ?? "") + (p.mask || showSlash.current ? "/" : "") + (p.mask ?? "");
|
||||
`${p.ip ?? ""}${p.mask || showSlash.current ? "/" : ""}${p.mask ?? ""}`;
|
||||
|
||||
const { onValueChange, ...props } = p;
|
||||
return (
|
||||
|
@ -1,3 +1,5 @@
|
||||
/* eslint-disable react-x/no-array-index-key */
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
import React from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { NWFilter, NWFilterURL } from "../../api/NWFilterApi";
|
||||
|
@ -25,9 +25,7 @@ export function NWFilterSelectInput(p: {
|
||||
value={selectedValue}
|
||||
onDelete={p.editable ? () => p.onChange?.(undefined) : undefined}
|
||||
onClick={
|
||||
!p.editable && selectedValue
|
||||
? () => navigate(NWFilterURL(selectedValue))
|
||||
: undefined
|
||||
!p.editable ? () => navigate(NWFilterURL(selectedValue)) : undefined
|
||||
}
|
||||
/>
|
||||
);
|
||||
@ -48,7 +46,7 @@ export function NWFilterSelectInput(p: {
|
||||
renderInput={(params) => (
|
||||
<TextField {...params} variant="standard" label={p.label} />
|
||||
)}
|
||||
renderOption={(_props, option, _state) => (
|
||||
renderOption={(_props, option) => (
|
||||
<NWFilterItem
|
||||
dense
|
||||
onClick={() => {
|
||||
|
@ -24,10 +24,13 @@ export function RadioGroupInput(p: {
|
||||
<RadioGroup
|
||||
row
|
||||
value={p.value}
|
||||
onChange={(_ev, v) => { p.onValueChange(v); }}
|
||||
onChange={(_ev, v) => {
|
||||
p.onValueChange(v);
|
||||
}}
|
||||
>
|
||||
{p.options.map((o) => (
|
||||
<FormControlLabel
|
||||
key={o.value}
|
||||
disabled={!p.editable}
|
||||
value={o.value}
|
||||
control={<Radio />}
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-disable react-x/no-array-index-key */
|
||||
import { mdiNetworkOutline } from "@mdi/js";
|
||||
import Icon from "@mdi/react";
|
||||
import DeleteIcon from "@mui/icons-material/Delete";
|
||||
@ -51,7 +52,6 @@ export function VMNetworksList(p: {
|
||||
{p.vm.networks.map((n, num) => (
|
||||
<EditSection key={num}>
|
||||
<NetworkInfoWidget
|
||||
key={num}
|
||||
network={n}
|
||||
removeFromList={() => {
|
||||
p.vm.networks.splice(num, 1);
|
||||
|
Reference in New Issue
Block a user