Migrate deprecated ant design APIs

Rename visible to open and use menu instead of overlay in Dropdown as
both of these have been removed in the next major version of Antd.
This commit is contained in:
Hornwitser committed 2023-07-27 13:42:35 +02:00
1 parent 2de029b96e
commit a1c9bc5f9b
12 files changed
+81 -85

No files matched your search

+6 -6
View File
@@ -17,7 +17,7 @@ const strcmp = new Intl.Collator(undefined, { numerice: "true", sensitivity: "ba
function GenerateHostTokenButton(props) {
let control = useContext(ControlContext);
let [visible, setVisible] = useState(false);
let [open, setOpen] = useState(false);
let [token, setToken] = useState(null);
let [hostId, setHostId] = useState(null);
let [form] = Form.useForm();
@@ -53,23 +53,23 @@ function GenerateHostTokenButton(props) {
// Generate a new random
useEffect(() => {
if (visible) {
if (open) {
generateToken().catch(notifyErrorHandler("Error generating token"));
}
}, [visible]);
}, [open]);
// Only install plugins that aren't filesystem paths. Npm modules have max 1 forward slash in their name.
const pluginString = pluginList.map(p => `"${p.requirePath}"`).filter(x => x.split("/") <= 1).join(" ");
return <>
<Button
onClick={() => { setVisible(true); }}
onClick={() => { setOpen(true); }}
>Generate Token</Button>
<Modal
title="Generate Host Token"
visible={visible}
open={open}
footer={null}
onCancel={() => {
setVisible(false);
setOpen(false);
setToken(null);
form.resetFields();
}}