Skip to content

Commit

Permalink
RestoreDashboards: Create trash section (grafana#88278)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
L-M-K-B authored May 28, 2024
1 parent f772056 commit f6a8343
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 21 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 0 additions & 1 deletion pkg/services/featuremgmt/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,6 @@ var (
Description: "Enables deleted dashboard restore feature",
Stage: FeatureStageExperimental,
Owner: grafanaFrontendPlatformSquad,
HideFromDocs: true,
HideFromAdminPage: true,
},
{
Expand Down
59 changes: 39 additions & 20 deletions pkg/services/featuremgmt/toggles_gen.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
},
{
Expand Down Expand Up @@ -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
}
},
{
Expand Down Expand Up @@ -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"
}
}
]
}
9 changes: 9 additions & 0 deletions pkg/services/navtree/navtreeimpl/navtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
7 changes: 7 additions & 0 deletions public/app/core/utils/navBarItem-translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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':
Expand Down
15 changes: 15 additions & 0 deletions public/app/features/trash-section/TrashPage.tsx
Original file line number Diff line number Diff line change
@@ -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;
7 changes: 7 additions & 0 deletions public/app/routes/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions public/locales/en-US/grafana.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
4 changes: 4 additions & 0 deletions public/locales/pseudo-LOCALE/grafana.json
Original file line number Diff line number Diff line change
Expand Up @@ -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şę"
},
Expand Down

0 comments on commit f6a8343

Please sign in to comment.