fix(ui): add machines back

This commit is contained in:
Aleksandr Tcitlionok
2024-12-06 04:00:02 +00:00
parent dd37967bf0
commit ebecb19602

View File

@@ -55,6 +55,54 @@ def convert_memory_to_gb(memory):
return float(memory)
# Display tables
def display_metal_nodes():
table = Table(title="🖥️ Metal Nodes", style="bold green")
table.add_column("ID", justify="right", style="cyan")
table.add_column("Name", style="magenta")
table.add_column("Location", style="white")
table.add_column("Vendor", style="green")
table.add_column("CPU", justify="right", style="yellow")
table.add_column("Memory (GB)", justify="right", style="cyan")
table.add_column("Storage", style="magenta")
nodes = fetch_all("metal_nodes")
for node in nodes:
table.add_row(
f"{node[0]}",
node[1],
node[2],
node[3],
f"{node[4]}",
node[5],
node[6]
)
console.print(table)
def display_virtual_machines():
table = Table(title="💻 Virtual Machines", style="bold blue")
table.add_column("ID", justify="right", style="cyan")
table.add_column("Name", style="magenta")
table.add_column("Location", style="white")
table.add_column("CPU", justify="right", style="yellow")
table.add_column("Memory (GB)", justify="right", style="cyan")
table.add_column("Storage", style="magenta")
table.add_column("Type", style="green")
vms = fetch_all("virtual_machines")
for vm in vms:
table.add_row(
f"{vm[0]}",
vm[1],
vm[2],
f"{vm[3]}",
vm[4],
vm[5],
vm[6]
)
console.print(table)
def display_kubernetes_nodes():
config.load_incluster_config()
v1 = client.CoreV1Api()