mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-21 16:13:12 +09:00
Show the public address on the instance details page (#935)
The instance list shows the public connect address but the instance detail page did not. Add a Public address row (host:port) with a copy button, and lay the details out 2x2 so the extra row stays balanced. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5efa257a36
commit
b29f4db52c
1 file changed
+22
-2
@@ -1,6 +1,9 @@
|
|||||||
import React, { useContext, useState } from "react";
|
import React, { useContext, useState } from "react";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { useNavigate, useParams } from "react-router-dom";
|
||||||
import { Alert, Button, Descriptions, Dropdown, Flex, MenuProps, Modal, Space, Spin, Switch, Typography } from "antd";
|
import {
|
||||||
|
Alert, Button, Descriptions, Dropdown, Flex, MenuProps, Modal, Space, Spin, Switch, Typography, message,
|
||||||
|
} from "antd";
|
||||||
|
import CopyOutlined from "@ant-design/icons/CopyOutlined";
|
||||||
import DeleteOutlined from "@ant-design/icons/DeleteOutlined";
|
import DeleteOutlined from "@ant-design/icons/DeleteOutlined";
|
||||||
import DownOutlined from "@ant-design/icons/DownOutlined";
|
import DownOutlined from "@ant-design/icons/DownOutlined";
|
||||||
|
|
||||||
@@ -43,10 +46,11 @@ function InstanceDescription(props: InstanceDescriptionProps) {
|
|||||||
|
|
||||||
const { host, instance } = props;
|
const { host, instance } = props;
|
||||||
let assigned = instance.assignedHost !== undefined;
|
let assigned = instance.assignedHost !== undefined;
|
||||||
|
const publicAddress = instancePublicAddress(instance, host);
|
||||||
return <Descriptions
|
return <Descriptions
|
||||||
bordered
|
bordered
|
||||||
size="small"
|
size="small"
|
||||||
column={{ xs: 1, md: 3, lg: 3, xl: 3, xxl: 3 }}
|
column={{ xs: 1, md: 2, lg: 2, xl: 2, xxl: 2 }}
|
||||||
>
|
>
|
||||||
<Descriptions.Item label="Host">
|
<Descriptions.Item label="Host">
|
||||||
{!assigned
|
{!assigned
|
||||||
@@ -67,6 +71,22 @@ function InstanceDescription(props: InstanceDescriptionProps) {
|
|||||||
buttonContent={assigned ? "Reassign" : "Assign"}
|
buttonContent={assigned ? "Reassign" : "Assign"}
|
||||||
/>}
|
/>}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
<Descriptions.Item label="Public address">
|
||||||
|
{publicAddress
|
||||||
|
? <Space>
|
||||||
|
{publicAddress}
|
||||||
|
<Button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
icon={<CopyOutlined />}
|
||||||
|
onClick={() => {
|
||||||
|
navigator.clipboard.writeText(publicAddress);
|
||||||
|
message.success("Copied public address!");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
: <em>N/A</em>}
|
||||||
|
</Descriptions.Item>
|
||||||
<Descriptions.Item label="Version">
|
<Descriptions.Item label="Version">
|
||||||
{instance.factorioVersion ?? "unknown"}
|
{instance.factorioVersion ?? "unknown"}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
|||||||
Reference in new issue
Block a user