feat: kind backend/frontend + visible con toggle en gestion
This commit is contained in:
1 parent
3d9685adeb
commit
222fdac54d
8 files changed
+207
-48
No files matched your search
@@ -17,8 +17,25 @@ export default function Actualizar() {
|
||||
const [busy, setBusy] = useState<string | null>(null);
|
||||
const [msg, setMsg] = useState<{ ok: boolean; text: string } | null>(null);
|
||||
|
||||
const call = async (name: string, action: "deploy" | "webhook") => {
|
||||
setBusy(`${action}:${name}`);
|
||||
const toggleVisible = async (name: string, current: boolean) => {
|
||||
setBusy(`visible:${name}`);
|
||||
try {
|
||||
const res = await fetch(`/api/deployer/modules/${name}`, {
|
||||
method: "PATCH",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ visible: !current }),
|
||||
cache: "no-store",
|
||||
});
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
refreshModules();
|
||||
} catch (e) {
|
||||
setMsg({ ok: false, text: e instanceof Error ? e.message : "Error" });
|
||||
} finally {
|
||||
setBusy(null);
|
||||
}
|
||||
};
|
||||
|
||||
const call = async (name: string, action: "deploy" | "webhook") => { setBusy(`${action}:${name}`);
|
||||
setMsg(null);
|
||||
try {
|
||||
const res = await fetch(
|
||||
@@ -88,7 +105,13 @@ export default function Actualizar() {
|
||||
<strong>{displayName(m.name)}</strong>{" "}
|
||||
<span className={`badge ${env.cls} badge-respaldo`}>
|
||||
{env.label}
|
||||
</span>
|
||||
</span>{" "}
|
||||
{m.kind === "backend" && (
|
||||
<span className="badge bg-dark badge-respaldo">backend</span>
|
||||
)}{" "}
|
||||
{m.visible === false && (
|
||||
<span className="badge bg-secondary badge-respaldo">oculto</span>
|
||||
)}
|
||||
<div>
|
||||
<small className="text-muted">
|
||||
{m.lastDeploy
|
||||
@@ -131,6 +154,14 @@ export default function Actualizar() {
|
||||
>
|
||||
<i className="bx bx-link" />
|
||||
</button>
|
||||
<button
|
||||
className="btn btn-sm btn-outline-secondary"
|
||||
disabled={busy !== null}
|
||||
onClick={() => toggleVisible(m.name, m.visible !== false)}
|
||||
title={m.visible === false ? "Mostrar en portal" : "Ocultar del portal"}
|
||||
>
|
||||
<i className={`bx ${m.visible === false ? "bx-eye" : "bx-eye-off"}`} />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in new issue
Block a user