mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 15:43:13 +09:00
Migrate to new <Menu> syntax
The use of <Menu.Item> children to <Menu> is deprecated, convert
existing code to use the new items={...} syntax.
This commit is contained in:
1 parent
3e836c1dd3
commit
c5a0c0a873
2 files changed
+54
-33
No files matched your search
@@ -92,7 +92,35 @@ export default function InstanceViewPage(props) {
|
||||
</PageLayout>;
|
||||
}
|
||||
|
||||
let instanceButtonMenuItems = [];
|
||||
if (account.hasPermission("core.instance.export_data")) {
|
||||
instanceButtonMenuItems.push({
|
||||
disabled: exportingData || instance.status !== "stopped",
|
||||
key: "export",
|
||||
label: "Export data",
|
||||
});
|
||||
}
|
||||
if (account.hasPermission("core.instance.kill")) {
|
||||
instanceButtonMenuItems.push({
|
||||
disabled: ["unknown", "unassigned", "stopped"].includes(instance["status"]),
|
||||
key: "kill",
|
||||
label: "Kill process",
|
||||
});
|
||||
}
|
||||
if (account.hasPermission("core.instance.delete")) {
|
||||
if (instanceButtonMenuItems.length) {
|
||||
instanceButtonMenuItems.push({ type: "divider" });
|
||||
}
|
||||
instanceButtonMenuItems.push({
|
||||
disabled: !["unknown", "unassigned", "stopped"].includes(instance["status"]),
|
||||
danger: true,
|
||||
key: "delete",
|
||||
icon: <DeleteOutlined />,
|
||||
label: "Delete",
|
||||
});
|
||||
}
|
||||
let instanceButtonsMenu = <Menu
|
||||
items={instanceButtonMenuItems}
|
||||
onClick={({ key }) => {
|
||||
if (key === "export") {
|
||||
setExportingData(true);
|
||||
@@ -125,25 +153,7 @@ export default function InstanceViewPage(props) {
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
{account.hasPermission("core.instance.export_data") && <Menu.Item
|
||||
disabled={exportingData || instance.status !== "stopped"}
|
||||
key="export"
|
||||
>Export data</Menu.Item>}
|
||||
{account.hasPermission("core.instance.kill") && <Menu.Item
|
||||
disabled={["unknown", "unassigned", "stopped"].includes(instance["status"])}
|
||||
key="kill"
|
||||
>Kill process</Menu.Item>}
|
||||
{account.hasPermission("core.instance.delete") && <>
|
||||
<Menu.Divider />
|
||||
<Menu.Item
|
||||
disabled={!["unknown", "unassigned", "stopped"].includes(instance["status"])}
|
||||
danger
|
||||
key="delete"
|
||||
icon={<DeleteOutlined />}
|
||||
>Delete</Menu.Item>
|
||||
</>}
|
||||
</Menu>;
|
||||
/>;
|
||||
let instanceButtons = <Space>
|
||||
{
|
||||
account.hasAnyPermission("core.instance.start", "core.instance.stop")
|
||||
|
||||
Reference in new issue
Block a user