-
Notifications
You must be signed in to change notification settings - Fork 3
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
Table refresh with ntie #87
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #87 +/- ##
=======================================
Coverage ? 48.34%
=======================================
Files ? 15
Lines ? 848
Branches ? 0
=======================================
Hits ? 410
Misses ? 438
Partials ? 0 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My, how much simpler this gets when zinolib can handle the updates :)
src/howitz/endpoints.py
Outdated
@@ -55,6 +55,9 @@ def auth_handler(username, password): | |||
current_app.logger.info('Authenticated in Zino %s', current_app.event_manager.is_authenticated) | |||
|
|||
if current_app.event_manager.is_authenticated: # is zino authenticated | |||
current_app.updater = UpdateHandler(current_app.event_manager) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't followed zinolib, but was this functionality recently added to zinolib? In that case, you might want to change the version requirement for the zinolib dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
fbd4369
to
30300a9
Compare
UpdateHandler returns only ids of events that have been changed, without differentiating between different types of changes (event removed, event added or event updated). For Howitz being able to differentiate which change occurred on event, info about currently known evenmts must be saved
30300a9
to
f32dbf3
Compare
eb6837e
to
e9e580b
Compare
e9e580b
to
9883d93
Compare
f21f250
to
ee909a3
Compare
Docd on sync startegies: https://htmx.org/attributes/hx-sync/ From the HTMX documentation on hx-sync I have gotten an erroneous notion that HTMX's "drop" strategy is by default set in the whole project. But apparently "drop" is the default only if you use "hx-sync" attribute and don't provide any strategy, ie 'hx-sync' attribute must be used on the tag in order for HTMX to start synchronizing requests on (and within) this tag. Synchronization is not a global config option in HTMX!
45e23b5
to
e157850
Compare
This will make the app perform one HTMX request at a time, yet queue all requests that occur during this request. Synchronizing is necessary when having NTIE refresh requested with intervals less than 30 seconds and meanwhile having other operations on events available to perform for users. Without any synchronizing in the app, if several HTMX requests update the page unexpected race conditions occur. It most often leads to none of the requests being completely finished, instead a heap of error alerts show up on the screen.
Co-authored-by: Morten Brekkevold <[email protected]>
e157850
to
dd22052
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check the functionality.
This needs a round of ruff or black. (My eyes hurt a bit.) We could do that for the entire codebase after this PR is in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have done som emanual testing. Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My nitpicks have been mostly fixed, but something seems off with the project requirements? @hmpf?
requirements-frozen.txt
Outdated
@@ -48,5 +48,5 @@ werkzeug==2.3.8 | |||
# flask | |||
# flask-login | |||
# howitz (pyproject.toml) | |||
zinolib==1.0.1 | |||
zinolib==1.0.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something is weird with this. pyproject.toml
says zinolib>=1.1.0
, so why is zinolib 1.0.4
in the frozen requirements list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we forgot to update it probably.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With zinolib==1.0.4
I can't even get Howitz to run, with 1.1.0
this NTIE PR seems to work just fine for me :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me :)
Closes #4
Depends on Uninett/zinolib#53, Uninett/zinolib#58
Implemented changes:
get_events()
endpoint with a much more efficient NTIE withUpdateHandler
. See Add server poll zinolib#53.hx-sync
. This is necessary when dealing with frequent requests toUpdateHandler
and meanwhile having users potentially updating some events themselves, or selecting/expanding table rows. Without the synchronization, swaps from the "competing" requests were not complete/pending indefinitely, and heap of error alerts showed up in the view.Not implemented/further work:
With the initial table refresh all table rows during refresh showed spinner indicator at the end of the row like so:
The thought for NTIE was to only show spinner on the rows that are about to be updated with NTIE (since NTIE updates are more targeted than a refresh of the whole table). Yet I decided to drop this idea and preserve current spinner implementation for following reasons:
Attention needed:
5
?