mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 02:10:45 -06:00
RestoreDashboards: Add an empty state (#89662)
* feat: add empty state * fix: flickering * Update public/app/features/browse-dashboards/RecentlyDeletedPage.tsx Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com> --------- Co-authored-by: Alex Khomenko <Clarity-89@users.noreply.github.com>
This commit is contained in:
parent
13a4a46cc1
commit
5da94bb669
@ -1,7 +1,9 @@
|
|||||||
import { memo, useEffect } from 'react';
|
import { memo, useEffect } from 'react';
|
||||||
import AutoSizer from 'react-virtualized-auto-sizer';
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
||||||
|
|
||||||
|
import { EmptyState } from '@grafana/ui';
|
||||||
import { Page } from 'app/core/components/Page/Page';
|
import { Page } from 'app/core/components/Page/Page';
|
||||||
|
import { t } from 'app/core/internationalization';
|
||||||
import { ActionRow } from 'app/features/search/page/components/ActionRow';
|
import { ActionRow } from 'app/features/search/page/components/ActionRow';
|
||||||
import { getGrafanaSearcher } from 'app/features/search/service';
|
import { getGrafanaSearcher } from 'app/features/search/service';
|
||||||
|
|
||||||
@ -33,33 +35,50 @@ const RecentlyDeletedPage = memo(() => {
|
|||||||
);
|
);
|
||||||
}, [dispatch, stateManager]);
|
}, [dispatch, stateManager]);
|
||||||
|
|
||||||
|
if (searchState.loading === false && searchState.result?.totalRows === 0) {
|
||||||
|
return (
|
||||||
|
<Page navId="dashboards/recently-deleted">
|
||||||
|
<Page.Contents>
|
||||||
|
<EmptyState
|
||||||
|
variant="completed"
|
||||||
|
message={t('recently-deleted.page.empty-state', "You haven't deleted any dashboards recently.")}
|
||||||
|
/>
|
||||||
|
</Page.Contents>
|
||||||
|
</Page>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page navId="dashboards/recently-deleted">
|
<Page navId="dashboards/recently-deleted">
|
||||||
<Page.Contents>
|
<Page.Contents>
|
||||||
<ActionRow
|
{searchState.result && (
|
||||||
state={searchState}
|
<>
|
||||||
getTagOptions={stateManager.getTagOptions}
|
<ActionRow
|
||||||
getSortOptions={getGrafanaSearcher().getSortOptions}
|
state={searchState}
|
||||||
sortPlaceholder={getGrafanaSearcher().sortPlaceholder}
|
getTagOptions={stateManager.getTagOptions}
|
||||||
onLayoutChange={stateManager.onLayoutChange}
|
getSortOptions={getGrafanaSearcher().getSortOptions}
|
||||||
onSortChange={stateManager.onSortChange}
|
sortPlaceholder={getGrafanaSearcher().sortPlaceholder}
|
||||||
onTagFilterChange={stateManager.onTagFilterChange}
|
onLayoutChange={stateManager.onLayoutChange}
|
||||||
onDatasourceChange={stateManager.onDatasourceChange}
|
onSortChange={stateManager.onSortChange}
|
||||||
onPanelTypeChange={stateManager.onPanelTypeChange}
|
onTagFilterChange={stateManager.onTagFilterChange}
|
||||||
onSetIncludePanels={stateManager.onSetIncludePanels}
|
onDatasourceChange={stateManager.onDatasourceChange}
|
||||||
/>
|
onPanelTypeChange={stateManager.onPanelTypeChange}
|
||||||
<RecentlyDeletedActions />
|
onSetIncludePanels={stateManager.onSetIncludePanels}
|
||||||
<AutoSizer>
|
|
||||||
{({ width, height }) => (
|
|
||||||
<SearchView
|
|
||||||
canSelect={canSelect}
|
|
||||||
width={width}
|
|
||||||
height={height}
|
|
||||||
searchStateManager={stateManager}
|
|
||||||
searchState={searchState}
|
|
||||||
/>
|
/>
|
||||||
)}
|
<RecentlyDeletedActions />
|
||||||
</AutoSizer>
|
<AutoSizer>
|
||||||
|
{({ width, height }) => (
|
||||||
|
<SearchView
|
||||||
|
canSelect={canSelect}
|
||||||
|
width={width}
|
||||||
|
height={height}
|
||||||
|
searchStateManager={stateManager}
|
||||||
|
searchState={searchState}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</AutoSizer>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</Page.Contents>
|
</Page.Contents>
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
|
@ -1599,6 +1599,9 @@
|
|||||||
"delete": "Delete permanently",
|
"delete": "Delete permanently",
|
||||||
"restore": "Restore"
|
"restore": "Restore"
|
||||||
},
|
},
|
||||||
|
"page": {
|
||||||
|
"empty-state": "You haven't deleted any dashboards recently."
|
||||||
|
},
|
||||||
"permanently-delete-modal": {
|
"permanently-delete-modal": {
|
||||||
"confirm-text": "Delete",
|
"confirm-text": "Delete",
|
||||||
"delete-button": "Delete",
|
"delete-button": "Delete",
|
||||||
|
@ -1599,6 +1599,9 @@
|
|||||||
"delete": "Đęľęŧę pęřmäʼnęʼnŧľy",
|
"delete": "Đęľęŧę pęřmäʼnęʼnŧľy",
|
||||||
"restore": "Ŗęşŧőřę"
|
"restore": "Ŗęşŧőřę"
|
||||||
},
|
},
|
||||||
|
"page": {
|
||||||
|
"empty-state": "Ÿőū ĥävęʼn'ŧ đęľęŧęđ äʼny đäşĥþőäřđş řęčęʼnŧľy."
|
||||||
|
},
|
||||||
"permanently-delete-modal": {
|
"permanently-delete-modal": {
|
||||||
"confirm-text": "Đęľęŧę",
|
"confirm-text": "Đęľęŧę",
|
||||||
"delete-button": "Đęľęŧę",
|
"delete-button": "Đęľęŧę",
|
||||||
|
Loading…
Reference in New Issue
Block a user