polish: redesign node admin UI

This commit is contained in:
JetSprow
2026-04-30 22:09:21 +10:00
parent c5592621a4
commit 157f3841f6
13 changed files with 399 additions and 195 deletions

View File

@@ -105,6 +105,7 @@ export async function updateNode(id: string, formData: FormData) {
message: `更新 3x-ui 节点 ${node.name}`,
});
revalidatePath("/admin/nodes");
revalidatePath(`/admin/nodes/${id}`);
return {
...result,
message: result.success ? `节点已更新,${result.message}` : `节点已更新,但${result.message}`,
@@ -140,6 +141,7 @@ export async function testNodeConnection(id: string) {
message: `测试 3x-ui 节点 ${server.name}${result.message}`,
});
revalidatePath("/admin/nodes");
revalidatePath(`/admin/nodes/${id}`);
return result;
}
@@ -172,7 +174,7 @@ export async function updateInboundDisplayName(id: string, formData: FormData) {
const { displayName } = inboundDisplayNameSchema.parse(Object.fromEntries(formData));
const inbound = await prisma.nodeInbound.findUniqueOrThrow({
where: { id },
include: { server: { select: { name: true } } },
include: { server: { select: { id: true, name: true } } },
});
await prisma.nodeInbound.update({
@@ -190,6 +192,7 @@ export async function updateInboundDisplayName(id: string, formData: FormData) {
});
revalidatePath("/admin/nodes");
revalidatePath(`/admin/nodes/${inbound.server.id}`);
revalidatePath("/store");
}
@@ -210,6 +213,7 @@ export async function deleteInbound(id: string) {
message: `从本地移除节点 ${inbound.server.name} 的入站 ${inbound.protocol}:${inbound.port}`,
});
revalidatePath("/admin/nodes");
revalidatePath(`/admin/nodes/${inbound.server.id}`);
}
export async function generateAgentToken(nodeId: string) {
@@ -237,6 +241,7 @@ export async function generateAgentToken(nodeId: string) {
});
revalidatePath("/admin/nodes");
revalidatePath(`/admin/nodes/${nodeId}`);
return plainToken;
}
@@ -262,4 +267,5 @@ export async function revokeAgentToken(nodeId: string) {
});
revalidatePath("/admin/nodes");
revalidatePath(`/admin/nodes/${nodeId}`);
}