feat #14: Implement design guide #15
4 changed files with 25 additions and 19 deletions
|
|
@ -215,6 +215,14 @@ class HostsManagerApp(App):
|
|||
"DNS Name Entry", id="edit-dns-entry-radio"
|
||||
)
|
||||
|
||||
with Vertical(classes="default-section") as hostnames:
|
||||
hostnames.border_title = "Hostnames (comma-separated)"
|
||||
yield Input(
|
||||
placeholder="Enter hostnames",
|
||||
id="hostname-input",
|
||||
classes="default-input",
|
||||
)
|
||||
|
||||
with Vertical(
|
||||
classes="default-section", id="edit-ip-section"
|
||||
) as ip_address:
|
||||
|
|
@ -235,14 +243,6 @@ class HostsManagerApp(App):
|
|||
classes="default-input",
|
||||
)
|
||||
|
||||
with Vertical(classes="default-section") as hostnames:
|
||||
hostnames.border_title = "Hostnames (comma-separated)"
|
||||
yield Input(
|
||||
placeholder="Enter hostnames",
|
||||
id="hostname-input",
|
||||
classes="default-input",
|
||||
)
|
||||
|
||||
with Vertical(classes="default-section") as comment:
|
||||
comment.border_title = "Comment:"
|
||||
yield Input(
|
||||
|
|
|
|||
|
|
@ -425,9 +425,9 @@ class EditHandler:
|
|||
active_checkbox = self.app.query_one("#active-checkbox", Checkbox)
|
||||
|
||||
# Build field list based on current entry type
|
||||
fields = [radio_set]
|
||||
fields = [radio_set, hostname_input]
|
||||
|
||||
# Add IP or DNS field based on visibility
|
||||
# The address field follows Hostnames in the visual editor.
|
||||
try:
|
||||
ip_section = self.app.query_one("#edit-ip-section")
|
||||
if not ip_section.has_class("hidden"):
|
||||
|
|
@ -444,8 +444,7 @@ class EditHandler:
|
|||
except Exception:
|
||||
pass
|
||||
|
||||
# Add remaining fields
|
||||
fields.extend([hostname_input, comment_input, active_checkbox])
|
||||
fields.extend([comment_input, active_checkbox])
|
||||
|
||||
# Find currently focused field and move to next
|
||||
for i, field in enumerate(fields):
|
||||
|
|
@ -471,9 +470,9 @@ class EditHandler:
|
|||
active_checkbox = self.app.query_one("#active-checkbox", Checkbox)
|
||||
|
||||
# Build field list based on current entry type
|
||||
fields = [radio_set]
|
||||
fields = [radio_set, hostname_input]
|
||||
|
||||
# Add IP or DNS field based on visibility
|
||||
# The address field follows Hostnames in the visual editor.
|
||||
try:
|
||||
ip_section = self.app.query_one("#edit-ip-section")
|
||||
if not ip_section.has_class("hidden"):
|
||||
|
|
@ -490,8 +489,7 @@ class EditHandler:
|
|||
except Exception:
|
||||
pass
|
||||
|
||||
# Add remaining fields
|
||||
fields.extend([hostname_input, comment_input, active_checkbox])
|
||||
fields.extend([comment_input, active_checkbox])
|
||||
|
||||
# Find currently focused field and move to previous
|
||||
for i, field in enumerate(fields):
|
||||
|
|
|
|||
|
|
@ -132,6 +132,14 @@ HOSTS_MANAGER_CSS = (
|
|||
border: none;
|
||||
}
|
||||
|
||||
#filter-summary {
|
||||
width: auto;
|
||||
height: 1;
|
||||
padding: 0 1;
|
||||
content-align: right middle;
|
||||
color: $text-muted;
|
||||
}
|
||||
|
||||
.hosts-container {
|
||||
height: 1fr;
|
||||
margin-top: 0;
|
||||
|
|
|
|||
|
|
@ -168,8 +168,8 @@ class TableHandler:
|
|||
arrow = "↑" if self.app.sort_ascending else "↓"
|
||||
hostname_label = f"{arrow} Canonical Hostname"
|
||||
|
||||
# Add columns with proper labels (Active, IP, Hostname, DNS)
|
||||
table.add_columns(active_label, ip_label, hostname_label, dns_label)
|
||||
# Keep the canonical hostname beside state for fast table scanning.
|
||||
table.add_columns(active_label, hostname_label, ip_label, dns_label)
|
||||
|
||||
# Get visible entries (after filtering)
|
||||
visible_entries = self.get_visible_entries()
|
||||
|
|
@ -199,7 +199,7 @@ class TableHandler:
|
|||
active_text = Text("· Inactive", style="dim")
|
||||
ip_text = Text(entry.ip_address, style="dim")
|
||||
hostname_text = Text(canonical_hostname, style="dim")
|
||||
table.add_row(active_text, ip_text, hostname_text, dns_text)
|
||||
table.add_row(active_text, hostname_text, ip_text, dns_text)
|
||||
|
||||
def restore_cursor_position(self, previous_entry) -> None:
|
||||
"""Restore cursor position after reload, maintaining selection if possible."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue