Skip to content

Commit

Permalink
✨ feat(node): Add status
Browse files Browse the repository at this point in the history
  • Loading branch information
web-ppanel committed Nov 21, 2024
1 parent 6024454 commit c06372b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 0 deletions.
19 changes: 19 additions & 0 deletions apps/admin/app/dashboard/server/node-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
header: t('name'),
Expand Down
3 changes: 3 additions & 0 deletions apps/admin/locales/en-US/server.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"updatedAt": "Updated At"
},
"node": {
"abnormal": "Abnormal",
"actions": "Actions",
"address": "Address",
"all": "All",
Expand Down Expand Up @@ -94,6 +95,8 @@
"name": "Name",
"node": "Node",
"nodeGroup": "Node Group",
"normal": "Normal",
"onlineCount": "Online users",
"rate": "Rate",
"relay": "Relay",
"serverAddr": "Server IP",
Expand Down
3 changes: 3 additions & 0 deletions apps/admin/locales/zh-CN/server.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"updatedAt": "更新时间"
},
"node": {
"abnormal": "异常",
"actions": "操作",
"address": "地址",
"all": "全部",
Expand Down Expand Up @@ -94,6 +95,8 @@
"name": "名称",
"node": "节点",
"nodeGroup": "节点组",
"normal": "正常",
"onlineCount": "在线人数",
"rate": "速率",
"relay": "中继",
"serverAddr": "服务器IP",
Expand Down
6 changes: 6 additions & 0 deletions apps/admin/services/admin/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,11 @@ declare namespace API {
enable: boolean;
};

type Push = {
push_at: number;
count: number;
};

type Response = {
/** 状态码 */
code?: number;
Expand All @@ -579,6 +584,7 @@ declare namespace API {
shadowsocks?: Shadowsocks;
created_at: number;
updated_at: number;
last: Push;
};

type ServerGroup = {
Expand Down
8 changes: 8 additions & 0 deletions apps/admin/services/common/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ export async function getGlobalConfig(options?: { [key: string]: any }) {
...(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 || {}),
});
}
4 changes: 4 additions & 0 deletions apps/admin/services/common/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ declare namespace API {
subscribe: SubscribeConfig;
};

type GetTosResponse = {
tos_content: string;
};

type InviteConfig = {
forced_invite: boolean;
};
Expand Down

0 comments on commit c06372b

Please sign in to comment.