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

Add access list notifications support to new notifications list #41662

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

rudream
Copy link
Contributor

@rudream rudream commented May 16, 2024

Purpose

Part of #37704

e counterpart: https://github.com/gravitational/teleport.e/pull/4221

This PR adds access list notifications support to the new notifications list in the WebUI.

Implementation

The frontend currently supports access list notifications by fetching access lists on init, and then running some logic to determine whether any of them need to be reviewed soon, and then if so, creating client-side notifications and adding them to a notificationsStore which the topbar notifications pane reads from.

With the new notifications system, notifications are generated and stored in the backend, but this isn't feasible for access list notifications because the system doesn't support scheduling notifications for a specific time. The workaround implemented in this PR uses the existing frontend method for showing access list notifications, and adapts it to the new notifications list.

When "real" notifications are fetched from the backend and shown in the UI list, the notifications component will also read from the notificationsStore and prepend any access list notifications to the final list of notifications. This only ever needs to be done on the first fetch.

It is also possible to mark these access list notifications as clicked or hide them, as is the behaviour for the other "real" notifications, these states are kept in localStorage.

This PR also includes some improvements to the way updating notification states is done in the frontend.

Demo

access.list.notifications.mov

@rudream rudream added the no-changelog Indicates that a PR does not require a changelog entry label May 16, 2024
@rudream rudream requested review from avatus and removed request for ibeckermayer May 16, 2024 18:45
@rudream rudream requested a review from avatus May 17, 2024 11:14
Copy link
Contributor

@kimlisa kimlisa left a comment

Choose a reason for hiding this comment

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

out of curiosity, was it intentional that the dropdown doesn't close after clicking on a notification?

web/packages/teleport/src/Notifications/Notification.tsx Outdated Show resolved Hide resolved
web/packages/teleport/src/services/notifications/types.ts Outdated Show resolved Hide resolved
web/packages/teleport/src/services/notifications/types.ts Outdated Show resolved Hide resolved
web/packages/teleport/src/stores/storeNotifications.ts Outdated Show resolved Hide resolved
web/packages/teleport/src/TopBar/TopBar.test.tsx Outdated Show resolved Hide resolved
web/packages/teleport/src/Notifications/Notifications.tsx Outdated Show resolved Hide resolved
@rudream rudream force-pushed the yassine/notifications/access-requests branch 2 times, most recently from cba98ac to 6605d07 Compare May 21, 2024 21:34
@rudream rudream force-pushed the yassine/notifications/access-lists branch from b0e6ebe to 15a13b6 Compare May 22, 2024 01:25
@rudream rudream force-pushed the yassine/notifications/access-requests branch from 6605d07 to 1f53170 Compare May 22, 2024 01:50
@rudream rudream force-pushed the yassine/notifications/access-lists branch from 15a13b6 to f425c2b Compare May 22, 2024 01:55
@rudream rudream requested a review from kimlisa May 22, 2024 01:55
@rudream
Copy link
Contributor Author

rudream commented May 22, 2024

@avatus @kimlisa FYI this now as an e counterpart with a couple minor accompanying changes: https://github.com/gravitational/teleport.e/pull/4221

Base automatically changed from yassine/notifications/access-requests to master May 22, 2024 13:55
@rudream rudream force-pushed the yassine/notifications/access-lists branch from f425c2b to 8df84fc Compare May 22, 2024 17:54
@rudream rudream force-pushed the yassine/notifications/access-lists branch from 8df84fc to 6c9e501 Compare May 29, 2024 21:15
@rudream rudream requested a review from kimlisa June 3, 2024 23:52
Copy link
Contributor

@kimlisa kimlisa left a comment

Choose a reason for hiding this comment

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

great stuff, thanks for resolving all issues!

LGTM after addressing some minor issues

web/packages/shared/utils/assertUnreachable.ts Outdated Show resolved Hide resolved
web/packages/teleport/src/Notifications/Notifications.tsx Outdated Show resolved Hide resolved
web/packages/teleport/src/Notifications/Notifications.tsx Outdated Show resolved Hide resolved
@rudream rudream force-pushed the yassine/notifications/access-lists branch from 233c795 to a5f51e8 Compare June 4, 2024 18:06
@rudream rudream force-pushed the yassine/notifications/access-lists branch from a5f51e8 to 54b1b4a Compare June 4, 2024 23:14
@rudream rudream enabled auto-merge June 5, 2024 18:30
@rudream rudream added this pull request to the merge queue Jun 5, 2024
Merged via the queue into master with commit c449154 Jun 5, 2024
38 checks passed
@rudream rudream deleted the yassine/notifications/access-lists branch June 5, 2024 18:42
@public-teleport-github-review-bot

@rudream See the table below for backport results.

Branch Result
branch/v16 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v16 no-changelog Indicates that a PR does not require a changelog entry size/md ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants