-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Show alert if there are failed/pending deliveries #5403
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
Merged
Merged
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7474935
show alert if there are failed/pending deliveries
Cloud11PL eea1f00
i18n
Cloud11PL 93a4613
useMemo and booleans
Cloud11PL 18ade3f
get latest failed/pending event
Cloud11PL b54b6f7
check attempts
Cloud11PL f2d5143
add feature flag
Cloud11PL b1b9be9
cr fixes
Cloud11PL 098aff4
fix test
Cloud11PL 433420b
filter by thirdparty
Cloud11PL 379e926
hook refactor
Cloud11PL 651fab7
add missing test
Cloud11PL 6f272f3
generate flag
Cloud11PL be4f48b
generate flag
Cloud11PL 27f99b8
Merge branch 'main' into PROD-99-sidebar-apps-alert
Cloud11PL d20057f
Merge branch 'main' into PROD-99-sidebar-apps-alert
Cloud11PL 4db334c
extract colors
Cloud11PL 420dd0d
remove unused colors
Cloud11PL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,5 @@ | ||
| --- | ||
| "saleor-dashboard": patch | ||
| --- | ||
|
|
||
| "Apps" link in sidebar now shows an alert if one or more apps have failed or pending webhook deliveries. This means you can see if there are issues with your apps without having to enter app details. |
This file contains hidden or 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,11 @@ | ||
| --- | ||
| name: app_alerts | ||
| displayName: App alerts | ||
| enabled: false | ||
| payload: "default" | ||
| visible: false | ||
| --- | ||
|
|
||
|  | ||
| Experience new notifications displaying alerts for apps in the Dashboard. | ||
| Get meaningful information when Saleor detects issues with an app. |
This file contains hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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,56 @@ | ||
| import { AppSections } from "@dashboard/apps/urls"; | ||
| import { WARNING_ICON_COLOR, WARNING_ICON_COLOR_LIGHTER } from "@dashboard/colors"; | ||
| import { ExclamationIcon } from "@dashboard/icons/ExclamationIcon"; | ||
| import { ExclamationIconFilled } from "@dashboard/icons/ExclamationIconFilled"; | ||
| import { Box, Text, Tooltip } from "@saleor/macaw-ui-next"; | ||
| import React, { useState } from "react"; | ||
| import { FormattedMessage } from "react-intl"; | ||
| import { Link } from "react-router-dom"; | ||
|
|
||
| import { useAppsAlert } from "./useAppsAlert"; | ||
|
|
||
| const ExclamationIconComponent = () => { | ||
| const [isHovered, setIsHovered] = useState(false); | ||
|
|
||
| return ( | ||
| <Box | ||
| __color={isHovered ? WARNING_ICON_COLOR_LIGHTER : WARNING_ICON_COLOR} | ||
| __width={17} | ||
| __height={17} | ||
| onMouseEnter={() => setIsHovered(true)} | ||
| onMouseLeave={() => setIsHovered(false)} | ||
| > | ||
| {isHovered ? <ExclamationIconFilled /> : <ExclamationIcon />} | ||
| </Box> | ||
| ); | ||
| }; | ||
|
|
||
| export const SidebarAppAlert = () => { | ||
| const { hasFailedAttempts } = useAppsAlert(); | ||
|
|
||
| if (!hasFailedAttempts) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <Tooltip> | ||
| <Tooltip.Trigger> | ||
| <Link to={AppSections.appsSection}> | ||
| <ExclamationIconComponent /> | ||
| </Link> | ||
| </Tooltip.Trigger> | ||
|
|
||
| <Tooltip.Content align="start" side="bottom"> | ||
| <Text> | ||
| <FormattedMessage | ||
| defaultMessage="Issues found.{break}Review app alerts." | ||
| id="4MIO2H" | ||
| values={{ | ||
| break: <br />, | ||
| }} | ||
| /> | ||
| </Text> | ||
| </Tooltip.Content> | ||
| </Tooltip> | ||
| ); | ||
| }; | ||
This file contains hidden or 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,42 @@ | ||
| import { gql } from "@apollo/client"; | ||
|
|
||
| export const appFailedPendingWebhooks = gql` | ||
| query AppFailedPendingWebhooks { | ||
| apps(first: 50, filter: { type: THIRDPARTY }) { | ||
| edges { | ||
| node { | ||
| webhooks { | ||
| failedDelivers: eventDeliveries( | ||
| first: 1 | ||
| filter: { status: FAILED } | ||
| sortBy: { field: CREATED_AT, direction: DESC } | ||
| ) { | ||
| edges { | ||
| node { | ||
| id | ||
| } | ||
| } | ||
| } | ||
| pendingDelivers: eventDeliveries( | ||
| first: 1 | ||
| filter: { status: PENDING } | ||
| sortBy: { field: CREATED_AT, direction: DESC } | ||
| ) { | ||
| edges { | ||
| node { | ||
| attempts(first: 6, sortBy: { field: CREATED_AT, direction: DESC }) { | ||
| edges { | ||
| node { | ||
| status | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| `; | ||
This file contains hidden or 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,16 @@ | ||
| import { useEffect } from "react"; | ||
|
|
||
| import { useAppsFailedDeliveries } from "./useAppsFailedDeliveries"; | ||
|
|
||
| export const useAppsAlert = () => { | ||
| const { hasFailed, fetchAppsWebhooks } = useAppsFailedDeliveries(); | ||
|
|
||
| // TODO: Implement fetching at intervals | ||
| useEffect(() => { | ||
| fetchAppsWebhooks(); | ||
| }, []); | ||
|
|
||
| return { | ||
| hasFailedAttempts: hasFailed, | ||
| }; | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: I don't think we need to show pending deliveries, we should care only about failed ones
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're commenting outdated code :D We're fetching attempts of pending deliveries to check if they have failed https://github.com/saleor/saleor-dashboard/pull/5403/files#diff-9f3bbc45c9cc037644ba210310c6e2cb538fa2dfc054166306de7ebd00489e9fR19-R35