Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Notifications): new notifications FE plugin, API and backend (#933)
* draft Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * feat(parodos-notifications): parodos plugin for notifications * chore(parodos-notifications): add plugin metadata * Add Parodos to the left-side menu * Add ParodosNotificationsTable * Remove page header * Rename plugin to @backstage/plugin-parodos-notifications * Fix types in myplugin-backend * Hotfix Knex type * chore(parodos-notifications): Add tsconfig and turbo to the backend plugin * Fix typo in constants * Add DB mock for backend tests * Read notifications from backend * Add rxjs dependency * First Notifaction API with Observable * Rename backend plugin to notifications-backend * Reimplement the Notifications to use tabs * Fix endless "loading" state for an empty notifications list * Rename front-end plugin to notifications-frontend * Add coverage and passWithNoTests to notifications-frontend * filter paging users first version of our implementation it shows: - plugin independent of DB - text filtering - paging - users and groups validation Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * fix flpath-659 catch DB errors in router handlers https://issues.redhat.com/browse/FLPATH-659 Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * Add patternfly/react-core among dependencies * Remove rxjs dependency * Add new fields to the UI - UUID - Created - Title - Origin - Message - Topic - Links * Rename System notifications tab * Use Item instead of Group for the left-side menu * Mark "unread" notifications in the left-side menu * Update README to match recent endpoints * Add default sorting * Add pagination * Remove TODO * FLPATH-661: Add notification actions Closes FLPATH-661 Closes FLPATH-662 * Make the actions.title mandatory * BE- implement posting to users and groups FLPATH-665 https://issues.redhat.com/browse/FLPATH-665 Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * FLPATH-670: Add filtering by text * Remove unused code - FE notificationsService.ts * Add @material-table/core among dependencies * FLPATH-671: Add Created After filter * FLPATH-671: Add Created After selection * FLPATH-668: Add sorting * Add stub for passing users To unblock due to conflicts now - will be done properly in a follow-up. * Move sorting params validation to handler * Polling in NotificationsSidebarItem can be configured * FLPATH-675: Show system-wide notifications in the Updates tab * FLPATH-675: Show system-wide alerts * update README Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * Simplify BE cehck for orderBy * Avoid using Patternfly in the Notifications * Add react-router-dom to notifications-frontend * Implement creating of notifications * Add a page to create notifications Implemented as a tab on the NotificationsPage. The new tab is not displayed by default, only when directly navigated by the URL ([BACKSTAGE]/notifications/send). Meant for demonstration and debug purposes since the notifications are expected to be send by 3rd party FE/BE plugins or external systems. * BE - implement mark as read flpath-666 https://issues.redhat.com/browse/FLPATH-666 Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * FLPATH-664: Implement Mark as Read on FE * FLPATH-663: Pass logged-in user name to the backend * Add defaut/guest user to the Catalog Within example data. * Update README for authentication section * FLPATH-667: Add notifications-common library * Add more descriptions * Fix package.json after rebase * Sync dependencies with main * add defaults for GET requests FLPATH-669 https://issues.redhat.com/browse/FLPATH-669 Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * add indexes to db columns flpath727 https://issues.redhat.com/browse/FLPATH-727 Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * FLPATH-738: render actions horizontally * FLPATH-738: use a dropdown for the Unread filter * FLPATH-738: Change "mark as read" icons * openapi yaml for rest api FLPATH-748 https://issues.redhat.com/browse/FLPATH-748 Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * create DB client in BE that supports all Knex configuration flpath-660 https://issues.redhat.com/browse/FLPATH-660 Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * add cascade to foreign key in actions table Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * Add debouncing to the search filter * add date-time format to time fields Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * Make 'count' required in response * Fix required action fields in the OpenApi spec * Add openapi client generator to the notifications-frontend * Regenerate openapi client in the frontend * Remove notifications-common from FE dependencies We do not need it anymore since we have the generated types from OpenApi. * Update frontend to use generated openapi calls * Add ts-nocheck to generated OpenApi code * Regenerate openapi * remove notifications-common FLPATH-755 https://issues.redhat.com/browse/FLPATH-755 Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * Notifications-frontend install instructions and deregister The plugin is removed from the Backstage * Notifications-backend install instructions and deregister The plugin is removed from the Backstage * create router in BE based on openapi spec FLPATH756 https://issues.redhat.com/browse/FLPATH-756 Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * fix getNotificationsCount to return type number Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * support sqllite and other DBs FLPATH-811 https://issues.redhat.com/browse/FLPATH-811 Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * FLPATH-809: get the user via Identity API With this patch, the username is not passed from FE to BE anymore but retrieved from via Identity API as the logged-in user. * chore(notifications-backend): add permissions related deps * chore: update README for authentication * chore: make service-to-service checks optional * chore: reduce notifications "read" permissions count * chore: separate getLoggedInUser and checkPermission funcs * Introduce auth.ts and shared secret for external callers * chore: update README for SQLite * add unit test to BE FLPATH-798 https://issues.redhat.com/browse/FLPATH-798 Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> * chore: docs linter * chore: use default/guest for external calls Authentication of external systems is not stable anyway, so using the default/guest for them will simplify testing. * chore: fix handling of promises in tests * chore: remove forgotten router-test-ts * chore: update yarn.lock after rebase * chore: add --coverage to tests to pass the CI * chore: hotfix for types mismatch for KNex MockClient * chore: unify dep versions in notifications-backend --------- Signed-off-by: Yaron Dayagi <ydayagi@redhat.com> Co-authored-by: Yaron Dayagi <ydayagi@redhat.com>
- Loading branch information