RestoreDashboards: Merge both feature toggles to dashboardRestore (#94412)

* refactor: remove FE feat toggle from BE

* refactor: remove FE toggle and adjust roles

* refactor: replace feat toggle in tracking events

* refactor: remove FE feat toggle

* refactor: remove FE feat toggle

* fix: autogenerated file
This commit is contained in:
Laura Benz 2024-10-11 10:29:58 +02:00 committed by GitHub
parent 3d59d3b40f
commit 4092741f24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 20 additions and 31 deletions

View File

@ -191,11 +191,10 @@ Experimental features might be changed or removed without prior notice.
| `queryLibrary` | Enables Query Library feature in Explore |
| `logsExploreTableDefaultVisualization` | Sets the logs table as default visualisation in logs explore |
| `alertingListViewV2` | Enables the new alert list view design |
| `dashboardRestore` | Enables deleted dashboard restore feature (backend only) |
| `dashboardRestore` | Enables deleted dashboard restore feature |
| `alertingCentralAlertHistory` | Enables the new central alert history. |
| `failWrongDSUID` | Throws an error if a datasource has an invalid UIDs |
| `alertingApiServer` | Register Alerting APIs with the K8s API server |
| `dashboardRestoreUI` | Enables the frontend to be able to restore a recently deleted dashboard |
| `dataplaneAggregator` | Enable grafana dataplane aggregator |
| `newFiltersUI` | Enables new combobox style UI for the Ad hoc filters variable in scenes architecture |
| `lokiSendDashboardPanelNames` | Send dashboard and panel names to Loki when querying |

View File

@ -198,7 +198,6 @@ export interface FeatureToggles {
zanzana?: boolean;
passScopeToDashboardApi?: boolean;
alertingApiServer?: boolean;
dashboardRestoreUI?: boolean;
cloudWatchRoundUpEndTime?: boolean;
cloudwatchMetricInsightsCrossAccount?: boolean;
prometheusAzureOverrideAudience?: boolean;

View File

@ -1255,10 +1255,11 @@ var (
},
{
Name: "dashboardRestore",
Description: "Enables deleted dashboard restore feature (backend only)",
Description: "Enables deleted dashboard restore feature",
Stage: FeatureStageExperimental,
Owner: grafanaSearchAndStorageSquad,
HideFromAdminPage: true,
Expression: "false", // enabled by default
},
{
Name: "datasourceProxyDisableRBAC",
@ -1367,13 +1368,6 @@ var (
Owner: grafanaAlertingSquad,
RequiresRestart: true,
},
{
Name: "dashboardRestoreUI",
Description: "Enables the frontend to be able to restore a recently deleted dashboard",
Stage: FeatureStageExperimental,
Owner: grafanaFrontendPlatformSquad,
Expression: "false", // enabled by default
},
{
Name: "cloudWatchRoundUpEndTime",
Description: "Round up end time for metric queries to the next minute to avoid missing data",

View File

@ -179,7 +179,6 @@ failWrongDSUID,experimental,@grafana/plugins-platform-backend,false,false,false
zanzana,experimental,@grafana/identity-access-team,false,false,false
passScopeToDashboardApi,experimental,@grafana/dashboards-squad,false,false,false
alertingApiServer,experimental,@grafana/alerting-squad,false,true,false
dashboardRestoreUI,experimental,@grafana/grafana-frontend-platform,false,false,false
cloudWatchRoundUpEndTime,GA,@grafana/aws-datasources,false,false,false
cloudwatchMetricInsightsCrossAccount,preview,@grafana/aws-datasources,false,false,true
prometheusAzureOverrideAudience,deprecated,@grafana/partner-datasources,false,false,false

1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
179 zanzana experimental @grafana/identity-access-team false false false
180 passScopeToDashboardApi experimental @grafana/dashboards-squad false false false
181 alertingApiServer experimental @grafana/alerting-squad false true false
dashboardRestoreUI experimental @grafana/grafana-frontend-platform false false false
182 cloudWatchRoundUpEndTime GA @grafana/aws-datasources false false false
183 cloudwatchMetricInsightsCrossAccount preview @grafana/aws-datasources false false true
184 prometheusAzureOverrideAudience deprecated @grafana/partner-datasources false false false

View File

@ -668,7 +668,7 @@ const (
FlagNotificationBanner = "notificationBanner"
// FlagDashboardRestore
// Enables deleted dashboard restore feature (backend only)
// Enables deleted dashboard restore feature
FlagDashboardRestore = "dashboardRestore"
// FlagDatasourceProxyDisableRBAC
@ -727,10 +727,6 @@ const (
// Register Alerting APIs with the K8s API server
FlagAlertingApiServer = "alertingApiServer"
// FlagDashboardRestoreUI
// Enables the frontend to be able to restore a recently deleted dashboard
FlagDashboardRestoreUI = "dashboardRestoreUI"
// FlagCloudWatchRoundUpEndTime
// Round up end time for metric queries to the next minute to avoid missing data
FlagCloudWatchRoundUpEndTime = "cloudWatchRoundUpEndTime"

View File

@ -808,17 +808,18 @@
{
"metadata": {
"name": "dashboardRestore",
"resourceVersion": "1719321877748",
"resourceVersion": "1728397491294",
"creationTimestamp": "2024-05-16T17:36:26Z",
"annotations": {
"grafana.app/updatedTimestamp": "2024-06-25 13:24:37.748284 +0000 UTC"
"grafana.app/updatedTimestamp": "2024-10-08 14:24:51.294668 +0000 UTC"
}
},
"spec": {
"description": "Enables deleted dashboard restore feature (backend only)",
"description": "Enables deleted dashboard restore feature",
"stage": "experimental",
"codeowner": "@grafana/search-and-storage",
"hideFromAdminPage": true
"hideFromAdminPage": true,
"expression": "false"
}
},
{
@ -826,6 +827,7 @@
"name": "dashboardRestoreUI",
"resourceVersion": "1720021873452",
"creationTimestamp": "2024-06-25T14:43:13Z",
"deletionTimestamp": "2024-10-08T14:24:51Z",
"annotations": {
"grafana.app/updatedTimestamp": "2024-07-03 15:51:13.452477 +0000 UTC"
}

View File

@ -389,7 +389,7 @@ func (s *ServiceImpl) buildDashboardNavLinks(c *contextmodel.ReqContext) []*navt
})
}
if s.features.IsEnabled(c.Req.Context(), featuremgmt.FlagDashboardRestoreUI) && (c.SignedInUser.GetOrgRole() == org.RoleAdmin || c.IsGrafanaAdmin) {
if s.features.IsEnabled(c.Req.Context(), featuremgmt.FlagDashboardRestore) && (c.SignedInUser.GetOrgRole() == org.RoleAdmin || c.IsGrafanaAdmin) {
dashboardChildNavs = append(dashboardChildNavs, &navtree.NavLink{
Text: "Recently deleted",
SubTitle: "Any items listed here for more than 30 days will be automatically deleted.",

View File

@ -121,7 +121,7 @@ const BrowseDashboardsPage = memo(() => {
onEditTitle={showEditTitle ? onEditTitle : undefined}
actions={
<>
{config.featureToggles.dashboardRestore && config.featureToggles.dashboardRestoreUI && hasAdminRights && (
{config.featureToggles.dashboardRestore && hasAdminRights && (
<LinkButton
variant="secondary"
href={getConfig().appSubUrl + '/dashboard/recently-deleted'}

View File

@ -115,6 +115,6 @@ function trackAction(action: keyof typeof actionMap, selectedItems: Omit<Dashboa
dashboard: selectedDashboards.length,
},
source: 'tree_actions',
restore_enabled: config.featureToggles.dashboardRestoreUI,
restore_enabled: config.featureToggles.dashboardRestore,
});
}

View File

@ -27,7 +27,7 @@ export const DeleteModal = ({ onConfirm, onDismiss, selectedItems, ...props }: P
folder: Object.keys(selectedItems.folder).length,
},
source: 'browse_dashboards',
restore_enabled: config.featureToggles.dashboardRestoreUI,
restore_enabled: config.featureToggles.dashboardRestore,
});
setIsDeleting(true);
try {

View File

@ -39,7 +39,7 @@ export interface NameAlreadyExistsErrorProps {
}
export function NameAlreadyExistsError({ cancelButton, saveButton }: NameAlreadyExistsErrorProps) {
const isRestoreDashboardsEnabled = config.featureToggles.dashboardRestore && config.featureToggles.dashboardRestoreUI;
const isRestoreDashboardsEnabled = config.featureToggles.dashboardRestore;
return isRestoreDashboardsEnabled ? (
<Alert title={t('save-dashboards.name-exists.title', 'Dashboard name already exists')} severity="error">
<p>

View File

@ -33,7 +33,7 @@ export function DeleteDashboardButton({ dashboard }: ButtonProps) {
dashboard: 1,
},
source: 'dashboard_scene_settings',
restore_enabled: config.featureToggles.dashboardRestoreUI,
restore_enabled: config.featureToggles.dashboardRestore,
});
toggleModal();
if (dashboard.state.uid) {

View File

@ -34,7 +34,7 @@ const DeleteDashboardModalUnconnected = ({ hideModal, cleanUpDashboardAndVariabl
dashboard: 1,
},
source: 'dashboard_settings',
restore_enabled: config.featureToggles.dashboardRestoreUI,
restore_enabled: config.featureToggles.dashboardRestore,
});
await deleteItems({
selectedItems: {

View File

@ -31,7 +31,7 @@ export const SaveDashboardErrorProxy = ({
setErrorIsHandled,
}: SaveDashboardErrorProxyProps) => {
const { onDashboardSave } = useDashboardSave();
const isRestoreDashboardsEnabled = config.featureToggles.dashboardRestore && config.featureToggles.dashboardRestoreUI;
const isRestoreDashboardsEnabled = config.featureToggles.dashboardRestore;
return (
<>
{error.data && error.data.status === 'version-mismatch' && (

View File

@ -444,9 +444,9 @@ export function getAppRoutes(): RouteDescriptor[] {
() => import(/* webpackChunkName: "SnapshotListPage" */ 'app/features/manage-dashboards/SnapshotListPage')
),
},
config.featureToggles.dashboardRestoreUI && {
config.featureToggles.dashboardRestore && {
path: '/dashboard/recently-deleted',
roles: () => ['Admin'],
roles: () => ['Admin', 'ServerAdmin'],
component: SafeDynamicImport(
() => import(/* webpackChunkName: "RecentlyDeletedPage" */ 'app/features/browse-dashboards/RecentlyDeletedPage')
),