feat(node): Add status

This commit is contained in:
web@ppanel 2024-11-21 16:06:43 +07:00
parent 6024454d57
commit c06372b644
6 changed files with 43 additions and 0 deletions

View File

@ -107,6 +107,25 @@ export default function NodeTable() {
); );
}, },
}, },
{
accessorKey: 'last',
header: t('status'),
cell: ({ row }) => {
const { last } = row.original;
return last ? (
<>
<Badge>{t('normal')}</Badge>
<span className='ml-2'>
{t('onlineCount')}: {last.count}
</span>
</>
) : (
<Badge variant='destructive'>{t('abnormal')}</Badge>
);
},
},
{ {
accessorKey: 'name', accessorKey: 'name',
header: t('name'), header: t('name'),

View File

@ -24,6 +24,7 @@
"updatedAt": "Updated At" "updatedAt": "Updated At"
}, },
"node": { "node": {
"abnormal": "Abnormal",
"actions": "Actions", "actions": "Actions",
"address": "Address", "address": "Address",
"all": "All", "all": "All",
@ -94,6 +95,8 @@
"name": "Name", "name": "Name",
"node": "Node", "node": "Node",
"nodeGroup": "Node Group", "nodeGroup": "Node Group",
"normal": "Normal",
"onlineCount": "Online users",
"rate": "Rate", "rate": "Rate",
"relay": "Relay", "relay": "Relay",
"serverAddr": "Server IP", "serverAddr": "Server IP",

View File

@ -24,6 +24,7 @@
"updatedAt": "更新时间" "updatedAt": "更新时间"
}, },
"node": { "node": {
"abnormal": "异常",
"actions": "操作", "actions": "操作",
"address": "地址", "address": "地址",
"all": "全部", "all": "全部",
@ -94,6 +95,8 @@
"name": "名称", "name": "名称",
"node": "节点", "node": "节点",
"nodeGroup": "节点组", "nodeGroup": "节点组",
"normal": "正常",
"onlineCount": "在线人数",
"rate": "速率", "rate": "速率",
"relay": "中继", "relay": "中继",
"serverAddr": "服务器IP", "serverAddr": "服务器IP",

View File

@ -555,6 +555,11 @@ declare namespace API {
enable: boolean; enable: boolean;
}; };
type Push = {
push_at: number;
count: number;
};
type Response = { type Response = {
/** 状态码 */ /** 状态码 */
code?: number; code?: number;
@ -579,6 +584,7 @@ declare namespace API {
shadowsocks?: Shadowsocks; shadowsocks?: Shadowsocks;
created_at: number; created_at: number;
updated_at: number; updated_at: number;
last: Push;
}; };
type ServerGroup = { type ServerGroup = {

View File

@ -21,3 +21,11 @@ export async function getGlobalConfig(options?: { [key: string]: any }) {
...(options || {}), ...(options || {}),
}); });
} }
/** Get Tos Content GET /v1/common/site/tos */
export async function getTos(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetTosResponse }>('/v1/common/site/tos', {
method: 'GET',
...(options || {}),
});
}

View File

@ -25,6 +25,10 @@ declare namespace API {
subscribe: SubscribeConfig; subscribe: SubscribeConfig;
}; };
type GetTosResponse = {
tos_content: string;
};
type InviteConfig = { type InviteConfig = {
forced_invite: boolean; forced_invite: boolean;
}; };