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

Invite panel #400

Merged
merged 19 commits into from
May 13, 2024
Merged

Invite panel #400

merged 19 commits into from
May 13, 2024

Conversation

devmount
Copy link
Collaborator

@devmount devmount commented May 8, 2024

Description of the Change

This change introduces admin only views. Those are currently protected by a dependency checking, if the current users email address is whitelisted in a .env var APP_ADMIN_ALLOW_LIST (comma separated list of email addresses).

New route /admin/invites:
image

Invite codes list is paginated, filterable, and codes can be bulk generated, copied and revoked.

New route /admin/subscribers:
Untitled

For now, subscribers can only be listed. Showing invite status and disabling them is still todo.

Benefits

Administration tools for quick management of invites and subscribers.

Applicable Issues

Closes #362

@devmount devmount requested a review from MelissaAutumn May 8, 2024 20:43
@devmount devmount self-assigned this May 8, 2024
@MelissaAutumn
Copy link
Member

I'll fix up the PR with any changes needed!

@MelissaAutumn MelissaAutumn force-pushed the features/362-invite-panel branch from 6028d8f to 6124ec7 Compare May 8, 2024 21:02
@MelissaAutumn MelissaAutumn mentioned this pull request May 8, 2024
Co-authored-by: Andreas Müller <[email protected]>
@MelissaAutumn MelissaAutumn force-pushed the features/362-invite-panel branch from a5df424 to 4d15cb0 Compare May 8, 2024 21:28
@MelissaAutumn
Copy link
Member

I accidentally rebased this on my old changes, so I had to go through and download / apply patch files from the now headless remote. It should be fixed now, if not a little out of order.

Apologies!

@MelissaAutumn MelissaAutumn force-pushed the features/362-invite-panel branch from 4bc31ef to 74fe883 Compare May 10, 2024 20:10
@MelissaAutumn
Copy link
Member

Idea pivot! Have a subscriber panel with a invite input at the footer. This invite function will create the subscriber and email them about Appointment.

I wrote a generic data table component that takes in structured data and displays it. There's some extra functionality I decided to cut for now, but are still implemented in the data table. I'm sure there's an easier way to do filtering than keeping the source list and a filtered version but I cannot think of a good way to do it right now.

If someone could pretty-ify the placement of the data filters that would be great 😅

image

@router.post("/permission-check")
def permission_check(_: Subscriber = Depends(get_admin_subscriber)):
"""Checks if they have admin permissions"""
return True
Copy link
Member

Choose a reason for hiding this comment

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

The check is done in get_admin_subscriber, and will error out. FastAPI has a weird relationship with using DI over middleware...

@MelissaAutumn
Copy link
Member

Additionally all admin checks will fail if APP_ADMIN_ALLOW_LIST is empty.

@MelissaAutumn MelissaAutumn self-assigned this May 10, 2024
@devmount
Copy link
Collaborator Author

No worries about the rebase, everything looks fine now. Sorry you had some additional effort because of that.

The new subscriber panel is nice, also simplifies things for not having different admin pages for now. I fixed up some alignment and set the horizontal overflow scrollbar to auto (as for some systems, the scrollbar would be always visible with "scroll" 🙈 ). Also updated the language files (my IDE sorted the JSON keys, sorry about that 😇 ).

So looking fine now! Idea for the data filters: We could integrate them into the table header beneath the column label. But I think it's also fine to have them above the table 🤷🏻

@MelissaAutumn MelissaAutumn merged commit 93e63ea into main May 13, 2024
2 checks passed
@MelissaAutumn MelissaAutumn deleted the features/362-invite-panel branch May 13, 2024 16:24
@MelissaAutumn
Copy link
Member

Thank you! Also thank you for re-sorting the language files as always!

jdbass pushed a commit that referenced this pull request May 17, 2024
* Add wip invite panel

* ➕ Add admin subscribers list

* ➕ Add pagination and code revokal for invite codes

* ➕ Add copy button and move table styles

* ➕ Reordered vars and added admin allow list to env

* ➕ Add admin dependency for admin invite routes

* Daisy chain get_admin_subscriber off of get_subscriber, and adjust how we check for admin emails

* Add an invite email and new route that creates a subscriber and emails them!

* Allow a non-allow listed user to login if they already have an account.

* Fix tests

* Added data table

Added sending invitation

Added data table filters

* Fix up fieldClick event, and hide the disable button for now.

* Remove the now unneeded invite panel (sorry buddy, you were a good first draft!)

* Pagination fixes, and send on enter

* Hook up the secret to aws

* Add some more tests

* Add some basic responsiveness

* 💚 Fix alignment, indentation and scrollbar

* 🌐 Update German lang strings

---------

Co-authored-by: Melissa Autumn <[email protected]>
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.

Build out mini-admin panel
2 participants