feat(render+admin): delete render node
Build backend images / build content-svc (push) Failing after 1m7s
Build backend images / build file-svc (push) Failing after 48s
Build backend images / build gateway (push) Failing after 55s
Build backend images / build identity-svc (push) Failing after 56s
Build backend images / build notification-svc (push) Failing after 1m7s
Build backend images / build render-svc (push) Failing after 53s
Build backend images / build studio-svc (push) Failing after 59s

- render-svc: DELETE /v1/nodes/:node_id (store.DeleteNode + handler + route)
- admin: حذف button per node row + DELETE /api/admin/nodes/[nodeId] proxy

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-03 01:21:13 +03:30
parent e5812488eb
commit c076345ceb
5 changed files with 48 additions and 0 deletions
@@ -0,0 +1,9 @@
import { type NextRequest } from "next/server";
import { adminProxy } from "@/app/api/admin/_adminProxy";
export const runtime = "nodejs";
interface Ctx { params: { nodeId: string } }
export async function DELETE(req: NextRequest, { params }: Ctx) {
return adminProxy(req, `/v1/nodes/${params.nodeId}`, "DELETE");
}
+18
View File
@@ -55,6 +55,17 @@ export function NodesTable({ nodes }: { nodes: V2Node[] }) {
}
};
const deleteNode = async (nodeId: string) => {
if (!confirm("این نود برای همیشه حذف شود؟")) return;
setLoading((p) => ({ ...p, [nodeId]: true }));
try {
await fetch(`/api/admin/nodes/${nodeId}`, { method: "DELETE" });
router.refresh();
} finally {
setLoading((p) => ({ ...p, [nodeId]: false }));
}
};
const addNode = async () => {
setSaving(true); setErr(null);
const res = await fetch("/api/admin/nodes", {
@@ -204,6 +215,13 @@ export function NodesTable({ nodes }: { nodes: V2Node[] }) {
>
{t("actionRelease")}
</button>
<button
onClick={() => deleteNode(node.id)}
disabled={loading[node.id]}
className="rounded px-2.5 py-1 text-xs text-red-400 border border-red-600/50 hover:bg-red-600/20 disabled:opacity-40 disabled:cursor-not-allowed transition-colors"
>
حذف
</button>
</div>
</td>
</tr>