-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First rudimentary version of the web UI #371
Merged
Merged
Conversation
This file contains 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
- This allows reusing the JSON outputs from the server in CLI scripts
- htmx does not allow disinheriting `hx-vals` attribute... :( (bigskysoftware/htmx#1119)
- Refactor and split out the "termui" and "webui" modules
- Refine output of task traces in termui
- The command functions in termui.commands must explicitly use `self._ui_loop.create_task()` instead of `asyncio.create_task()` to ensure it spawns the inner async command functions inside the UI event loop. - `invoke_command()` in the test suite is updated to correctly create and wait `command_done_event` inside the UI event loop, instead of the pytest's temporary event loop.
- We need to rewrite the docs entirely, though...
Closed
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.
What do these changes do?
This PR introduces a new subpackage
aiomonitor.webui
, which is an aiohttp-based web UI running side-by-side to the existing telnet UI.Given that most users of aiomonitor are backend developers, I chose htmx + mustache.js + Alpine.js + Tailwind CSS over modern frontend frameworks coming with complex state management using a large bundle of Javascript dependencies like React and Relay.
They are much simpler to understand (I learned how to use them in a day) and approachable from backend developers.
I also considered that the whole web UI stack should be runnable in offline (air-gapped) setups where we cannot access CDNs to fetch the javascript modules.
For this sake, the small size and self-contained single file distribution of htmx and Tailwind CSS are the perfect fit.
Kudos to @darjeeling for introducing htmx.
To share the core logic such as listing & inspect tasks and cancelling them, etc., I have refactored them as methods of the
Monitor
class while separating the presentation layer as the console (telnet) version and the web UI version.This PR also includes various fixes to prevent deadlocks and rewriting the cancel implementation to be async, which were updated while working on test suite adaptation.
HTTP APIs
Currently the task listing, counting, and cancellation operations are provided as REST-style APIs with JSON responses. The task trace log pages are served as rendered HTMLs but later we could expose it as JSON APIs.
You could check the full list of HTTP endpoints at the end of the
aiomonitor.webui.app
module, defined asaiohttp.web.Application
's routes.Sneak Peak (draft)
Are there changes in behavior for the user?
There should be no extra runtime overhead in the traced application.
Now we have a web-based inspection and debugging interface.
Related issue number
Checklist
CHANGES
folder<issue_id>.<type>
(e.g.588.bugfix
)issue_id
change it to the pr id after creating the PR.feature
: Signifying a new feature..bugfix
: Signifying a bug fix..doc
: Signifying a documentation improvement..removal
: Signifying a deprecation or removal of public API..misc
: A ticket has been closed, but it is not of interest to users.Fix issue with non-ascii contents in doctest text files.