mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Add icons for mis-matched version and restart required
This commit is contained in:
10 files changed
+97
-51
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import React, {useContext, useState} from "react";
|
||||
import { Button, Descriptions, Flex, Popconfirm, Space, Typography } from "antd";
|
||||
import { Button, Descriptions, Flex, Popconfirm, Space, Tooltip, Typography } from "antd";
|
||||
import { ExclamationCircleOutlined } from "@ant-design/icons";
|
||||
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
@@ -54,16 +55,20 @@ export default function ControllerPage() {
|
||||
}
|
||||
{
|
||||
account.hasPermission("core.controller.restart")
|
||||
&& <Button
|
||||
disabled={system?.canRestart === false}
|
||||
onClick={() => {
|
||||
control.send(
|
||||
new lib.ControllerRestartRequest()
|
||||
).catch(notifyErrorHandler("Error restarting controller"));
|
||||
}}
|
||||
>
|
||||
Restart
|
||||
</Button>
|
||||
&& <Tooltip title={system?.restartRequired ? "Restart Required" : null}>
|
||||
<Button
|
||||
disabled={system?.canRestart === false}
|
||||
onClick={() => {
|
||||
control.send(
|
||||
new lib.ControllerRestartRequest()
|
||||
).catch(notifyErrorHandler("Error restarting controller"));
|
||||
}}
|
||||
>
|
||||
Restart
|
||||
{!system?.restartRequired ? undefined
|
||||
: <ExclamationCircleOutlined style={{ color: "yellow" }}/>}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
}
|
||||
</Space>}
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { useContext, useState } from "react";
|
||||
import { Descriptions, Spin, Tag, Typography, Button, Space, Modal, Popconfirm, Flex } from "antd";
|
||||
import { Descriptions, Spin, Tag, Typography, Button, Space, Modal, Popconfirm, Flex, Tooltip } from "antd";
|
||||
import { ExclamationCircleOutlined } from "@ant-design/icons";
|
||||
import { useParams } from "react-router-dom";
|
||||
|
||||
import * as lib from "@clusterio/lib";
|
||||
@@ -89,17 +90,21 @@ export default function HostViewPage() {
|
||||
}
|
||||
{
|
||||
account.hasPermission("core.host.restart")
|
||||
&& <Button
|
||||
disabled={system?.canRestart === false}
|
||||
onClick={() => {
|
||||
control.sendTo(
|
||||
{ hostId },
|
||||
new lib.HostRestartRequest()
|
||||
).catch(notifyErrorHandler("Error restarting host"));
|
||||
}}
|
||||
>
|
||||
Restart
|
||||
</Button>
|
||||
&& <Tooltip title={system?.restartRequired ? "Restart Required" : null}>
|
||||
<Button
|
||||
disabled={system?.canRestart === false}
|
||||
onClick={() => {
|
||||
control.sendTo(
|
||||
{ hostId },
|
||||
new lib.HostRestartRequest()
|
||||
).catch(notifyErrorHandler("Error restarting host"));
|
||||
}}
|
||||
>
|
||||
Restart
|
||||
{!system?.restartRequired ? undefined
|
||||
: <ExclamationCircleOutlined style={{ color: "yellow" }} />}
|
||||
</Button>
|
||||
</Tooltip>
|
||||
}
|
||||
</Space>;
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React, { useContext, useRef, useState, useEffect } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { Button, Flex, Form, InputNumber, Modal, Progress, Switch, Table, Tag, Typography } from "antd";
|
||||
import CopyOutlined from "@ant-design/icons/lib/icons/CopyOutlined";
|
||||
import { Button, Flex, Form, InputNumber, Modal, Progress, Space, Switch, Table, Tag, Tooltip, Typography } from "antd";
|
||||
import { ExclamationCircleOutlined, CopyOutlined } from "@ant-design/icons";
|
||||
|
||||
import * as lib from "@clusterio/lib";
|
||||
|
||||
import webUiPackage from "../../package.json";
|
||||
import { useAccount } from "../model/account";
|
||||
import ControlContext from "./ControlContext";
|
||||
import PageHeader from "./PageHeader";
|
||||
@@ -13,6 +14,7 @@ import PluginExtra from "./PluginExtra";
|
||||
import {
|
||||
MetricCpuRatio, MetricCpuUsed, MetricMemoryRatio, MetricMemoryUsed,
|
||||
MetricDiskUsed, MetricDiskRatio,
|
||||
RestartRequired,
|
||||
} from "./system_metrics";
|
||||
import { useHosts } from "../model/host";
|
||||
import { useSystems } from "../model/system";
|
||||
@@ -268,6 +270,12 @@ export default function HostsPage() {
|
||||
{
|
||||
title: "Version",
|
||||
dataIndex: "version",
|
||||
render: (_, host) => <Space>
|
||||
{host.version}
|
||||
{webUiPackage.version === host.version ? undefined : <Tooltip title="Version Mismatch">
|
||||
<ExclamationCircleOutlined style={{ color: "yellow" }}/>
|
||||
</Tooltip>}
|
||||
</Space>,
|
||||
sorter: (a, b) => strcmp(a.version, b.version),
|
||||
},
|
||||
{
|
||||
@@ -278,11 +286,14 @@ export default function HostsPage() {
|
||||
{
|
||||
title: "Connected",
|
||||
key: "connected",
|
||||
render: (_, host) => <Tag
|
||||
color={host.connected ? "#389e0d" : "#cf1322"}
|
||||
>
|
||||
{host.connected ? "Connected" : "Disconnected"}
|
||||
</Tag>,
|
||||
render: (_, host) => <>
|
||||
<Tag
|
||||
color={host.connected ? "#389e0d" : "#cf1322"}
|
||||
>
|
||||
{host.connected ? "Connected" : "Disconnected"}
|
||||
</Tag>
|
||||
<RestartRequired system={systems.get(host.id)}/>
|
||||
</>,
|
||||
sorter: (a, b) => Number(a.connected) - Number(b.connected),
|
||||
},
|
||||
]}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import React from "react";
|
||||
|
||||
import * as lib from "@clusterio/lib";
|
||||
import { Progress } from "antd";
|
||||
import { Progress, Tooltip } from "antd";
|
||||
import { ReloadOutlined } from "@ant-design/icons";
|
||||
|
||||
export function MetricCpuRatio(props: { system?: lib.SystemInfo }) {
|
||||
if (!props.system) {
|
||||
@@ -53,3 +54,12 @@ export function MetricDiskUsed(props: { system?: lib.SystemInfo }) {
|
||||
const capacity = lib.formatBytes(props.system.diskCapacity);
|
||||
return `${used} / ${capacity}`;
|
||||
}
|
||||
|
||||
export function RestartRequired(props: { system?: lib.SystemInfo }) {
|
||||
if (!props.system || !props.system.restartRequired) {
|
||||
return "";
|
||||
}
|
||||
return <Tooltip title="Restart Required">
|
||||
<ReloadOutlined style={{ color: "yellow" }}/>
|
||||
</Tooltip>;
|
||||
}
|
||||
Reference in new issue
Block a user