Fix notifications ICSHWI-8815
This is a merge request to fix the infinite loop described in ICSHWI-8815. Please see discussion in that issue.
Currently this merge request can't be fully tested/work for commands due to the problems described in ICSHWI-9003 about our broken webhook.
Here's what the merge request does:
- Adds AWX job polling to notifications as a temporary workaround for the original bug described in ICSHWI-8815
- Remove loops/queries/polling for deployments, commands and jobs from
NotificationsProvider
and perform them in dedicated child componentsDeploymentWatcher
,CommandWatcher
, andAWXJobWatcher
which watch a single id at a time. - Introduced
useSafePolling
hook so the watchers do not issue a new query before the previous query has returned. - Fix the context value for
NotificationsProvider
to provide the notifications as state - Memoize context value to not rerender the consumers every time the NotificationProvider renders
- Updates consumers of NotificationProvider to use
notifications
state instead of accessing local storage. - Refactors code for notifications into
Notifications.js
for the context,Storage.js
for local storage operations, andWatchers.js
for components responsible for polling
Edited by John Sparger