Add Network Design Studio with multi-U Dell rack designer.
Includes rack catalog/API, Visio-style drag-and-drop, faceplate assets, readable nameplates, and theme/RDP UI updates so multi-U placement stays correct during design. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,353 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>OME Cockpit · RDP</title>
|
||||
<link rel="stylesheet" href="/styles.css?v=rdp1" />
|
||||
<style>
|
||||
body.rdp-body {
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
background:
|
||||
radial-gradient(ellipse 70% 50% at 50% 0%, rgba(0, 118, 206, 0.22), transparent 55%),
|
||||
var(--bg-deep);
|
||||
color: var(--text);
|
||||
font-family: var(--sans);
|
||||
}
|
||||
.rdp-shell {
|
||||
max-width: 720px;
|
||||
margin: 0 auto;
|
||||
padding: 1.25rem 1.35rem 2rem;
|
||||
}
|
||||
.rdp-brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.85rem;
|
||||
margin-bottom: 1.1rem;
|
||||
}
|
||||
.rdp-brand img { width: 40px; height: 40px; border-radius: 8px; }
|
||||
.rdp-brand .kicker {
|
||||
margin: 0;
|
||||
font-size: 0.68rem;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: var(--cyan);
|
||||
}
|
||||
.rdp-brand h1 {
|
||||
margin: 0.1rem 0 0;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 650;
|
||||
color: #e8f4ff;
|
||||
}
|
||||
.rdp-card {
|
||||
background: rgba(8, 18, 32, 0.94);
|
||||
border: 1px solid rgba(0, 168, 232, 0.28);
|
||||
border-radius: 14px;
|
||||
padding: 1.1rem 1.15rem 1.25rem;
|
||||
box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
.rdp-meta {
|
||||
margin: 0 0 0.85rem;
|
||||
color: #c5d6e6;
|
||||
font-size: 0.86rem;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.rdp-warn {
|
||||
margin: 0 0 0.85rem;
|
||||
padding: 0.55rem 0.7rem;
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(255, 176, 32, 0.4);
|
||||
background: rgba(255, 176, 32, 0.1);
|
||||
color: #ffe0a8;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.rdp-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 7.5rem;
|
||||
gap: 0.65rem;
|
||||
margin-bottom: 0.75rem;
|
||||
}
|
||||
.rdp-grid label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.3rem;
|
||||
font-size: 0.72rem;
|
||||
color: #9fd0c8;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
}
|
||||
.rdp-grid label.wide { grid-column: 1 / -1; }
|
||||
.rdp-grid input {
|
||||
background: rgba(2, 8, 16, 0.9);
|
||||
border: 1px solid rgba(0, 168, 232, 0.28);
|
||||
border-radius: 8px;
|
||||
padding: 0.55rem 0.65rem;
|
||||
color: #e8f4ff;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
.rdp-grid input:focus {
|
||||
outline: none;
|
||||
border-color: rgba(61, 255, 224, 0.55);
|
||||
box-shadow: 0 0 0 2px rgba(0, 168, 232, 0.2);
|
||||
}
|
||||
.rdp-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
margin-top: 0.35rem;
|
||||
}
|
||||
.rdp-actions .btn { min-height: 2.4rem; }
|
||||
.rdp-status {
|
||||
margin: 0.85rem 0 0;
|
||||
min-height: 1.2em;
|
||||
font-size: 0.82rem;
|
||||
color: #9fd0c8;
|
||||
}
|
||||
.rdp-status.ok { color: var(--cyan); }
|
||||
.rdp-status.error { color: #ff8a8a; }
|
||||
.rdp-help {
|
||||
margin: 1rem 0 0;
|
||||
padding-top: 0.85rem;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
||||
font-size: 0.78rem;
|
||||
color: #b7c9d9;
|
||||
line-height: 1.45;
|
||||
}
|
||||
.rdp-help code {
|
||||
font-family: var(--mono);
|
||||
color: var(--cyan);
|
||||
font-size: 0.74rem;
|
||||
}
|
||||
.rdp-ip-picks { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: -0.25rem 0 0.35rem; }
|
||||
.rdp-ip-picks button {
|
||||
background: rgba(0,118,206,0.18);
|
||||
border: 1px solid rgba(61,255,224,0.3);
|
||||
color: #e8f4ff;
|
||||
border-radius: 999px;
|
||||
padding: 0.25rem 0.65rem;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
.rdp-ip-picks button.active { background: rgba(61,255,224,0.22); border-color: rgba(61,255,224,0.55); }
|
||||
.rdp-meta code { color: var(--cyan); font-family: var(--mono); font-size: 0.8rem; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="rdp-body">
|
||||
<div class="rdp-shell">
|
||||
<header class="rdp-brand">
|
||||
<img src="/dell.png" alt="Dell" />
|
||||
<div>
|
||||
<p class="kicker">Remote Desktop</p>
|
||||
<h1 id="rdp-title">RDP session</h1>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="rdp-card">
|
||||
<p class="rdp-meta" id="rdp-meta">—</p>
|
||||
<p class="rdp-warn hidden" id="rdp-warn">
|
||||
This OME entry looks like an <strong>iDRAC</strong> address. RDP needs the <strong>Windows OS IP/hostname</strong> — change Host below if needed.
|
||||
</p>
|
||||
|
||||
<form id="rdp-form" autocomplete="on">
|
||||
<div class="rdp-grid">
|
||||
<label class="wide">Host (Windows OS IP or DNS)
|
||||
<input type="text" id="rdp-host" name="host" autocomplete="off" spellcheck="false" required list="rdp-ip-list" />
|
||||
<datalist id="rdp-ip-list"></datalist>
|
||||
</label>
|
||||
<div class="rdp-ip-picks" id="rdp-ip-picks"></div>
|
||||
<label>Port
|
||||
<input type="number" id="rdp-port" name="port" value="3389" min="1" max="65535" />
|
||||
</label>
|
||||
<label class="wide">Username (optional — client will prompt if empty)
|
||||
<input type="text" id="rdp-user" name="username" autocomplete="username" spellcheck="false" placeholder="DOMAIN\user or user@domain" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="rdp-actions">
|
||||
<button type="submit" class="btn primary" id="rdp-launch">Open Remote Desktop</button>
|
||||
<button type="button" class="btn" id="rdp-download">Download .rdp</button>
|
||||
<button type="button" class="btn ghost" id="rdp-copy">Copy host:port</button>
|
||||
</div>
|
||||
</form>
|
||||
<p class="rdp-status" id="rdp-status">Ready — opens your local RDP client (mstsc / Windows App / Remmina).</p>
|
||||
<div class="rdp-help">
|
||||
<p>Cockpit launches a standard <code>.rdp</code> file so Windows nodes without SSH stay reachable from this popout.</p>
|
||||
<p>Windows: opens Remote Desktop Connection. Linux: Remmina / FreeRDP if associated with <code>.rdp</code>. macOS: Microsoft Remote Desktop.</p>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(() => {
|
||||
const q = new URLSearchParams(location.search);
|
||||
const name = q.get("name") || "RDP session";
|
||||
const model = q.get("model") || "";
|
||||
const st = q.get("st") || "";
|
||||
const osHost = (q.get("os_hostname") || "").trim();
|
||||
const idracIp = (q.get("idrac_ip") || "").trim();
|
||||
const hostIn = (q.get("host") || "").trim();
|
||||
const rdpIps = (q.get("rdp_ips") || "").split(",").map((s) => s.trim()).filter(Boolean);
|
||||
const idracHint = /idrac|bmc|ilo/i.test(name) || (idracIp && hostIn === idracIp);
|
||||
|
||||
document.title = `RDP · ${name}`;
|
||||
document.getElementById("rdp-title").textContent = name;
|
||||
document.getElementById("rdp-meta").innerHTML = [
|
||||
model,
|
||||
st && `ST ${st}`,
|
||||
osHost && `OS <code>${osHost}</code>`,
|
||||
idracIp && `iDRAC <code>${idracIp}</code>`,
|
||||
].filter(Boolean).join(" · ") || "—";
|
||||
document.getElementById("rdp-host").value = hostIn || rdpIps[0] || osHost || "";
|
||||
document.getElementById("rdp-user").value = localStorage.getItem("cockpit_rdp_user") || "";
|
||||
|
||||
const warn = document.getElementById("rdp-warn");
|
||||
if (idracHint) warn.classList.remove("hidden");
|
||||
|
||||
const status = document.getElementById("rdp-status");
|
||||
function setStatus(msg, kind) {
|
||||
status.textContent = msg;
|
||||
status.className = "rdp-status" + (kind ? " " + kind : "");
|
||||
}
|
||||
|
||||
const list = document.getElementById("rdp-ip-list");
|
||||
const picks = document.getElementById("rdp-ip-picks");
|
||||
const candidates = [...new Set([...(rdpIps || []), hostIn, osHost].filter(Boolean))];
|
||||
candidates.forEach((ip) => {
|
||||
const opt = document.createElement("option");
|
||||
opt.value = ip;
|
||||
list.appendChild(opt);
|
||||
const btn = document.createElement("button");
|
||||
btn.type = "button";
|
||||
btn.textContent = ip;
|
||||
if (ip === (hostIn || rdpIps[0])) btn.classList.add("active");
|
||||
btn.addEventListener("click", () => {
|
||||
document.getElementById("rdp-host").value = ip;
|
||||
picks.querySelectorAll("button").forEach((b) => b.classList.toggle("active", b === btn));
|
||||
setStatus(`Selected ${ip}`, "ok");
|
||||
});
|
||||
picks.appendChild(btn);
|
||||
});
|
||||
|
||||
function vals() {
|
||||
const host = document.getElementById("rdp-host").value.trim();
|
||||
const port = Number(document.getElementById("rdp-port").value || 3389);
|
||||
const username = document.getElementById("rdp-user").value.trim();
|
||||
return { host, port, username };
|
||||
}
|
||||
|
||||
function rememberUser(u) {
|
||||
if (u) localStorage.setItem("cockpit_rdp_user", u);
|
||||
}
|
||||
|
||||
function buildRdp({ host, port, username }) {
|
||||
const full = port && port !== 3389 ? `${host}:${port}` : host;
|
||||
const lines = [
|
||||
"screen mode id:i:2",
|
||||
"use multimon:i:0",
|
||||
"desktopwidth:i:1920",
|
||||
"desktopheight:i:1080",
|
||||
"session bpp:i:32",
|
||||
"compression:i:1",
|
||||
"keyboardhook:i:2",
|
||||
"audiocapturemode:i:0",
|
||||
"videoplaybackmode:i:1",
|
||||
"connection type:i:7",
|
||||
"networkautodetect:i:1",
|
||||
"bandwidthautodetect:i:1",
|
||||
"displayconnectionbar:i:1",
|
||||
"enableworkspacereconnect:i:0",
|
||||
"disable wallpaper:i:0",
|
||||
"allow font smoothing:i:1",
|
||||
"allow desktop composition:i:1",
|
||||
"disable full window drag:i:0",
|
||||
"disable menu anims:i:0",
|
||||
"disable themes:i:0",
|
||||
"disable cursor setting:i:0",
|
||||
"bitmapcachepersistenable:i:1",
|
||||
`full address:s:${full}`,
|
||||
"audiomode:i:0",
|
||||
"redirectprinters:i:0",
|
||||
"redirectcomports:i:0",
|
||||
"redirectsmartcards:i:0",
|
||||
"redirectclipboard:i:1",
|
||||
"redirectposdevices:i:0",
|
||||
"autoreconnection enabled:i:1",
|
||||
"authentication level:i:2",
|
||||
"prompt for credentials:i:1",
|
||||
"negotiate security layer:i:1",
|
||||
"remoteapplicationmode:i:0",
|
||||
"alternate shell:s:",
|
||||
"shell working directory:s:",
|
||||
"gatewayhostname:s:",
|
||||
"gatewayusagemethod:i:4",
|
||||
"gatewaycredentialssource:i:4",
|
||||
"gatewayprofileusagemethod:i:0",
|
||||
"promptcredentialonce:i:0",
|
||||
"gatewaybrokeringtype:i:0",
|
||||
"use redirection server name:i:0",
|
||||
"rdgiskdcproxy:i:0",
|
||||
"kdcproxyname:s:",
|
||||
];
|
||||
if (username) lines.splice(24, 0, `username:s:${username}`);
|
||||
return lines.join("\r\n") + "\r\n";
|
||||
}
|
||||
|
||||
function downloadRdp(autoOpen) {
|
||||
const v = vals();
|
||||
if (!v.host) {
|
||||
setStatus("Host is required", "error");
|
||||
document.getElementById("rdp-host").focus();
|
||||
return;
|
||||
}
|
||||
rememberUser(v.username);
|
||||
const body = buildRdp(v);
|
||||
const blob = new Blob([body], { type: "application/x-rdp" });
|
||||
const safe = v.host.replace(/[^\w.-]+/g, "_");
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = `${safe}.rdp`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
a.remove();
|
||||
setTimeout(() => URL.revokeObjectURL(url), 2000);
|
||||
|
||||
// Also hit server endpoint (same content) for clients that prefer navigation
|
||||
if (autoOpen) {
|
||||
const api = `/api/rdp.rdp?host=${encodeURIComponent(v.host)}&port=${v.port}&username=${encodeURIComponent(v.username || "")}`;
|
||||
// secondary attempt via hidden iframe — helps some browsers associate .rdp
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.style.display = "none";
|
||||
iframe.src = api;
|
||||
document.body.appendChild(iframe);
|
||||
setTimeout(() => iframe.remove(), 4000);
|
||||
}
|
||||
setStatus(`RDP file ready for ${v.host}:${v.port} — open it with your Remote Desktop client.`, "ok");
|
||||
}
|
||||
|
||||
document.getElementById("rdp-form").addEventListener("submit", (e) => {
|
||||
e.preventDefault();
|
||||
downloadRdp(true);
|
||||
});
|
||||
document.getElementById("rdp-download").addEventListener("click", () => downloadRdp(false));
|
||||
document.getElementById("rdp-copy").addEventListener("click", async () => {
|
||||
const v = vals();
|
||||
if (!v.host) return;
|
||||
const text = `${v.host}:${v.port || 3389}`;
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
setStatus(`Copied ${text}`, "ok");
|
||||
} catch (_) {
|
||||
setStatus("Copy failed", "error");
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
const u = document.getElementById("rdp-user");
|
||||
if (u && !u.value) u.focus();
|
||||
else document.getElementById("rdp-host")?.focus();
|
||||
}, 40);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user