Repository navigation
Modernize mgr: ManagerController, unified console footer, link dialog validation - #41
Merged
Merged
Conversation
Remove run_in_container and set_on_interface, which duplicated the contact_player implementations, and import run_in_container from tools.contact_player.tc_netem instead. Remove unused expand_human_bitrates, get_netem_from_if and get_container_interfaces_parallel helpers. Parse tc qdisc output in-process instead of shelling out to grep, replace quit() with RuntimeError on host command failure, and add type annotations.
Move the module-level globals (network graph, link memory, time socket, modal dialog flag, timers) into a ManagerController class whose methods own the state and UI callbacks. Parse tc qdisc output into a typed Link dict (bandwidth, loss, delay, jitter with units) that is reused by the link dialog, and convert delay/jitter from s to ms before applying them. Guard draw_links with an asyncio lock instead of a boolean flag, use argparse for the CLI, and restore the shared graph state on startup before ui.run so all clients start from the same topology.
Container names came from docker compose (mgr) or viz.json (netviz) in arbitrary order, so the footer tab order differed between the two apps. Sort them in ConsoleFooter so both apps show the same deterministic order.
Add validators for bandwidth (tc rate syntax), loss (0-100) and delay/jitter (non-negative numbers) that highlight invalid fields in the link dialog while typing. Block Apply with a negative toast until all fields are valid. Wrap the set_on_interface calls of the link dialog and the link toggles so tc/docker failures are reported via notification instead of only ending up in the server log.
Guard dialog.clear() in show_link_dialog with is_deleted so cancelling the handler during shutdown no longer triggers the "element has been deleted" warning with its full stack trace. Catch KeyboardInterrupt around ui.run in mgr and netviz and print a short "Stopped." message so the CancelledError/KeyboardInterrupt chain no longer escapes main() uncaught.
Collaborator
Author
|
This change is part of the following stack: Change managed by git-spice. |
Replace the five try/except-pass blocks in attach_container_to_xterm with contextlib.suppress: writing keystrokes or a resize ioctl to an already-closed pty drops the event, and the cleanup close/kill/waitpid tolerate an already-closed, already-exited, or already-reaped child. contextlib.suppress makes this deliberate intent explicit and satisfies the code quality bot's empty-except-clause report.
Collaborator
Author
Collaborator
|
@copilot resolve the merge conflicts in this pull request |
# Conflicts: # tools/mgr/mgr.py # tools/netviz/netviz.py Co-authored-by: gh0st42 <1264131+gh0st42@users.noreply.github.com>
Contributor
Conflicts are resolved by merging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

AI generated summary:
Summary
Modernizes the mgr web UI, unifies the shared webui code between mgr and
netviz, and cleans up shutdown behavior.
Changes
Unified console footer (
tools/webui/console.py, new)ConsoleFooterused by both mgr and netviz: per-container terminals(xterm.js) and log viewers dockable at the bottom, with split view and
alphabetical, deterministic container ordering in both apps.
mgr refactor
helpers.py: droprun_in_container/set_on_interfaceduplicates in favorof
tools.contact_player.tc_netem.run_in_container; remove unused helpers;parse
tc qdiscoutput in-process instead of shelling out to grep.mgr.py: move module-level globals (network graph, link memory, time socket,modal-dialog flag, timers) into a
ManagerControllerclass; parse tc outputinto a typed
Linkdict (bandwidth, loss, delay, jitter with units) shared bythe link dialog; convert delay/jitter s→ms on apply; guard
draw_linkswithan asyncio lock; argparse CLI; restore shared graph state on startup before
ui.run.delay/jitter (non-negative) with inline highlighting; block Apply with a
negative toast on invalid input; surface tc/docker failures as notifications
instead of server-log-only.