-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Alerts for apps with issues or disabled apps in app list #5416
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 46 commits
Commits
Show all changes
50 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 35781a9
add feature flag
Cloud11PL a8a79a2
cr fixes
Cloud11PL f0dd22a
generate flag
Cloud11PL 7bd087d
generate flag
Cloud11PL f2f15fd
add feature flag
Cloud11PL d7e0b8d
cr fixes
Cloud11PL 7a6a855
apps list ui change
Cloud11PL ee5020e
show icon when app is disabled
Cloud11PL 0afdc38
app list alerts
Cloud11PL 63340e3
row alert
Cloud11PL ac7b7cf
link to app details
Cloud11PL e600783
show focused and hover
Cloud11PL be86ccd
add alert for disabled app
Cloud11PL 0a41358
add tests
Cloud11PL 32c94ab
changeset
Cloud11PL f0b48af
fix permission check
Cloud11PL 9bbdf3e
sort installed apps
Cloud11PL cf4d58b
add more tests
Cloud11PL e5f5ebd
fix tests
Cloud11PL c4b4a69
i18n
Cloud11PL 27f99b8
Merge branch 'main' into PROD-99-sidebar-apps-alert
Cloud11PL fef7288
Merge branch 'PROD-99-sidebar-apps-alert' into PROD-100-app-list-apps…
Cloud11PL bb1ead6
hide issues alert behind feature flag
Cloud11PL 03c490d
mock use flag in test
Cloud11PL cbb86c7
Merge branch 'main' into PROD-100-app-list-apps-alert
Cloud11PL ffc06e7
fix icon import
Cloud11PL aa9be82
fix feature flag usage
Cloud11PL bdb1499
fetch more pending deliveries
Cloud11PL 9fb2116
remove app sorting by issue
Cloud11PL 3276d98
fix date formatting
Cloud11PL 0ce6c60
Merge branch 'main' into PROD-100-app-list-apps-alert
Cloud11PL d965e60
don't fetch webhooks without permissions
Cloud11PL 703061f
Merge branch 'main' into PROD-100-app-list-apps-alert
Cloud11PL f734b0d
cr fixes
Cloud11PL 5ac8918
fix custom app list query
Cloud11PL 8df6b09
Merge branch 'main' into PROD-100-app-list-apps-alert
Cloud11PL 608a8f1
Merge branch 'main' into PROD-100-app-list-apps-alert
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,6 @@ | ||
| --- | ||
| "saleor-dashboard": patch | ||
| --- | ||
|
|
||
| App list now shows an alert if app's webhooks have failed or the app is disabled. 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
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
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,21 @@ | ||
| 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 } from "@saleor/macaw-ui-next"; | ||
| import React, { useState } from "react"; | ||
|
|
||
| export const AlertExclamationIcon = () => { | ||
| 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> | ||
| ); | ||
| }; | ||
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,59 @@ | ||
| import { AppPaths } from "@dashboard/apps/urls"; | ||
| import Link from "@dashboard/components/Link"; | ||
| import { StopPropagation } from "@dashboard/components/StopPropagation"; | ||
| import { AppListItemFragment } from "@dashboard/graphql"; | ||
| import { DisabledIcon } from "@dashboard/icons/Disabled"; | ||
| import { Box, Text, Tooltip } from "@saleor/macaw-ui-next"; | ||
| import React from "react"; | ||
| import { FormattedMessage } from "react-intl"; | ||
|
|
||
| interface AppRowDisabledAlertProps { | ||
| app: AppListItemFragment; | ||
| } | ||
|
|
||
| export const AppRowDisabledAlert = ({ app }: AppRowDisabledAlertProps) => { | ||
| if (app.isActive) { | ||
| return null; | ||
| } | ||
|
|
||
| const detailsLink = AppPaths.resolveAppDetailsPath(app.id); | ||
|
|
||
| return ( | ||
| <Tooltip> | ||
| <Tooltip.Trigger> | ||
| <Box color="default2" __transform="scale(0.8)"> | ||
| <DisabledIcon /> | ||
| </Box> | ||
| </Tooltip.Trigger> | ||
|
|
||
| <Tooltip.Content align="start" side="bottom"> | ||
| <StopPropagation> | ||
| <Box display="flex" flexDirection="row" gap={2} color="default2"> | ||
| <Box __transform="scale(0.8)" __marginTop="-3px"> | ||
| <DisabledIcon /> | ||
| </Box> | ||
|
|
||
| <Box display="flex" flexDirection="column" gap={1}> | ||
| <Text fontSize={5} fontWeight="bold"> | ||
| <FormattedMessage defaultMessage="App disabled" id="HwHSeY" /> | ||
| </Text> | ||
| <Text> | ||
| <FormattedMessage | ||
| defaultMessage="Activate the app from the settings. {viewDetails}." | ||
| id="oCrEdS" | ||
| values={{ | ||
| viewDetails: ( | ||
| <Link href={detailsLink} color="secondary" underline> | ||
| <FormattedMessage defaultMessage="View details" id="MnpUD7" /> | ||
| </Link> | ||
| ), | ||
| }} | ||
| /> | ||
| </Text> | ||
| </Box> | ||
| </Box> | ||
| </StopPropagation> | ||
| </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,71 @@ | ||
| import { AppPaths } from "@dashboard/apps/urls"; | ||
| import Link from "@dashboard/components/Link"; | ||
| import { StopPropagation } from "@dashboard/components/StopPropagation"; | ||
| import { AppListItemFragment } from "@dashboard/graphql"; | ||
| import { ExclamationIcon } from "@dashboard/icons/ExclamationIcon"; | ||
| import { Box, Text, Tooltip } from "@saleor/macaw-ui-next"; | ||
| import moment from "moment"; | ||
| import React, { useMemo } from "react"; | ||
| import { FormattedMessage } from "react-intl"; | ||
|
|
||
| import { AlertExclamationIcon } from "../AppAlerts/AlertExclamationIcon"; | ||
| import { getLatestFailedAttemptFromWebhooks } from "./utils"; | ||
|
|
||
| interface AppRowWebhookIssueAlertProps { | ||
| app: AppListItemFragment; | ||
| } | ||
|
|
||
| export const AppRowWebhookIssueAlert = ({ app }: AppRowWebhookIssueAlertProps) => { | ||
| const latestFailedAttempt = useMemo( | ||
| () => app.webhooks && getLatestFailedAttemptFromWebhooks(app.webhooks), | ||
| [app], | ||
| ); | ||
|
|
||
| if (!latestFailedAttempt) { | ||
| return null; | ||
| } | ||
|
|
||
| const detailsLink = AppPaths.resolveAppDetailsPath(app.id); | ||
|
|
||
| return ( | ||
| <Tooltip> | ||
| <Tooltip.Trigger> | ||
| <Box data-test-id="app-warning-dot"> | ||
| <AlertExclamationIcon /> | ||
| </Box> | ||
| </Tooltip.Trigger> | ||
|
|
||
| <Tooltip.Content align="start" side="bottom"> | ||
| <StopPropagation> | ||
| <Box display="flex" flexDirection="row" gap={2} __color="#FFB84E"> | ||
| <Box marginTop={0.5}> | ||
| <ExclamationIcon /> | ||
| </Box> | ||
|
|
||
| <Box display="flex" flexDirection="column" gap={1}> | ||
| <Text fontSize={5} fontWeight="bold"> | ||
| <FormattedMessage defaultMessage="Issues found" id="t9sWqJ" /> | ||
| </Text> | ||
| <Text> | ||
| <FormattedMessage | ||
| defaultMessage="Webhook errors detected. Last occurred at {date}. {viewDetails}." | ||
| id="FaRg9/" | ||
| values={{ | ||
| date: moment(latestFailedAttempt?.createdAt).format( | ||
| "YYYY-MM-DD HH:mm:ss [UTC]Z", | ||
Cloud11PL marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ), | ||
| viewDetails: ( | ||
| <Link href={detailsLink} color="secondary" underline> | ||
| <FormattedMessage defaultMessage="View details" id="MnpUD7" /> | ||
| </Link> | ||
| ), | ||
| }} | ||
| /> | ||
| </Text> | ||
| </Box> | ||
| </Box> | ||
| </StopPropagation> | ||
| </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
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
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.
question: why do you use
StopPropagation?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.
Because the event is transffered to the app list row and when you click on the link inside the tooltip you would get navigated to the app instead of the link.