diff --git a/backend/app/services/dashboard_service.py b/backend/app/services/dashboard_service.py index e319a0b8..fb2949b5 100644 --- a/backend/app/services/dashboard_service.py +++ b/backend/app/services/dashboard_service.py @@ -49,13 +49,17 @@ GRID_COLS = 12 # JSON per board. MAX_WIDGETS_PER_BOARD = 100 -# A board can also hold the Overview layout a user saved for one kind of -# detail page (every server page shares the user's server layout, the page's -# own server being the board's variable). It is an ordinary board row whose -# slug names the kind, so it reuses the same storage, validation and -# ownership rules; it is just never listed among the dashboard tabs. +# A board can also hold the Overview layout a user saved for a page: one kind +# of detail page (every server page shares the user's server layout, the +# page's own server being the board's variable) or a single overview page +# (Monitoring, Backups). It is an ordinary board row whose slug names the +# page, so it reuses the same storage, validation and ownership rules; it is +# just never listed among the dashboard tabs. ENTITY_SCOPE_PREFIX = 'entity:' -ENTITY_SCOPES = ('entity:server', 'entity:service') +ENTITY_SCOPES = ( + 'entity:server', 'entity:service', + 'entity:monitoring', 'entity:backups', +) DEFAULT_BOARDS = [ diff --git a/backend/tests/test_dashboards.py b/backend/tests/test_dashboards.py index e0c15366..6cc9ba81 100644 --- a/backend/tests/test_dashboards.py +++ b/backend/tests/test_dashboards.py @@ -485,11 +485,21 @@ def test_overview_layout_is_stored_but_is_not_a_dashboard_tab(client, auth_heade assert scoped[0]['widgets'] == [_widget()] -def test_overview_layout_is_empty_until_saved(client, auth_headers): - resp = client.get('/api/v1/dashboards?scope=entity:service', headers=auth_headers) +@pytest.mark.parametrize('scope', [ + 'entity:server', 'entity:service', 'entity:monitoring', 'entity:backups', +]) +def test_overview_layout_is_empty_until_saved(client, auth_headers, scope): + resp = client.get(f'/api/v1/dashboards?scope={scope}', headers=auth_headers) assert resp.status_code == 200 assert resp.get_json()['boards'] == [] + saved = client.post('/api/v1/dashboards', headers=auth_headers, json={ + 'name': 'Overview', 'scope': scope, 'widgets': [_widget()], + }) + assert saved.status_code == 201 + again = client.get(f'/api/v1/dashboards?scope={scope}', headers=auth_headers).get_json()['boards'] + assert [board['slug'] for board in again] == [scope] + def test_saving_an_overview_layout_again_replaces_it(client, auth_headers): first = client.post('/api/v1/dashboards', headers=auth_headers, json={ diff --git a/frontend/src/components/backups/BackupsOverview.jsx b/frontend/src/components/backups/BackupsOverview.jsx index 92a36172..b1ba0e59 100644 --- a/frontend/src/components/backups/BackupsOverview.jsx +++ b/frontend/src/components/backups/BackupsOverview.jsx @@ -10,6 +10,7 @@ import { formatBytes } from '@/utils/formatBytes'; import { KpiBand, MetricCard, Pill, DataTable, DataTableFooter } from '@/components/ds'; import EmptyState from '../EmptyState'; import InfoTip from '../InfoTip'; +import { OverviewBoard, OverviewSection } from '@/components/detail/OverviewBoard'; import { useTranslation } from 'react-i18next'; import { formatDuration, formatNumber } from '@/utils/intl'; @@ -100,6 +101,9 @@ const LATEST_COLUMNS = [ // reliably it has been running, where the bytes live, and what happened lately. // The archive table lives on its own Snapshots section — this page answers // "is my data safe?", not "show me every file". +// Dashboard widget types the Backups overview can carry besides its blocks. +const BACKUPS_WIDGET_TYPES = ['note']; + export default function BackupsOverview({ stats, storageConfig, costSummary, schedules = [], backups = [], onGo, storageWarning = false, }) { @@ -254,6 +258,8 @@ export default function BackupsOverview({ return (
+ {online}/{fleet.length} {t('app.monitoringOverview.onlineClickACardToRe', 'online · click a card to re-scope')} +