RecentlyViewedDashboards: Retry when error (#115649)
This commit is contained in:
@@ -25,6 +25,7 @@ export function RecentlyViewedDashboards() {
|
||||
value: recentDashboards = [],
|
||||
loading,
|
||||
retry,
|
||||
error,
|
||||
} = useAsyncRetry(async () => {
|
||||
if (!evaluateBooleanFlag('recentlyViewedDashboards', false)) {
|
||||
return [];
|
||||
@@ -62,7 +63,18 @@ export function RecentlyViewedDashboards() {
|
||||
className={styles.title}
|
||||
contentClassName={styles.content}
|
||||
>
|
||||
{/* placeholder */}
|
||||
{error && (
|
||||
<>
|
||||
<Text color="secondary">
|
||||
<Trans i18nKey="browse-dashboards.recently-viewed.error">
|
||||
Recently viewed dashboards couldn’t be loaded.
|
||||
</Trans>
|
||||
</Text>
|
||||
<Button onClick={retry} size="xs" fill="text">
|
||||
{t('browse-dashboards.recently-viewed.retry', 'Retry')}
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
{loading && <Spinner />}
|
||||
{/* TODO: Better empty state https://github.com/grafana/grafana/issues/114804 */}
|
||||
{!loading && recentDashboards.length === 0 && (
|
||||
|
||||
@@ -3748,6 +3748,8 @@
|
||||
"recently-viewed": {
|
||||
"clear": "Clear history",
|
||||
"empty": "Nothing viewed yet",
|
||||
"error": "Recently viewed dashboards couldn’t be loaded.",
|
||||
"retry": "Retry",
|
||||
"title": "Recently viewed"
|
||||
},
|
||||
"restore": {
|
||||
|
||||
Reference in New Issue
Block a user