From e38fcb757847511f9f29126dd204f7780d63a8b9 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sat, 2 Sep 2023 15:40:38 +0800 Subject: [PATCH] feat: basic page for servers and website --- src/client/pages/Servers.tsx | 124 ++++++++++++++++++++++++++++++++++- src/client/pages/Website.tsx | 92 +++++++++++++++++++++++++- 2 files changed, 212 insertions(+), 4 deletions(-) diff --git a/src/client/pages/Servers.tsx b/src/client/pages/Servers.tsx index 1e9ef16..5dda47e 100644 --- a/src/client/pages/Servers.tsx +++ b/src/client/pages/Servers.tsx @@ -1,6 +1,126 @@ -import React from 'react'; +import React, { useMemo, useState } from 'react'; +import { Button, Form, Input, Modal, Table } from 'antd'; +import { ColumnsType } from 'antd/es/table'; +import { PlusOutlined } from '@ant-design/icons'; export const Servers: React.FC = React.memo(() => { - return
Servers
; + const [isModalOpen, setIsModalOpen] = useState(false); + + const handleOk = () => { + setIsModalOpen(false); + }; + + return ( +
+
+
Servers
+
+ +
+
+ + + + setIsModalOpen(false)} + > +
+ + + +
+
+
+ ); }); Servers.displayName = 'Servers'; + +interface ServerInfoRecordType { + status: 'online' | 'offline'; + nodeName: string; + type: string; // KVM | Hyper-V + location: string; + uptime: number; // second + load: number; + network: string; + traffic: string; + cpu: string; + ram: string; + hdd: string; +} + +export const ServerList: React.FC = React.memo(() => { + const dataSource: ServerInfoRecordType[] = [ + { + status: 'online', + nodeName: 'node1', + type: 'KVM', + location: 'Chicago', + uptime: 82989, + load: 0.2, + network: '82.9K | 89.3K', + traffic: '21.6G | 18.3G', + cpu: '5%', + ram: '1G/2G', + hdd: '25G/30G', + }, + ]; + + const columns = useMemo((): ColumnsType => { + return [ + { + dataIndex: 'status', + title: 'Status', + }, + { + dataIndex: 'nodeName', + title: 'Node Name', + }, + { + dataIndex: 'type', + title: 'Type', + }, + { + dataIndex: 'uptime', + title: 'Uptime', + }, + { + dataIndex: 'load', + title: 'Load', + }, + { + dataIndex: 'network', + title: 'Network', + }, + { + dataIndex: 'traffic', + title: 'Traffic', + }, + { + dataIndex: 'cpu', + title: 'cpu', + }, + { + dataIndex: 'ram', + title: 'ram', + }, + { + dataIndex: 'hdd', + title: 'hdd', + }, + ]; + }, []); + + return ; +}); +ServerList.displayName = 'ServerList'; diff --git a/src/client/pages/Website.tsx b/src/client/pages/Website.tsx index 508bbcb..9333afe 100644 --- a/src/client/pages/Website.tsx +++ b/src/client/pages/Website.tsx @@ -1,6 +1,94 @@ -import React from 'react'; +import { + BarChartOutlined, + EditOutlined, + PlusOutlined, +} from '@ant-design/icons'; +import { Button, Form, Input, Modal, Table } from 'antd'; +import { ColumnsType } from 'antd/es/table'; +import React, { useMemo, useState } from 'react'; export const Website: React.FC = React.memo(() => { - return
Website
; + const [isModalOpen, setIsModalOpen] = useState(false); + + const handleOk = () => { + setIsModalOpen(false); + }; + + return ( +
+
+
Servers
+
+ +
+
+ + + + setIsModalOpen(false)} + > +
+ + + + + + + +
+
+ ); }); Website.displayName = 'Website'; + +interface WebsiteInfoRecordType { + name: string; + domain: string; +} + +export const WebsiteList: React.FC = React.memo(() => { + const dataSource: WebsiteInfoRecordType[] = [ + { + name: 'tianji', + domain: 'tianji.msgbyte.com', + }, + ]; + + const columns = useMemo((): ColumnsType => { + return [ + { + dataIndex: 'name', + title: 'Name', + }, + { + dataIndex: 'domain', + title: 'Domain', + }, + { + key: 'action', + render: () => { + return ( +
+ + +
+ ); + }, + }, + ]; + }, []); + + return
; +}); +WebsiteList.displayName = 'WebsiteList';