-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add HistoryPanel to capture ajax requests. #1250
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1250 +/- ##
==========================================
+ Coverage 86.68% 86.71% +0.02%
==========================================
Files 25 29 +4
Lines 1442 1528 +86
Branches 207 215 +8
==========================================
+ Hits 1250 1325 +75
- Misses 140 148 +8
- Partials 52 55 +3
Continue to review full report at Codecov.
|
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 didn't try it out but went through the diff. Looks good!
If we think this is going to be merged, we'll need to do a major version bump. But before we do that, I'll want to go through the third party panels identified in the docs to at least identify if any will break. |
@tim-schilling Compatibility problems only really surface after a release, unfortunately. I think it would be alright to merge this and go ahead with it, maybe with an alpha/beta release (similar to 2.0a1) so that it is installable using But I certainly wouldn't want to push this without your approval or if there is anything you'd still like to check before. |
I have not forgotten about this, I've been busy with paid work and haven't had time for FOSS development. I will get back around to this though. |
This creates a new panel, HistoryPanel which makes use of the Toolbar.store to support a history of the toolbar as requests are made. The interface changes as follows: Panel.is_historical - Indicates that the panel's button and content should be updated when switching between snapshots of the history. Toolbar.store - Will no longer generate a new store_id when the instance already has a value. DEBUG_TOOLBAR_CONFIG.HISTORY_POST_TRUNC_LENGTH - Allows the request's POST content to be truncated in the history panel's content. LoggingPanel and StaticFilesPanel now utilize the ``get_stats`` method to fetch panel data for nav_subtitle. Credit to @djsutho for creating the original third party panel: https://github.com/djsutho/django-debug-toolbar-request-history The core concepts were derived from that package.
@matthiask This requires another review due to me making a few changes:
|
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.
This looks very good already, thank you!
docs/panels.rst
Outdated
History | ||
~~~~~~~ | ||
|
||
Path: ``debug_toolbar.panels.history.VersionsPanel`` |
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.
Typo? (VersionsPanel
)
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.
Yeah, copy paste error. Thanks for catching it.
sending to less secure functions. | ||
Not comprehensive | ||
|
||
Taken from django.contrib.auth.__init__.credentials |
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 was hoping there would be a way to use https://docs.djangoproject.com/en/3.1/ref/settings/#default-exception-reporter-filter for this. I didn't even know there was a setting for this, I assumed it was internal-only. I'd have referenced the setting earlier if I was aware that it existed at all.
(Also, maybe Django should use the SafeExceptionReporterFilter
instead of reimplementing parts of it in django.contrib.auth.)
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.
Ah, good call. I'll rework this to make use of that.
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'm thinking I need to remove this. The django implementation only uses it for debug cases which defeats the purpose of this.
@matthiask I'm curious about your v3.0 release plan. Would this be included or would it be smarter to do a 3.0 and then a |
@tim-schilling I think it might be worth it to do another alpha. Generally I don't worry too much about stability since mostly people aren't supposed to use django-debug-toolbar in production :-) It's enough work to create a release already, and I'd rather speed the release process up a bit. |
Sounds good. Let me know where I can help out. |
@tim-schilling I have just pushed 3.0a3 now, if you want to add a post in the forum that would be awesome. Thanks! |
@matthiask Thanks for the update! I'll do that this morning. |
@tim-schilling It may be worth it uploading another release; I fixed a crash which happened when using |
No, I doubt it's an edge-case if it was found that quickly. I agree it's worth to bump the version since it was caught and fixed. |
Alright, https://pypi.org/project/django-debug-toolbar/3.0a4/ is available on PyPI. |
Thanks, here's the forum post https://forum.djangoproject.com/t/django-debug-toolbar-alpha-release-v3/4250 |
This creates a new panel, HistoryPanel which makes use of the
Toolbar.store to support a history of the toolbar as requests are
made.
The interface changes as follows:
Panel.is_historical - Indicates that the panel's button and content
should be updated when switching between snapshots of the history.
Toolbar.store - Will no longer generate a new store_id when the
instance already has a value.
DEBUG_TOOLBAR_CONFIG.HISTORY_POST_TRUNC_LENGTH - Allows the request's
POST content to be truncated in the history panel's content.
LoggingPanel and StaticFilesPanel now utilize the
get_stats
methodto fetch panel data for nav_subtitle.
Credit to @djsutho for creating the original third party panel:
https://github.com/djsutho/django-debug-toolbar-request-history
The core concepts were derived from that package.
Closes #1066, #1032, #998.