mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +09:00
Fix antd deprecation and TreeSelect duplicate-value warnings (#940)
Rename the deprecated Modal `destroyOnClose` prop to `destroyOnHidden` (antd 5.25+) across the web UI. Skip a version-tree child equal to its major.minor group key in InputVersion, which triggered "Same value exist in the tree" warnings when the version list contained bare major.minor entries (the ApiVersions fallback shown before the version fetch resolves). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e16603bbd0
commit
a56fcbd785
10 files changed
+14
-11
No files matched your search
@@ -67,7 +67,7 @@ export default function AssignInstanceModal(props: AssignInstanceModalProps) {
|
|||||||
confirmLoading={applying}
|
confirmLoading={applying}
|
||||||
onOk={handleAssign}
|
onOk={handleAssign}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
destroyOnClose
|
destroyOnHidden
|
||||||
>
|
>
|
||||||
<Paragraph style={{ maxWidth: "30em" }}>
|
<Paragraph style={{ maxWidth: "30em" }}>
|
||||||
Select a Host to assign this instance to. Assignment
|
Select a Host to assign this instance to. Assignment
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ export default function CreateSaveModal(props: CreateSaveModalProps) {
|
|||||||
confirmLoading={creatingSave}
|
confirmLoading={creatingSave}
|
||||||
onOk={createSave}
|
onOk={createSave}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
destroyOnClose
|
destroyOnHidden
|
||||||
>
|
>
|
||||||
<Form form={form} layout="vertical">
|
<Form form={form} layout="vertical">
|
||||||
<Form.Item name="saveName" label="Save Name">
|
<Form.Item name="saveName" label="Save Name">
|
||||||
|
|||||||
@@ -74,7 +74,10 @@ function InputVersion<
|
|||||||
title: majorMinor,
|
title: majorMinor,
|
||||||
value: majorMinor,
|
value: majorMinor,
|
||||||
key: majorMinor,
|
key: majorMinor,
|
||||||
children: patchVersions.map((v) => ({
|
// Skip a patch equal to the group key (a bare major.minor version,
|
||||||
|
// e.g. the ApiVersions fallback): the selectable group node already
|
||||||
|
// represents it, and a duplicate value warns in the TreeSelect.
|
||||||
|
children: patchVersions.filter((v) => v !== majorMinor).map((v) => ({
|
||||||
title: v,
|
title: v,
|
||||||
value: v,
|
value: v,
|
||||||
key: v,
|
key: v,
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ function CreateInstanceButton(props: { instances: ReturnType<typeof useInstances
|
|||||||
open={open}
|
open={open}
|
||||||
onOk={() => { createInstance().catch(notifyErrorHandler("Error creating instance")); }}
|
onOk={() => { createInstance().catch(notifyErrorHandler("Error creating instance")); }}
|
||||||
onCancel={() => { setOpen(false); }}
|
onCancel={() => { setOpen(false); }}
|
||||||
destroyOnClose
|
destroyOnHidden
|
||||||
>
|
>
|
||||||
<Form form={form}>
|
<Form form={form}>
|
||||||
<Form.Item name="instanceName" label="Name">
|
<Form.Item name="instanceName" label="Name">
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ export default function LoadScenarioModal(props: LoadScenarioModalProps) {
|
|||||||
confirmLoading={loadingScenario}
|
confirmLoading={loadingScenario}
|
||||||
onOk={loadScenario}
|
onOk={loadScenario}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
destroyOnClose
|
destroyOnHidden
|
||||||
>
|
>
|
||||||
<Form form={form} layout="vertical">
|
<Form form={form} layout="vertical">
|
||||||
<Form.Item name="scenario" label="Scenario">
|
<Form.Item name="scenario" label="Scenario">
|
||||||
|
|||||||
@@ -1052,7 +1052,7 @@ function ExportButton(props: { modPack: lib.ModPack }) {
|
|||||||
open={open}
|
open={open}
|
||||||
onOk={close}
|
onOk={close}
|
||||||
onCancel={close}
|
onCancel={close}
|
||||||
destroyOnClose
|
destroyOnHidden
|
||||||
footer={<Space>
|
footer={<Space>
|
||||||
<CopyButton content={exportString} />
|
<CopyButton content={exportString} />
|
||||||
<Button onClick={close}>Close</Button>
|
<Button onClick={close}>Close</Button>
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ export function NpmButton(props: {
|
|||||||
okButtonProps={{disabled: formAction === undefined}}
|
okButtonProps={{disabled: formAction === undefined}}
|
||||||
onOk={() => { onOk().catch(notifyErrorHandler(`Error running ${formAction}`)); }}
|
onOk={() => { onOk().catch(notifyErrorHandler(`Error running ${formAction}`)); }}
|
||||||
onCancel={() => { setOpen(false); }}
|
onCancel={() => { setOpen(false); }}
|
||||||
destroyOnClose
|
destroyOnHidden
|
||||||
>
|
>
|
||||||
<Form form={form} onValuesChange={onValuesChange} clearOnDestroy>
|
<Form form={form} onValuesChange={onValuesChange} clearOnDestroy>
|
||||||
<Form.Item label="Action" name="action">
|
<Form.Item label="Action" name="action">
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function CreateRoleButton() {
|
|||||||
open={open}
|
open={open}
|
||||||
onOk={() => { createRole().catch(notifyErrorHandler("Error creating role")); }}
|
onOk={() => { createRole().catch(notifyErrorHandler("Error creating role")); }}
|
||||||
onCancel={() => { setOpen(false); }}
|
onCancel={() => { setOpen(false); }}
|
||||||
destroyOnClose
|
destroyOnHidden
|
||||||
>
|
>
|
||||||
<Form form={form}>
|
<Form form={form}>
|
||||||
<Form.Item name="roleName" label="Name">
|
<Form.Item name="roleName" label="Name">
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ function TransferModal(props: ModalProps) {
|
|||||||
open={open}
|
open={open}
|
||||||
onOk={() => form.submit()}
|
onOk={() => form.submit()}
|
||||||
onCancel={() => setOpen(false)}
|
onCancel={() => setOpen(false)}
|
||||||
destroyOnClose
|
destroyOnHidden
|
||||||
>
|
>
|
||||||
<Form
|
<Form
|
||||||
form={form}
|
form={form}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function CreateUserButton() {
|
|||||||
open={open}
|
open={open}
|
||||||
onOk={() => { createUser().catch(notifyErrorHandler("Error creating user")); }}
|
onOk={() => { createUser().catch(notifyErrorHandler("Error creating user")); }}
|
||||||
onCancel={() => { setOpen(false); }}
|
onCancel={() => { setOpen(false); }}
|
||||||
destroyOnClose
|
destroyOnHidden
|
||||||
>
|
>
|
||||||
<Form form={form}>
|
<Form form={form}>
|
||||||
<Form.Item name="userName" label="Name">
|
<Form.Item name="userName" label="Name">
|
||||||
@@ -345,7 +345,7 @@ function BulkUserActionButton() {
|
|||||||
okButtonProps={{ disabled: formAction === undefined }}
|
okButtonProps={{ disabled: formAction === undefined }}
|
||||||
onOk={() => { onOk().catch(notifyErrorHandler(`Error running ${formAction}`)); }}
|
onOk={() => { onOk().catch(notifyErrorHandler(`Error running ${formAction}`)); }}
|
||||||
onCancel={() => { setOpen(false); }}
|
onCancel={() => { setOpen(false); }}
|
||||||
destroyOnClose
|
destroyOnHidden
|
||||||
>
|
>
|
||||||
<Form form={form} onValuesChange={onValuesChange} clearOnDestroy>
|
<Form form={form} onValuesChange={onValuesChange} clearOnDestroy>
|
||||||
<Form.Item label="Action" name="action">
|
<Form.Item label="Action" name="action">
|
||||||
|
|||||||
Reference in new issue
Block a user