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
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:
@@ -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");
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user