Separate backups and network on the info screen
Put backups and network in their own bordered sections titled "Backups" and "Network". Inside Network, the configured settings and the addresses in use are labelled "Configured" and "In use". The "unavailable" note is hidden when it is empty, so it no longer leaves a blank line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit was merged in pull request #5.
This commit is contained in:
1 parent
5038148686
commit
62490af913
2 files changed
+43
-8
No files matched your search
+24
-8
@@ -334,7 +334,15 @@ class InfoScreen(ModalScreen):
|
||||
("n", "net", "Edit network"),
|
||||
("u", "undo", "Undo network"),
|
||||
]
|
||||
DEFAULT_CSS = "InfoScreen DataTable { height: auto; max-height: 12; }"
|
||||
DEFAULT_CSS = """
|
||||
InfoScreen DataTable { height: auto; max-height: 12; }
|
||||
InfoScreen .section {
|
||||
height: auto; border: round $accent; border-title-style: bold;
|
||||
padding: 0 1; margin-bottom: 1;
|
||||
}
|
||||
InfoScreen .label { text-style: bold; margin-top: 1; }
|
||||
InfoScreen .label.first { margin-top: 0; }
|
||||
"""
|
||||
|
||||
def __init__(self, guest: dict) -> None:
|
||||
super().__init__()
|
||||
@@ -349,12 +357,18 @@ class InfoScreen(ModalScreen):
|
||||
def compose(self) -> ComposeResult:
|
||||
with Vertical():
|
||||
yield Static(f"{self.guest['name']} ({self.guest['vmid']})", markup=False)
|
||||
yield Static("", id="jobs", markup=False)
|
||||
yield DataTable(id="backups")
|
||||
yield Static("", id="hidden", markup=False)
|
||||
yield DataTable(id="nets")
|
||||
yield Static("", id="unavailable", markup=False)
|
||||
yield DataTable(id="addresses")
|
||||
with Vertical(id="backup_section", classes="section") as backup:
|
||||
backup.border_title = "Backups"
|
||||
yield Static("", id="jobs", markup=False)
|
||||
yield DataTable(id="backups")
|
||||
yield Static("", id="hidden", markup=False)
|
||||
with Vertical(id="network_section", classes="section") as network:
|
||||
network.border_title = "Network"
|
||||
yield Static("Configured", classes="label first")
|
||||
yield DataTable(id="nets")
|
||||
yield Static("In use", classes="label")
|
||||
yield Static("", id="unavailable", markup=False)
|
||||
yield DataTable(id="addresses")
|
||||
yield Footer()
|
||||
|
||||
def on_mount(self) -> None:
|
||||
@@ -442,7 +456,9 @@ class InfoScreen(ModalScreen):
|
||||
ip.get("ip6", "-"),
|
||||
"yes" if net.get("firewall") == "1" else "no",
|
||||
)
|
||||
self.query_one("#unavailable", Static).update(unavailable)
|
||||
note = self.query_one("#unavailable", Static)
|
||||
note.update(unavailable)
|
||||
note.display = bool(unavailable) # no empty line when the addresses are known
|
||||
table = self.query_one("#addresses", DataTable).clear()
|
||||
for i in addresses:
|
||||
table.add_row(
|
||||
|
||||
Reference in new issue
Block a user