From 28dd506cb4aa10bc17c01c53b9081bdfa6864628 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Wed, 3 Jan 2024 19:53:25 +0800 Subject: [PATCH] perf: improve server status table list display make sure never break word --- src/client/pages/Servers.tsx | 62 ++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/src/client/pages/Servers.tsx b/src/client/pages/Servers.tsx index f309223..cd6e95e 100644 --- a/src/client/pages/Servers.tsx +++ b/src/client/pages/Servers.tsx @@ -159,6 +159,7 @@ export const ServerList: React.FC<{ { key: 'status', title: 'Status', + width: 90, render: (val, record) => { return isServerOnline(record) ? ( @@ -176,10 +177,14 @@ export const ServerList: React.FC<{ { dataIndex: 'name', title: 'Node Name', + width: 150, + ellipsis: true, }, { dataIndex: 'hostname', title: 'Host Name', + width: 150, + ellipsis: true, }, // { // dataIndex: ['payload', 'system'], @@ -188,15 +193,18 @@ export const ServerList: React.FC<{ { dataIndex: ['payload', 'uptime'], title: 'Uptime', + width: 150, render: (val) => prettyMilliseconds(Number(val) * 1000), }, { dataIndex: ['payload', 'load'], title: 'Load', + width: 70, }, { key: 'nework', title: 'Network', + width: 110, render: (_, record) => { return ( { return ( `${val}%`, }, { key: 'ram', - title: 'ram', + title: 'RAM', + width: 120, render: (_, record) => { - return `${filesize(record.payload.memory_used * 1000)} / ${filesize( - record.payload.memory_total * 1000 - )}`; + return ( +
+
{filesize(record.payload.memory_used * 1000)} /
+
{filesize(record.payload.memory_total * 1000)}
+
+ ); }, }, { key: 'hdd', - title: 'hdd', + title: 'HDD', + width: 120, render: (_, record) => { - return `${filesize( - record.payload.hdd_used * 1000 * 1000 - )} / ${filesize(record.payload.hdd_total * 1000 * 1000)}`; + return ( +
+
{filesize(record.payload.hdd_used * 1000 * 1000)} /
+
{filesize(record.payload.hdd_total * 1000 * 1000)}
+
+ ); }, }, { dataIndex: 'updatedAt', title: 'updatedAt', + width: 130, render: (val) => { return dayjs(val).format('MMM D HH:mm:ss'); }, @@ -256,14 +275,18 @@ export const ServerList: React.FC<{
Last updated at: {dayjs(lastUpdatedAt).format('YYYY-MM-DD HH:mm:ss')}
- }} - rowClassName={(record) => clsx(!isServerOnline(record) && 'opacity-60')} - /> +
+
}} + rowClassName={(record) => + clsx(!isServerOnline(record) && 'opacity-60') + } + /> + ); }); @@ -286,6 +309,11 @@ export const InstallScript: React.FC = React.memo(() => { > {command} + +
+ Or you wanna report server status in windows server? switch to Manual + tab +
); });