Let admins hide the Proxmox-link card per server

Not every registered server is a Proxmox VM/LXC -- bare-metal boxes
and other hosts had no reason to show a "link to Proxmox" option, but
it appeared unconditionally on every server's detail page.

New hideProxmoxLink column on servers (default false, so existing
behavior is unchanged until someone opts in). A "Not a VM? Hide this"
link in the card's header sets it; once hidden, a small "+ Show
Proxmox link options" link takes its place so it's still reachable,
not buried in a settings form. The card always shows regardless of
this flag once a server IS actually linked, so unlinking never becomes
unreachable by hiding the card out from under an active link.

Verified against a temp SQLite DB with real migrations: a new server
defaults to false, and toggling true/false both persist correctly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5 committed 2026-09-18 21:34:52 +02:00
1 parent f2a6253ddf
commit 08a984719f
8 files changed
+1193 -2

No files matched your search

+2
View File
@@ -220,6 +220,7 @@ export interface ServerRecord {
proxmoxNode: string | null;
proxmoxGuestType: "qemu" | "lxc" | null;
proxmoxVmid: number | null;
hideProxmoxLink: boolean;
}
export interface ServerHardware {
@@ -271,6 +272,7 @@ export interface ServerUpdateInput {
proxmoxNode?: string | null;
proxmoxGuestType?: "qemu" | "lxc" | null;
proxmoxVmid?: number | null;
hideProxmoxLink?: boolean;
}
export type ScheduleType = "cron" | "systemd_timer" | "docker" | "backup" | "update" | "n8n_workflow" | "manual";
+25 -1
View File
@@ -175,6 +175,15 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
}
}
async function toggleHideProxmoxLink(hide: boolean) {
try {
await api.servers.update(serverId, { hideProxmoxLink: hide });
await loadDetail();
} catch (err) {
setLinkError(err instanceof Error ? err.message : String(err));
}
}
function openAddTask() {
setEditingTask(null);
setTaskForm({ ...emptyTaskForm });
@@ -397,10 +406,17 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
</div>
</div>
{isAdmin && (
{isAdmin && (server.proxmoxIntegrationId || !server.hideProxmoxLink) ? (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Proxmox link</h3>
{!server.proxmoxIntegrationId && (
<div className="card-actions">
<button className="btn btn-link btn-sm p-0" onClick={() => toggleHideProxmoxLink(true)}>
Not a VM? Hide this
</button>
</div>
)}
</div>
<div className="card-body">
{server.proxmoxIntegrationId ? (
@@ -465,6 +481,14 @@ export default function ServerDetail({ user }: { user: CurrentUser }) {
)}
</div>
</div>
) : (
isAdmin && (
<div className="mb-3">
<button className="btn btn-link btn-sm p-0" onClick={() => toggleHideProxmoxLink(false)}>
+ Show Proxmox link options
</button>
</div>
)
)}
<div className="row row-cards mb-3">