Skip to content
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

✨ [#108] Admin action to check Abonnement callback status #186

Merged
merged 3 commits into from
Oct 7, 2024

Conversation

stevenbal
Copy link
Contributor

@stevenbal stevenbal commented Aug 30, 2024

fixes #108

Changes:

  • Add django-lor config and logs to admin index fixture
  • Admin action to check Abonnement callback status with a custom button to run this action for all Abonnementen

Copy link
Contributor

@Coperh Coperh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, works for me

Copy link
Contributor

@annashamray annashamray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for me, but I'm afraid that if there are a lot of subscribers the admin page would be loading for a while
Perhaps we should only show it in the detail view?
What do you think?

@stevenbal
Copy link
Contributor Author

@annashamray hmm that's right, though if it's on the detail view, it isn't really convenient if you want to check multiple subscriptions, because you'd have to open every detail page. Maybe there should be a button/action to trigger it?

Also come to think of it, I'm not sure if the Abonnementen page is the right place for this, shouldn't it be the Webhook subscriptions?

@stevenbal stevenbal marked this pull request as draft October 3, 2024 09:16
@stevenbal stevenbal force-pushed the feature/108-abonnement-admin-callback-url-reachable branch 3 times, most recently from 2238c16 to 223bfde Compare October 4, 2024 09:23
@stevenbal stevenbal changed the title ✨ [#108] Show if Abonnement callback URL can be reached in admin ✨ [#108] Admin action to check Abonnement callback status Oct 4, 2024
@stevenbal stevenbal marked this pull request as ready for review October 4, 2024 09:24
@stevenbal stevenbal requested a review from annashamray October 4, 2024 09:25
@stevenbal
Copy link
Contributor Author

@annashamray I've changed it to a custom admin action with a shortcut button to trigger it for all Subscriptions. I've also added a filter on the result to make it easier to check which status checks failed

HLgKUY3b67

@stevenbal stevenbal requested a review from Coperh October 4, 2024 09:31
Copy link
Contributor

@Coperh Coperh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this too works for me

Copy link
Contributor

@annashamray annashamray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and neat! I have very minor comments, which are not critical, so approved

src/nrc/datamodel/admin.py Show resolved Hide resolved
src/nrc/datamodel/admin.py Outdated Show resolved Hide resolved
self._request = request
return super().changelist_view(request, extra_context=extra_context)

def check_all_callback_urls(self, request):
Copy link
Contributor

@annashamray annashamray Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbh I think having both action and button is a little excessive. When you select objects for the action you can select everything (even if the number of objects is more than 100), which defeats the purpose of the button in my eyes
But it's up to you, so treat this comment as optional

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the button to make it a bit more visible and easy for admins, since Alex mentioned that the existence of these kinds of actions is not always clear right away: #108 (comment).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation!


Any subsequent executions of this action will remove the previous results from the session
"""
validator = CallbackURLValidator("callback_url", "auth")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice reusage of the existing validator

@stevenbal stevenbal force-pushed the feature/108-abonnement-admin-callback-url-reachable branch from 223bfde to 484897f Compare October 4, 2024 15:12
@stevenbal stevenbal merged commit 1e5d0c6 into main Oct 7, 2024
15 checks passed
@stevenbal stevenbal deleted the feature/108-abonnement-admin-callback-url-reachable branch October 7, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Abonnementen admin: show if the callback URL can be reached
3 participants