Network VM spacing fix

This commit is contained in:
headlessdev 2025-04-18 23:57:10 +02:00
parent f2535cd2b9
commit f1c0cc9deb

View File

@ -45,13 +45,15 @@ const NODE_WIDTH = 220;
const NODE_HEIGHT = 60; const NODE_HEIGHT = 60;
const APP_NODE_WIDTH = 160; const APP_NODE_WIDTH = 160;
const APP_NODE_HEIGHT = 40; const APP_NODE_HEIGHT = 40;
const HORIZONTAL_SPACING = 400; const HORIZONTAL_SPACING = 800; // Stark erhöht für mehr Hauptabstand
const VERTICAL_SPACING = 100; const VERTICAL_SPACING = 150; // Vergrößerter Basisabstand
const START_Y = 120; const START_Y = 120;
const ROOT_NODE_WIDTH = 300; const ROOT_NODE_WIDTH = 300;
const CONTAINER_PADDING = 40; const CONTAINER_PADDING = 40;
const COLUMN_SPACING = 200; const COLUMN_SPACING = 300; // Vergrößerter Seitenabstand
const VM_APP_SPACING = 200; const VM_APP_SPACING = 250; // Vergrößerter App-Abstand
const MIN_VM_SPACING = 10; // Mindestabstand auch bei leeren VMs
const APP_ROW_SPACING = 30; // Abstand zwischen App-Nodes
export async function GET() { export async function GET() {
try { try {
@ -68,8 +70,8 @@ export async function GET() {
const serverNodes: Node[] = servers const serverNodes: Node[] = servers
.filter(server => !server.hostServer) .filter(server => !server.hostServer)
.map((server, index, filteredServers) => { .map((server, index, filteredServers) => {
const xPos = const xPos =
index * HORIZONTAL_SPACING - index * HORIZONTAL_SPACING -
((filteredServers.length - 1) * HORIZONTAL_SPACING) / 2; ((filteredServers.length - 1) * HORIZONTAL_SPACING) / 2;
return { return {
@ -167,7 +169,14 @@ export async function GET() {
}); });
// Dynamischer Abstand basierend auf Anzahl Apps // Dynamischer Abstand basierend auf Anzahl Apps
currentY += appCount * (APP_NODE_HEIGHT + 20) + 40; // 40px Basisabstand const requiredSpace = appCount > 0
? (appCount * (APP_NODE_HEIGHT + APP_ROW_SPACING))
: 0;
currentY += Math.max(
requiredSpace + MIN_VM_SPACING,
MIN_VM_SPACING + APP_NODE_HEIGHT
);
}); });
} }
}); });