Files
Netbox/topology/render_host.html
T
dcstephenson b6151b7de5 Add port labels, modernize patch panels, add a real PNG preview
- export_topology.py: edges now carry the exact port name on both ends
  (pulled directly from Cable/CableTermination, not inferred from the
  trace chain), so the diagram can label each connector.
- generate_drawio.py: patch panels are now a small rack-unit shape
  (header strip + port ticks, parented to the panel body so they move
  together) instead of a plain box; connectors show 'porta <-> portb'
  and no longer carry a directional arrowhead (these are physical
  cables, not directed links); switches keep the network-switch icon.
- render_png.js + render_host.html: headless Puppeteer driver for
  embed.diagrams.net's postMessage export protocol -- an actual
  render of the .drawio file, not an approximation. Field-Switch-
  Topology.png is the committed output, for anyone who wants a look
  without opening draw.io.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NM3nivbufxEWiKKmatEtEe
2026-09-15 13:03:18 -05:00

25 lines
976 B
HTML

<!doctype html>
<html><body style="margin:0">
<iframe id="f" src="https://embed.diagrams.net/?proto=json&spin=1&embed=1&libraries=1&noSaveBtn=1"
style="width:1600px;height:1200px;border:0"></iframe>
<script>
window.__RESULT__ = null;
window.__ERR__ = null;
const iframe = document.getElementById('f');
window.addEventListener('message', (evt) => {
let msg;
try { msg = JSON.parse(evt.data); } catch (e) { return; }
console.log('HOST EVENT:', msg.event);
if (msg.event === 'init') {
iframe.contentWindow.postMessage(JSON.stringify({ action: 'load', xml: window.__XML__, autosave: 0 }), '*');
} else if (msg.event === 'load') {
iframe.contentWindow.postMessage(JSON.stringify({ action: 'export', format: 'xmlpng', xml: window.__XML__, border: 24, scale: 2 }), '*');
} else if (msg.event === 'export') {
window.__RESULT__ = msg.data;
} else if (msg.event === 'error') {
window.__ERR__ = JSON.stringify(msg);
}
});
</script>
</body></html>