RestoreDashboards: Create trash section (#88278)

* feat: add feature toggle to docs

* feat: create page in BE

* feat: create page in FE

* refactor: set feat toggle as a condition

* refactor

* refactor

* refactor

* feat: add permission conditions

* refactor

* feat: add subtitle to translations

* feat: add to codeowners

* refactor: fix docs situation

* refactor

* Merge main branch into feat branch
This commit is contained in:
Laura Benz 2024-05-28 10:26:06 +02:00 committed by GitHub
parent f772056296
commit f6a83432a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 87 additions and 21 deletions

1
.github/CODEOWNERS vendored
View File

@ -435,6 +435,7 @@ playwright.config.ts @grafana/plugins-platform-frontend
/public/app/features/transformers/timeSeriesTable/ @grafana/dataviz-squad @grafana/app-o11y-visualizations
/public/app/features/users/ @grafana/identity-access-team
/public/app/features/variables/ @grafana/dashboards-squad
/public/app/features/trash-section/ @grafana/grafana-frontend-platform
/public/app/plugins/panel/alertlist/ @grafana/alerting-frontend
/public/app/plugins/panel/annolist/ @grafana/grafana-frontend-platform
/public/app/plugins/panel/barchart/ @grafana/dataviz-squad

View File

@ -189,6 +189,7 @@ Experimental features might be changed or removed without prior notice.
| `newDashboardSharingComponent` | Enables the new sharing drawer design |
| `alertingListViewV2` | Enables the new alert list view design |
| `notificationBanner` | Enables the notification banner UI and API |
| `dashboardRestore` | Enables deleted dashboard restore feature |
## Development feature toggles

View File

@ -1279,7 +1279,6 @@ var (
Description: "Enables deleted dashboard restore feature",
Stage: FeatureStageExperimental,
Owner: grafanaFrontendPlatformSquad,
HideFromDocs: true,
HideFromAdminPage: true,
},
{

View File

@ -588,15 +588,17 @@
{
"metadata": {
"name": "dashboardRestore",
"resourceVersion": "1716448665531",
"creationTimestamp": "2024-05-23T07:17:45Z"
"resourceVersion": "1716564259132",
"creationTimestamp": "2024-05-23T07:17:45Z",
"annotations": {
"grafana.app/updatedTimestamp": "2024-05-24 15:24:19.132272 +0000 UTC"
}
},
"spec": {
"description": "Enables deleted dashboard restore feature",
"stage": "experimental",
"codeowner": "@grafana/grafana-frontend-platform",
"hideFromAdminPage": true,
"hideFromDocs": true
"hideFromAdminPage": true
}
},
{
@ -2204,26 +2206,19 @@
},
{
"metadata": {
"name": "influxdbRunQueriesInParallel",
"resourceVersion": "1716448665531",
"creationTimestamp": "2024-05-23T07:17:45Z"
},
"spec": {
"description": "Enables running InfluxDB Influxql queries in parallel",
"stage": "privatePreview",
"codeowner": "@grafana/observability-metrics"
}
},
{
"metadata": {
"name": "disableSSEDataplane",
"resourceVersion": "1716448665531",
"creationTimestamp": "2024-05-23T07:17:45Z"
"name": "dashboardRestore",
"resourceVersion": "1716563559003",
"creationTimestamp": "2024-02-20T18:50:41Z",
"deletionTimestamp": "2024-05-24T15:24:19Z",
"annotations": {
"grafana.app/updatedTimestamp": "2024-05-24 15:12:39.003245 +0000 UTC"
}
},
"spec": {
"description": "Disables dataplane specific processing in server side expressions.",
"stage": "experimental",
"codeowner": "@grafana/observability-metrics"
"codeowner": "@grafana/grafana-frontend-platform",
"hideFromAdminPage": true
}
},
{
@ -2265,6 +2260,30 @@
"hideFromAdminPage": true,
"hideFromDocs": true
}
},
{
"metadata": {
"name": "disableSSEDataplane",
"resourceVersion": "1716816471156",
"creationTimestamp": "2024-05-27T13:27:51Z"
},
"spec": {
"description": "Disables dataplane specific processing in server side expressions.",
"stage": "experimental",
"codeowner": "@grafana/observability-metrics"
}
},
{
"metadata": {
"name": "influxdbRunQueriesInParallel",
"resourceVersion": "1716816471156",
"creationTimestamp": "2024-05-27T13:27:51Z"
},
"spec": {
"description": "Enables running InfluxDB Influxql queries in parallel",
"stage": "privatePreview",
"codeowner": "@grafana/observability-metrics"
}
}
]
}

