mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 00:13:12 +09:00
Make host name on instance page clickable
This commit is contained in:
1 parent
99990c7a0d
commit
d6b0e88dda
1 file changed
+10
-8
@@ -1,5 +1,5 @@
|
|||||||
import React, { useContext, useState } from "react";
|
import React, { useContext, useState } from "react";
|
||||||
import { useNavigate, useParams } from "react-router-dom";
|
import { Link, useNavigate, useParams } from "react-router-dom";
|
||||||
import { Alert, Button, Descriptions, Dropdown, Menu, MenuProps, Modal, Space, Spin, Typography } from "antd";
|
import { Alert, Button, Descriptions, Dropdown, Menu, MenuProps, Modal, Space, Spin, Typography } from "antd";
|
||||||
import type { ItemType } from "antd/es/menu/hooks/useItems";
|
import type { ItemType } from "antd/es/menu/hooks/useItems";
|
||||||
import DeleteOutlined from "@ant-design/icons/DeleteOutlined";
|
import DeleteOutlined from "@ant-design/icons/DeleteOutlined";
|
||||||
@@ -42,7 +42,9 @@ function InstanceDescription(props: InstanceDescriptionProps) {
|
|||||||
<Descriptions.Item label="Host">
|
<Descriptions.Item label="Host">
|
||||||
{!assigned
|
{!assigned
|
||||||
? <em>Unassigned</em>
|
? <em>Unassigned</em>
|
||||||
: host?.name ?? instance.assignedHost
|
: <Link to={`/hosts/${host?.id ?? instance.assignedHost}/view`}>
|
||||||
|
<Typography.Link>{host?.name ?? instance.assignedHost}</Typography.Link>
|
||||||
|
</Link>
|
||||||
}
|
}
|
||||||
{account.hasPermission("core.instance.assign") && <AssignInstanceModal
|
{account.hasPermission("core.instance.assign") && <AssignInstanceModal
|
||||||
id={instance.id}
|
id={instance.id}
|
||||||
@@ -104,7 +106,7 @@ function InstanceButtons(props: { instance: lib.InstanceDetails }) {
|
|||||||
}
|
}
|
||||||
let instanceButtonsMenuProps: MenuProps = {
|
let instanceButtonsMenuProps: MenuProps = {
|
||||||
items: instanceButtonMenuItems,
|
items: instanceButtonMenuItems,
|
||||||
onClick: ({ key }: { key:string }) => {
|
onClick: ({ key }: { key: string }) => {
|
||||||
if (key === "export") {
|
if (key === "export") {
|
||||||
setExportingData(true);
|
setExportingData(true);
|
||||||
control.sendTo(
|
control.sendTo(
|
||||||
@@ -157,8 +159,8 @@ function InstanceButtons(props: { instance: lib.InstanceDetails }) {
|
|||||||
"core.instance.kill",
|
"core.instance.kill",
|
||||||
"core.instance.delete",
|
"core.instance.delete",
|
||||||
) && <Dropdown placement="bottomRight" trigger={["click"]} menu={instanceButtonsMenuProps}>
|
) && <Dropdown placement="bottomRight" trigger={["click"]} menu={instanceButtonsMenuProps}>
|
||||||
<Button>More <DownOutlined /></Button>
|
<Button>More <DownOutlined /></Button>
|
||||||
</Dropdown>}
|
</Dropdown>}
|
||||||
</Space>;
|
</Space>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +182,7 @@ export default function InstanceViewPage() {
|
|||||||
|
|
||||||
return <PageLayout nav={nav}>
|
return <PageLayout nav={nav}>
|
||||||
<Alert
|
<Alert
|
||||||
message={"Instance not found" }
|
message={"Instance not found"}
|
||||||
showIcon
|
showIcon
|
||||||
description={<>Instance with id {instanceId} was not found on the controller.</>}
|
description={<>Instance with id {instanceId} was not found on the controller.</>}
|
||||||
type="warning"
|
type="warning"
|
||||||
@@ -198,8 +200,8 @@ export default function InstanceViewPage() {
|
|||||||
|
|
||||||
return <PageLayout nav={nav}>
|
return <PageLayout nav={nav}>
|
||||||
<PageHeader
|
<PageHeader
|
||||||
title={instance.name??""}
|
title={instance.name ?? ""}
|
||||||
extra={<InstanceButtons instance={instance}/>}
|
extra={<InstanceButtons instance={instance} />}
|
||||||
/>
|
/>
|
||||||
<InstanceDescription host={host} instance={instance} />
|
<InstanceDescription host={host} instance={instance} />
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user