-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Adding Update on ajax feature #1577
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
Conversation
I like this a lot. The two things I'd advocate for are:
The more I think about how @matthiask opinions? |
Couple of changes here:
I agree with your logic for the form signing, so if I don't hear anything to the contrary I'll pull it out next |
Could you open that up in a new PR if you don't mind? It'll help keep this easy to review and our discussions limited. |
PR opened - I think if that one goes through the final change I'd like to propose to this PR is adding an "include historical data" option to the history form, defaulting it to true, updating the history panels' forms to pass false and remove the two frontend delete statements. That way the old tests will continue to pass without being updated and I look into new tests for the new behavior. |
a8ab15e
to
614369c
Compare
I think this is in a state ready for final review - let me know if there's any more tests/documentation that you'd like added |
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 tested the code, but it looks good to me.
Maybe a few inputs
- We mostly use the
djdt
prefix, this may be better thanDJ-TOOLBAR-*
as a header - I think using
response.headers[key] = value
is a bit clearer thanresponse[key] = value
for setting headers, but that's a matter of taste - I'd call the boolean field
do_not_include_history
(no abbreviations) or maybeinclude_history
while flipping the default value of the field? (but that's bikeshedding) - I'm unsure about the
OBSERVE_REQUEST_CALLBACK
name. It doesn't immediately communicate that this is about whether the toolbar should automatically update or not. Naming is hard and I don't have a better idea though.
should_observe_ajax_callback ? update_on_ajax_callback ? |
I thought about So I now think observing is fine :) |
Alright I think I got the changes in - for include_history vs do_not_include_history - I agree that using the positive case is normally better, but if I do that then the javascript needs to include the value. I think it's simpler to let the JS not care about it because we don't have to specify in the dj template As for the name - happy to do whatever if people have strong feelings :) |
@matthiask can you review the latest version of this and see if you have any qualms? @gone I rearranged things after taking a longer look. Let me know if there are any issues. |
Tests pass on my end - this is much clearer. Potentially in get headers the dict could replaced with a default dict to shave off the if check, but then it would always do string concatenation and would be slower. |
I like that approach
…On Sat, Feb 19, 2022, 11:13 AM Ben Beecher ***@***.***> wrote:
Tests pass on my end - this is much clearer. Potentially in get headers
the dict could replaced with a default dict to shave off the if check, but
then it would always do string concatenation and would be slower.
—
Reply to this email directly, view it on GitHub
<#1577 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJYZPY4ORZ6ULWMQ3A5VG3U37FUPANCNFSM5MDMMTIQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Tried an implementation and threw it away - you still end up needing to look at the old value to know if you should include the leading comma or not so it's just as long but slower :( |
ec5b1c7
to
bfaec84
Compare
This adds a feature to allow the toolbar to watch for ajax requests and automatically update debug information to show ajax details Adding debounce for pulling new panel info Adding heuristic function for observing requests Also adding generate_headers function Adding option to include historical data, remove signature Updated header name to match existing djdt namespace Move header value creation into the panels. This moves more logic into the Panel class and gives greater control to the Panel subclasses on how things should work. Move get_observe_request to DebugToolbar This avoids having to import the function within a panel. Rename do_not_include_history to exclude_history Add maxsize for lru_cache for python3.7 Clean up history.js documentation and remove unnecessary return.
bfaec84
to
f66a8d0
Compare
Squashed the commits and rebased on main. Cleaned up some things in |
Beat me to fixing the test by 2 min :) |
I added a view and JS to the example app to support testing this manually more easily in the future. Really nice work @gone! Thank you. |
This adds a feature to allow the toolbar to watch for ajax requests and automatically update debug information to show details from the ajax request.
Attempt at solving #1575