-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add feedback notification for feed sync (#4120)
* ADD: notification when feed is syncing * add test
- Loading branch information
1 parent
07f468f
commit 49657d7
Showing
26 changed files
with
805 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/web/components/notification/FeedSyncNotification/FeedSyncNotification.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* SPDX-FileCopyrightText: 2024 Greenbone AG | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import InfoPanel from 'web/components/panel/infopanel'; | ||
import BlankLink from 'web/components/link/blanklink'; | ||
import useTranslation from 'web/hooks/useTranslation'; | ||
import styled from 'styled-components'; | ||
|
||
import { | ||
useFeedSyncStatus, | ||
useFeedSyncDialog, | ||
} from 'web/components/notification/FeedSyncNotification/helpers'; | ||
|
||
const NotificationWrapper = styled.div` | ||
padding-bottom: 20px; | ||
`; | ||
|
||
const FeedSyncNotification = () => { | ||
const [_] = useTranslation(); | ||
useFeedSyncStatus(); | ||
|
||
const [isFeedSyncDialogOpened, setIsFeedSyncDialogOpened, feedStatus] = | ||
useFeedSyncDialog(); | ||
|
||
const handleCloseFeedSyncNotification = () => { | ||
setIsFeedSyncDialogOpened(false); | ||
}; | ||
|
||
if (!isFeedSyncDialogOpened) return null; | ||
|
||
return ( | ||
<NotificationWrapper> | ||
<InfoPanel | ||
heading={ | ||
feedStatus.error | ||
? _('Error fetching the feed') | ||
: _('Feed is currently syncing.') | ||
} | ||
isWarning={Boolean(feedStatus.error)} | ||
onCloseClick={handleCloseFeedSyncNotification} | ||
> | ||
{feedStatus.error ? ( | ||
<p> | ||
{_( | ||
`There was an error fetching the feed. It will be retried in a few minutes.`, | ||
)} | ||
</p> | ||
) : ( | ||
<p> | ||
{_( | ||
`Please wait while the feed is syncing. Scans are not available during this time. For more information, visit the`, | ||
)}{' '} | ||
<BlankLink | ||
to={ | ||
'https://docs.greenbone.net/GSM-Manual/gos-21.04/en/scanning.html?highlight=scan' | ||
} | ||
> | ||
{_('Documentation')}. | ||
</BlankLink> | ||
</p> | ||
)} | ||
</InfoPanel> | ||
</NotificationWrapper> | ||
); | ||
}; | ||
|
||
export default FeedSyncNotification; |
Oops, something went wrong.