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 | | `queryLibrary` | Enables Query Library feature in Explore |
| `logsExploreTableDefaultVisualization` | Sets the logs table as default visualisation in logs explore | | `logsExploreTableDefaultVisualization` | Sets the logs table as default visualisation in logs explore |
| `alertingListViewV2` | Enables the new alert list view design | | `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. | | `alertingCentralAlertHistory` | Enables the new central alert history. |
| `failWrongDSUID` | Throws an error if a datasource has an invalid UIDs | | `failWrongDSUID` | Throws an error if a datasource has an invalid UIDs |
| `alertingApiServer` | Register Alerting APIs with the K8s API server | | `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 | | `dataplaneAggregator` | Enable grafana dataplane aggregator |
| `newFiltersUI` | Enables new combobox style UI for the Ad hoc filters variable in scenes architecture | | `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 | | `lokiSendDashboardPanelNames` | Send dashboard and panel names to Loki when querying |

View File

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

View File

@ -1255,10 +1255,11 @@ var (
}, },
{ {
Name: "dashboardRestore", Name: "dashboardRestore",
Description: "Enables deleted dashboard restore feature (backend only)", Description: "Enables deleted dashboard restore feature",
Stage: FeatureStageExperimental, Stage: FeatureStageExperimental,
Owner: grafanaSearchAndStorageSquad, Owner: grafanaSearchAndStorageSquad,
HideFromAdminPage: true, HideFromAdminPage: true,
Expression: "false", // enabled by default
}, },
{ {
Name: "datasourceProxyDisableRBAC", Name: "datasourceProxyDisableRBAC",
@ -1367,13 +1368,6 @@ var (
Owner: grafanaAlertingSquad, Owner: grafanaAlertingSquad,
RequiresRestart: true, 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", Name: "cloudWatchRoundUpEndTime",
Description: "Round up end time for metric queries to the next minute to avoid missing data", 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 zanzana,experimental,@grafana/identity-access-team,false,false,false
passScopeToDashboardApi,experimental,@grafana/dashboards-squad,false,false,false passScopeToDashboardApi,experimental,@grafana/dashboards-squad,false,false,false
alertingApiServer,experimental,@grafana/alerting-squad,false,true,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 cloudWatchRoundUpEndTime,GA,@grafana/aws-datasources,false,false,false
cloudwatchMetricInsightsCrossAccount,preview,@grafana/aws-datasources,false,false,true cloudwatchMetricInsightsCrossAccount,preview,@grafana/aws-datasources,false,false,true
prometheusAzureOverrideAudience,deprecated,@grafana/partner-datasources,false,false,false 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" FlagNotificationBanner = "notificationBanner"
// FlagDashboardRestore // FlagDashboardRestore
// Enables deleted dashboard restore feature (backend only) // Enables deleted dashboard restore feature
FlagDashboardRestore = "dashboardRestore" FlagDashboardRestore = "dashboardRestore"
// FlagDatasourceProxyDisableRBAC // FlagDatasourceProxyDisableRBAC
@ -727,10 +727,6 @@ const (
// Register Alerting APIs with the K8s API server // Register Alerting APIs with the K8s API server
FlagAlertingApiServer = "alertingApiServer" FlagAlertingApiServer = "alertingApiServer"
// FlagDashboardRestoreUI
// Enables the frontend to be able to restore a recently deleted dashboard
FlagDashboardRestoreUI = "dashboardRestoreUI"
// FlagCloudWatchRoundUpEndTime // FlagCloudWatchRoundUpEndTime
// Round up end time for metric queries to the next minute to avoid missing data // Round up end time for metric queries to the next minute to avoid missing data
FlagCloudWatchRoundUpEndTime = "cloudWatchRoundUpEndTime" FlagCloudWatchRoundUpEndTime = "cloudWatchRoundUpEndTime"

View File

@ -808,17 +808,18 @@
{ {
"metadata": { "metadata": {
"name": "dashboardRestore", "name": "dashboardRestore",
"resourceVersion": "1719321877748", "resourceVersion": "1728397491294",
"creationTimestamp": "2024-05-16T17:36:26Z", "creationTimestamp": "2024-05-16T17:36:26Z",
"annotations": { "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": { "spec": {
"description": "Enables deleted dashboard restore feature (backend only)", "description": "Enables deleted dashboard restore feature",
"stage": "experimental", "stage": "experimental",
"codeowner": "@grafana/search-and-storage", "codeowner": "@grafana/search-and-storage",
"hideFromAdminPage": true "hideFromAdminPage": true,
"expression": "false"
} }
}, },
{ {
@ -826,6 +827,7 @@
"name": "dashboardRestoreUI", "name": "dashboardRestoreUI",
"resourceVersion": "1720021873452", "resourceVersion": "1720021873452",
"creationTimestamp": "2024-06-25T14:43:13Z", "creationTimestamp": "2024-06-25T14:43:13Z",
"deletionTimestamp": "2024-10-08T14:24:51Z",
"annotations": { "annotations": {
"grafana.app/updatedTimestamp": "2024-07-03 15:51:13.452477 +0000 UTC" "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{ dashboardChildNavs = append(dashboardChildNavs, &navtree.NavLink{
Text: "Recently deleted", Text: "Recently deleted",
SubTitle: "Any items listed here for more than 30 days will be automatically 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} onEditTitle={showEditTitle ? onEditTitle : undefined}
actions={ actions={
<> <>
{config.featureToggles.dashboardRestore && config.featureToggles.dashboardRestoreUI && hasAdminRights && ( {config.featureToggles.dashboardRestore && hasAdminRights && (
<LinkButton <LinkButton
variant="secondary" variant="secondary"
href={getConfig().appSubUrl + '/dashboard/recently-deleted'} href={getConfig().appSubUrl + '/dashboard/recently-deleted'}

View File

@ -115,6 +115,6 @@ function trackAction(action: keyof typeof actionMap, selectedItems: Omit<Dashboa
dashboard: selectedDashboards.length, dashboard: selectedDashboards.length,
}, },
source: 'tree_actions', 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, folder: Object.keys(selectedItems.folder).length,
}, },
source: 'browse_dashboards', source: 'browse_dashboards',
restore_enabled: config.featureToggles.dashboardRestoreUI, restore_enabled: config.featureToggles.dashboardRestore,
}); });
setIsDeleting(true); setIsDeleting(true);
try { try {

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@ export const SaveDashboardErrorProxy = ({
setErrorIsHandled, setErrorIsHandled,
}: SaveDashboardErrorProxyProps) => { }: SaveDashboardErrorProxyProps) => {
const { onDashboardSave } = useDashboardSave(); const { onDashboardSave } = useDashboardSave();
const isRestoreDashboardsEnabled = config.featureToggles.dashboardRestore && config.featureToggles.dashboardRestoreUI; const isRestoreDashboardsEnabled = config.featureToggles.dashboardRestore;
return ( return (
<> <>
{error.data && error.data.status === 'version-mismatch' && ( {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') () => import(/* webpackChunkName: "SnapshotListPage" */ 'app/features/manage-dashboards/SnapshotListPage')
), ),
}, },
config.featureToggles.dashboardRestoreUI && { config.featureToggles.dashboardRestore && {
path: '/dashboard/recently-deleted', path: '/dashboard/recently-deleted',
roles: () => ['Admin'], roles: () => ['Admin', 'ServerAdmin'],
component: SafeDynamicImport( component: SafeDynamicImport(
() => import(/* webpackChunkName: "RecentlyDeletedPage" */ 'app/features/browse-dashboards/RecentlyDeletedPage') () => import(/* webpackChunkName: "RecentlyDeletedPage" */ 'app/features/browse-dashboards/RecentlyDeletedPage')
), ),