View File

@ -353,6 +353,15 @@ func (s *ServiceImpl) buildDashboardNavLinks(c *contextmodel.ReqContext) []*navt
Icon: "library-panel",
})
}
if s.features.IsEnabled(c.Req.Context(), featuremgmt.FlagDashboardRestore) && hasAccess(ac.EvalPermission(dashboards.ActionDashboardsDelete)) {
dashboardChildNavs = append(dashboardChildNavs, &navtree.NavLink{
Text: "Trash",
SubTitle: "Any items remaining in the Trash for more than 30 days will be automatically deleted",
Id: "dashboards/trash",
Url: s.cfg.AppSubURL + "/dashboard/trash",
})
}
}
if hasAccess(ac.EvalPermission(dashboards.ActionDashboardsCreate)) {

View File

@ -40,6 +40,8 @@ export function getNavTitle(navId: string | undefined) {
return t('nav.reporting.title', 'Reporting');
case 'dashboards/public':
return t('nav.public.title', 'Public dashboards');
case 'dashboards/trash':
return t('nav.trash.title', 'Trash');
case 'dashboards/new':
return t('nav.new-dashboard.title', 'New dashboard');
case 'dashboards/folder/new':
@ -206,6 +208,11 @@ export function getNavSubTitle(navId: string | undefined) {
);
case 'dashboards/library-panels':
return t('nav.library-panels.subtitle', 'Reusable panels that can be added to multiple dashboards');
case 'dashboards/trash':
return t(
'nav.trash.subtitle',
'Any items remaining in the Trash for more than 30 days will be automatically deleted'
);
case 'alerting':
return t('nav.alerting.subtitle', 'Learn about problems in your systems moments after they occur');
case 'alerting-upgrade':

View File

@ -0,0 +1,15 @@
import React from 'react';
import { Page } from 'app/core/components/Page/Page';
const TrashPage = () => {
return (
<Page navId="dashboards/trash">
<Page.Contents>
<p>page content</p>
</Page.Contents>
</Page>
);
};
export default TrashPage;

View File

@ -435,6 +435,13 @@ export function getAppRoutes(): RouteDescriptor[] {
() => import(/* webpackChunkName: "SnapshotListPage" */ 'app/features/manage-dashboards/SnapshotListPage')
),
},
config.featureToggles.dashboardRestore && {
path: '/dashboard/trash',
roles: () => contextSrv.evaluatePermission([AccessControlAction.DashboardsDelete]),
component: SafeDynamicImport(
() => import(/* webpackChunkName: "TrashPage" */ 'app/features/trash-section/TrashPage')
),
},
{
path: '/playlists',
component: SafeDynamicImport(

View File

@ -1179,6 +1179,10 @@
"subtitle": "Optimize performance with k6 and Synthetic Monitoring insights",
"title": "Testing & synthetics"
},
"trash": {
"subtitle": "Any items remaining in the Trash for more than 30 days will be automatically deleted",
"title": "Trash"
},
"upgrading": {
"title": "Stats and license"
},

View File

@ -1179,6 +1179,10 @@
"subtitle": "Øpŧįmįžę pęřƒőřmäʼnčę ŵįŧĥ ĸ6 äʼnđ Ŝyʼnŧĥęŧįč Mőʼnįŧőřįʼnģ įʼnşįģĥŧş",
"title": "Ŧęşŧįʼnģ & şyʼnŧĥęŧįčş"
},
"trash": {
"subtitle": "Åʼny įŧęmş řęmäįʼnįʼnģ įʼn ŧĥę Ŧřäşĥ ƒőř mőřę ŧĥäʼn 30 đäyş ŵįľľ þę äūŧőmäŧįčäľľy đęľęŧęđ",
"title": "Ŧřäşĥ"
},
"upgrading": {
"title": "Ŝŧäŧş äʼnđ ľįčęʼnşę"
},