-
Notifications
You must be signed in to change notification settings - Fork 21
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
Display error message if update_merchant_product_statuses job throws an error #2324
Merged
jorgemd24
merged 30 commits into
feature/refactor-product-stats
from
add/display-error-job-mc-status
Mar 25, 2024
Merged
Changes from 19 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
73a242d
Allow to refresh Stats
jorgemd24 0530ff8
Add SyncMCStatus
jorgemd24 87ae0f2
Merge branch 'tweak/frontend-loading-product-statuses' into add/displ…
jorgemd24 3aa83ae
Merge branch 'tweak/frontend-loading-product-statuses' into add/displ…
jorgemd24 e23d7b6
Merge branch 'update/ui-loading-product-statuses' into add/display-er…
jorgemd24 989d225
Rename component to SyncProductStatistics
jorgemd24 f37e94e
Handle case where failure rate message is too high
jorgemd24 7b0f59e
Merge branch 'update/ui-loading-product-statuses' into add/display-er…
jorgemd24 dbf5507
Merge branch 'update/ui-loading-product-statuses' into add/display-er…
jorgemd24 3079d4a
Clear cache before job runs so we can delete any stale error
jorgemd24 762937b
Add tests for clear cache before schedule a job
jorgemd24 7f3eba4
Add the description for SyncProductStatistics
jorgemd24 1146e15
Pass the error to SyncProductStatistics
jorgemd24 24af8c2
Add tests When there is an error
jorgemd24 c213955
Js linting
jorgemd24 065ff6d
Add tests for refreshStats
jorgemd24 6b0b4f9
Delete MC statuses
jorgemd24 6a33e75
Add tests for get_failure_rate_message
jorgemd24 ef985e8
Tweak response of failure rate and docs
jorgemd24 0d0b1c1
Add tests for get statistics with failure rate
jorgemd24 15df732
Add delete_stale_mc_statuses method
jorgemd24 7a055ce
Add tests for delete_stale_mc_statuses
jorgemd24 68e6df3
Update transient time
jorgemd24 e032768
Adjust tests for clear_product_statuses_cache_and_issues
jorgemd24 8ec00b8
Add missing since
jorgemd24 345d019
Add useCallback to refresh product stats
jorgemd24 4aa6426
Use AppButton instead of Button
jorgemd24 986c6d2
Change error message for the failure rate msg
jorgemd24 7adeb24
Update tests
jorgemd24 cbdcba1
Merge pull request #2329 from woocommerce/add/delete-stale-mc-statuses
jorgemd24 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 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
47 changes: 47 additions & 0 deletions
47
js/src/product-feed/product-statistics/status-box/sync-product-statistics.js
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,47 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { Button } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Status from '.~/product-feed/product-statistics/status-box/status'; | ||
import ErrorIcon from '.~/components/error-icon'; | ||
|
||
/** | ||
* @typedef {import('.~/data/actions').ProductStatistics } ProductStatistics | ||
*/ | ||
|
||
/** | ||
* Renders status information for the Product Sync | ||
* | ||
* @param {Object} props The component props | ||
* @param {Function} props.refreshStats | ||
* @param {string} props.error | ||
* @return {JSX.Element} The status for the Product Sync | ||
*/ | ||
function SyncProductStatistics( { refreshStats, error } ) { | ||
return ( | ||
<Status | ||
title={ __( 'Overview Stats:', 'google-listings-and-ads' ) } | ||
icon={ <ErrorIcon size={ 24 } /> } | ||
label={ | ||
<Button | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about using AppButton so we can also add the |
||
aria-label={ error } | ||
onClick={ refreshStats } | ||
className="overview-stats-error-button" | ||
> | ||
{ __( | ||
'There was an error loading the Overview Stats. Click to retry.', | ||
'google-listings-and-ads' | ||
) } | ||
</Button> | ||
} | ||
description={ error } | ||
/> | ||
); | ||
} | ||
|
||
export default SyncProductStatistics; |
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
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.
Maybe we could wrap this function by
useCallback
, as there are dependencies used in the function. But I'm not sure if it is a best practice tho.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.
Thanks @ianlin for the suggestion, I believe it won't make much difference in terms of performance, but it won't hurt either, so I've added it here: 345d019