From b8e92aacd25184bd87f601c35eca2102280c5ecf Mon Sep 17 00:00:00 2001 From: Juan Cabanas Date: Wed, 20 Nov 2024 11:36:19 -0300 Subject: [PATCH] PublicDashboards: Remove publicDashboards FF (#96578) --- .../feature-toggles/index.md | 121 +++++++++--------- .../src/types/featureToggles.gen.ts | 1 - pkg/api/api.go | 2 +- pkg/api/dashboard.go | 2 +- pkg/services/featuremgmt/registry.go | 8 -- pkg/services/featuremgmt/toggles_gen.csv | 1 - pkg/services/featuremgmt/toggles_gen.go | 4 - pkg/services/featuremgmt/toggles_gen.json | 1 + pkg/services/navtree/navtreeimpl/navtree.go | 2 +- pkg/services/publicdashboards/api/api.go | 6 +- pkg/services/publicdashboards/api/api_test.go | 19 +-- .../publicdashboards/api/common_test.go | 4 - .../publicdashboards/api/query_test.go | 8 +- .../app/features/admin/UserListPage.test.tsx | 1 - .../sharing/ShareButton/ShareMenu.test.tsx | 2 - .../SharePublicDashboard.test.tsx | 8 -- .../SharePublicDashboardUtils.ts | 2 +- .../containers/PublicDashboardPage.test.tsx | 5 +- public/app/features/dashboard/routes.ts | 2 +- 19 files changed, 78 insertions(+), 121 deletions(-) diff --git a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md index 5537f1d1e73..80eb722167b 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -21,67 +21,66 @@ For more information about feature release stages, refer to [Release life cycle Most [generally available](https://grafana.com/docs/release-life-cycle/#general-availability) features are enabled by default. You can disable these feature by setting the feature flag to "false" in the configuration. -| Feature toggle name | Description | Enabled by default | -| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -| `disableEnvelopeEncryption` | Disable envelope encryption (emergency only) | | -| `publicDashboards` | [Deprecated] Public dashboards are now enabled by default; to disable them, use the configuration setting. This feature toggle will be removed in the next major version. | Yes | -| `publicDashboardsScene` | Enables public dashboard rendering using scenes | Yes | -| `featureHighlights` | Highlight Grafana Enterprise features | | -| `correlations` | Correlations page | Yes | -| `cloudWatchCrossAccountQuerying` | Enables cross-account querying in CloudWatch datasources | Yes | -| `accessControlOnCall` | Access control primitives for OnCall | Yes | -| `nestedFolders` | Enable folder nesting | Yes | -| `logsContextDatasourceUi` | Allow datasource to provide custom UI for context view | Yes | -| `lokiQuerySplitting` | Split large interval queries into subqueries with smaller time intervals | Yes | -| `prometheusMetricEncyclopedia` | Adds the metrics explorer component to the Prometheus query builder as an option in metric select | Yes | -| `influxdbBackendMigration` | Query InfluxDB InfluxQL without the proxy | Yes | -| `lokiMetricDataplane` | Changes metric responses from Loki to be compliant with the dataplane specification. | Yes | -| `dataplaneFrontendFallback` | Support dataplane contract field name change for transformations and field name matchers where the name is different | Yes | -| `recordedQueriesMulti` | Enables writing multiple items from a single query within Recorded Queries | Yes | -| `logsExploreTableVisualisation` | A table visualisation for logs in Explore | Yes | -| `transformationsRedesign` | Enables the transformations redesign | Yes | -| `traceQLStreaming` | Enables response streaming of TraceQL queries of the Tempo data source | | -| `awsAsyncQueryCaching` | Enable caching for async queries for Redshift and Athena. Requires that the datasource has caching and async query support enabled | Yes | -| `prometheusConfigOverhaulAuth` | Update the Prometheus configuration page with the new auth component | Yes | -| `alertingNoDataErrorExecution` | Changes how Alerting state manager handles execution of NoData/Error | Yes | -| `angularDeprecationUI` | Display Angular warnings in dashboards and panels | Yes | -| `dashgpt` | Enable AI powered features in dashboards | Yes | -| `alertingInsights` | Show the new alerting insights landing page | Yes | -| `panelMonitoring` | Enables panel monitoring through logs and measurements | Yes | -| `formatString` | Enable format string transformer | Yes | -| `transformationsVariableSupport` | Allows using variables in transformations | Yes | -| `kubernetesPlaylists` | Use the kubernetes API in the frontend for playlists, and route /api/playlist requests to k8s | Yes | -| `recoveryThreshold` | Enables feature recovery threshold (aka hysteresis) for threshold server-side expression | Yes | -| `lokiStructuredMetadata` | Enables the loki data source to request structured metadata from the Loki server | Yes | -| `managedPluginsInstall` | Install managed plugins directly from plugins catalog | Yes | -| `addFieldFromCalculationStatFunctions` | Add cumulative and window functions to the add field from calculation transformation | Yes | -| `annotationPermissionUpdate` | Change the way annotation permissions work by scoping them to folders and dashboards. | Yes | -| `dashboardSceneForViewers` | Enables dashboard rendering using Scenes for viewer roles | Yes | -| `dashboardSceneSolo` | Enables rendering dashboards using scenes for solo panels | Yes | -| `dashboardScene` | Enables dashboard rendering using scenes for all roles | Yes | -| `ssoSettingsApi` | Enables the SSO settings API and the OAuth configuration UIs in Grafana | Yes | -| `logsInfiniteScrolling` | Enables infinite scrolling for the Logs panel in Explore and Dashboards | Yes | -| `exploreMetrics` | Enables the new Explore Metrics core app | Yes | -| `alertingSimplifiedRouting` | Enables users to easily configure alert notifications by specifying a contact point directly when editing or creating an alert rule | Yes | -| `logRowsPopoverMenu` | Enable filtering menu displayed when text of a log line is selected | Yes | -| `lokiQueryHints` | Enables query hints for Loki | Yes | -| `alertingQueryOptimization` | Optimizes eligible queries in order to reduce load on datasources | | -| `promQLScope` | In-development feature that will allow injection of labels into prometheus queries. | Yes | -| `groupToNestedTableTransformation` | Enables the group to nested table transformation | Yes | -| `tlsMemcached` | Use TLS-enabled memcached in the enterprise caching feature | Yes | -| `cloudWatchNewLabelParsing` | Updates CloudWatch label parsing to be more accurate | Yes | -| `accessActionSets` | Introduces action sets for resource permissions. Also ensures that all folder editors and admins can create subfolders without needing any additional permissions. | Yes | -| `newDashboardSharingComponent` | Enables the new sharing drawer design | | -| `notificationBanner` | Enables the notification banner UI and API | Yes | -| `pluginProxyPreserveTrailingSlash` | Preserve plugin proxy trailing slash. | | -| `pinNavItems` | Enables pinning of nav items | Yes | -| `openSearchBackendFlowEnabled` | Enables the backend query flow for Open Search datasource plugin | Yes | -| `cloudWatchRoundUpEndTime` | Round up end time for metric queries to the next minute to avoid missing data | Yes | -| `cloudwatchMetricInsightsCrossAccount` | Enables cross account observability for Cloudwatch Metric Insights query builder | Yes | -| `singleTopNav` | Unifies the top search bar and breadcrumb bar into one | Yes | -| `azureMonitorDisableLogLimit` | Disables the log limit restriction for Azure Monitor when true. The limit is enabled by default. | | -| `preinstallAutoUpdate` | Enables automatic updates for pre-installed plugins | Yes | -| `alertingUIOptimizeReducer` | Enables removing the reducer from the alerting UI when creating a new alert rule and using instant query | Yes | +| Feature toggle name | Description | Enabled by default | +| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------ | +| `disableEnvelopeEncryption` | Disable envelope encryption (emergency only) | | +| `publicDashboardsScene` | Enables public dashboard rendering using scenes | Yes | +| `featureHighlights` | Highlight Grafana Enterprise features | | +| `correlations` | Correlations page | Yes | +| `cloudWatchCrossAccountQuerying` | Enables cross-account querying in CloudWatch datasources | Yes | +| `accessControlOnCall` | Access control primitives for OnCall | Yes | +| `nestedFolders` | Enable folder nesting | Yes | +| `logsContextDatasourceUi` | Allow datasource to provide custom UI for context view | Yes | +| `lokiQuerySplitting` | Split large interval queries into subqueries with smaller time intervals | Yes | +| `prometheusMetricEncyclopedia` | Adds the metrics explorer component to the Prometheus query builder as an option in metric select | Yes | +| `influxdbBackendMigration` | Query InfluxDB InfluxQL without the proxy | Yes | +| `lokiMetricDataplane` | Changes metric responses from Loki to be compliant with the dataplane specification. | Yes | +| `dataplaneFrontendFallback` | Support dataplane contract field name change for transformations and field name matchers where the name is different | Yes | +| `recordedQueriesMulti` | Enables writing multiple items from a single query within Recorded Queries | Yes | +| `logsExploreTableVisualisation` | A table visualisation for logs in Explore | Yes | +| `transformationsRedesign` | Enables the transformations redesign | Yes | +| `traceQLStreaming` | Enables response streaming of TraceQL queries of the Tempo data source | | +| `awsAsyncQueryCaching` | Enable caching for async queries for Redshift and Athena. Requires that the datasource has caching and async query support enabled | Yes | +| `prometheusConfigOverhaulAuth` | Update the Prometheus configuration page with the new auth component | Yes | +| `alertingNoDataErrorExecution` | Changes how Alerting state manager handles execution of NoData/Error | Yes | +| `angularDeprecationUI` | Display Angular warnings in dashboards and panels | Yes | +| `dashgpt` | Enable AI powered features in dashboards | Yes | +| `alertingInsights` | Show the new alerting insights landing page | Yes | +| `panelMonitoring` | Enables panel monitoring through logs and measurements | Yes | +| `formatString` | Enable format string transformer | Yes | +| `transformationsVariableSupport` | Allows using variables in transformations | Yes | +| `kubernetesPlaylists` | Use the kubernetes API in the frontend for playlists, and route /api/playlist requests to k8s | Yes | +| `recoveryThreshold` | Enables feature recovery threshold (aka hysteresis) for threshold server-side expression | Yes | +| `lokiStructuredMetadata` | Enables the loki data source to request structured metadata from the Loki server | Yes | +| `managedPluginsInstall` | Install managed plugins directly from plugins catalog | Yes | +| `addFieldFromCalculationStatFunctions` | Add cumulative and window functions to the add field from calculation transformation | Yes | +| `annotationPermissionUpdate` | Change the way annotation permissions work by scoping them to folders and dashboards. | Yes | +| `dashboardSceneForViewers` | Enables dashboard rendering using Scenes for viewer roles | Yes | +| `dashboardSceneSolo` | Enables rendering dashboards using scenes for solo panels | Yes | +| `dashboardScene` | Enables dashboard rendering using scenes for all roles | Yes | +| `ssoSettingsApi` | Enables the SSO settings API and the OAuth configuration UIs in Grafana | Yes | +| `logsInfiniteScrolling` | Enables infinite scrolling for the Logs panel in Explore and Dashboards | Yes | +| `exploreMetrics` | Enables the new Explore Metrics core app | Yes | +| `alertingSimplifiedRouting` | Enables users to easily configure alert notifications by specifying a contact point directly when editing or creating an alert rule | Yes | +| `logRowsPopoverMenu` | Enable filtering menu displayed when text of a log line is selected | Yes | +| `lokiQueryHints` | Enables query hints for Loki | Yes | +| `alertingQueryOptimization` | Optimizes eligible queries in order to reduce load on datasources | | +| `promQLScope` | In-development feature that will allow injection of labels into prometheus queries. | Yes | +| `groupToNestedTableTransformation` | Enables the group to nested table transformation | Yes | +| `tlsMemcached` | Use TLS-enabled memcached in the enterprise caching feature | Yes | +| `cloudWatchNewLabelParsing` | Updates CloudWatch label parsing to be more accurate | Yes | +| `accessActionSets` | Introduces action sets for resource permissions. Also ensures that all folder editors and admins can create subfolders without needing any additional permissions. | Yes | +| `newDashboardSharingComponent` | Enables the new sharing drawer design | | +| `notificationBanner` | Enables the notification banner UI and API | Yes | +| `pluginProxyPreserveTrailingSlash` | Preserve plugin proxy trailing slash. | | +| `pinNavItems` | Enables pinning of nav items | Yes | +| `openSearchBackendFlowEnabled` | Enables the backend query flow for Open Search datasource plugin | Yes | +| `cloudWatchRoundUpEndTime` | Round up end time for metric queries to the next minute to avoid missing data | Yes | +| `cloudwatchMetricInsightsCrossAccount` | Enables cross account observability for Cloudwatch Metric Insights query builder | Yes | +| `singleTopNav` | Unifies the top search bar and breadcrumb bar into one | Yes | +| `azureMonitorDisableLogLimit` | Disables the log limit restriction for Azure Monitor when true. The limit is enabled by default. | | +| `preinstallAutoUpdate` | Enables automatic updates for pre-installed plugins | Yes | +| `alertingUIOptimizeReducer` | Enables removing the reducer from the alerting UI when creating a new alert rule and using instant query | Yes | ## Public preview feature toggles diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index d4725a2ddfc..bc13567d445 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -22,7 +22,6 @@ export interface FeatureToggles { ['live-service-web-worker']?: boolean; queryOverLive?: boolean; panelTitleSearch?: boolean; - publicDashboards?: boolean; publicDashboardsEmailSharing?: boolean; publicDashboardsScene?: boolean; lokiExperimentalStreaming?: boolean; diff --git a/pkg/api/api.go b/pkg/api/api.go index adf60b406d7..10b62c61edf 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -165,7 +165,7 @@ func (hs *HTTPServer) registerRoutes() { r.Get("/dashboards/*", reqSignedIn, hs.Index) r.Get("/goto/:uid", reqSignedIn, hs.redirectFromShortURL, hs.Index) - if hs.Features.IsEnabledGlobally(featuremgmt.FlagPublicDashboards) && hs.Cfg.PublicDashboardsEnabled { + if hs.Cfg.PublicDashboardsEnabled { // list public dashboards r.Get("/public-dashboards/list", reqSignedIn, hs.Index) diff --git a/pkg/api/dashboard.go b/pkg/api/dashboard.go index 82af44e30a4..9ac9a75d9b2 100644 --- a/pkg/api/dashboard.go +++ b/pkg/api/dashboard.go @@ -101,7 +101,7 @@ func (hs *HTTPServer) GetDashboard(c *contextmodel.ReqContext) response.Response ) // If public dashboards is enabled and we have a public dashboard, update meta values - if hs.Features.IsEnabledGlobally(featuremgmt.FlagPublicDashboards) && hs.Cfg.PublicDashboardsEnabled { + if hs.Cfg.PublicDashboardsEnabled { publicDashboard, err := hs.PublicDashboardsApi.PublicDashboardService.FindByDashboardUid(ctx, c.SignedInUser.GetOrgID(), dash.UID) if err != nil && !errors.Is(err, publicdashboardModels.ErrPublicDashboardNotFound) { return response.Error(http.StatusInternalServerError, "Error while retrieving public dashboards", err) diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 5b9c896da78..e0479cf21d8 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -48,14 +48,6 @@ var ( Owner: grafanaSearchAndStorageSquad, HideFromAdminPage: true, }, - { - Name: "publicDashboards", - Description: "[Deprecated] Public dashboards are now enabled by default; to disable them, use the configuration setting. This feature toggle will be removed in the next major version.", - Stage: FeatureStageGeneralAvailability, - Owner: grafanaSharingSquad, - Expression: "true", // enabled by default - AllowSelfServe: true, - }, { Name: "publicDashboardsEmailSharing", Description: "Enables public dashboard sharing to be restricted to only allowed emails", diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index c2c16c42a24..bf16af29d46 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -3,7 +3,6 @@ disableEnvelopeEncryption,GA,@grafana/grafana-as-code,false,false,false live-service-web-worker,experimental,@grafana/dashboards-squad,false,false,true queryOverLive,experimental,@grafana/dashboards-squad,false,false,true panelTitleSearch,preview,@grafana/search-and-storage,false,false,false -publicDashboards,GA,@grafana/sharing-squad,false,false,false publicDashboardsEmailSharing,preview,@grafana/sharing-squad,false,false,false publicDashboardsScene,GA,@grafana/sharing-squad,false,false,true lokiExperimentalStreaming,experimental,@grafana/observability-logs,false,false,false diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index e4b508f069c..8578b6d27b0 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -23,10 +23,6 @@ const ( // Search for dashboards using panel title FlagPanelTitleSearch = "panelTitleSearch" - // FlagPublicDashboards - // [Deprecated] Public dashboards are now enabled by default; to disable them, use the configuration setting. This feature toggle will be removed in the next major version. - FlagPublicDashboards = "publicDashboards" - // FlagPublicDashboardsEmailSharing // Enables public dashboard sharing to be restricted to only allowed emails FlagPublicDashboardsEmailSharing = "publicDashboardsEmailSharing" diff --git a/pkg/services/featuremgmt/toggles_gen.json b/pkg/services/featuremgmt/toggles_gen.json index 31745d2b3c8..f1f7a7cd6d4 100644 --- a/pkg/services/featuremgmt/toggles_gen.json +++ b/pkg/services/featuremgmt/toggles_gen.json @@ -2833,6 +2833,7 @@ "name": "publicDashboards", "resourceVersion": "1720021873452", "creationTimestamp": "2022-04-07T18:30:19Z", + "deletionTimestamp": "2024-11-15T16:38:53Z", "annotations": { "grafana.app/updatedTimestamp": "2024-07-03 15:51:13.452477 +0000 UTC" } diff --git a/pkg/services/navtree/navtreeimpl/navtree.go b/pkg/services/navtree/navtreeimpl/navtree.go index 7db5ee4a8cc..255f3452e36 100644 --- a/pkg/services/navtree/navtreeimpl/navtree.go +++ b/pkg/services/navtree/navtreeimpl/navtree.go @@ -380,7 +380,7 @@ func (s *ServiceImpl) buildDashboardNavLinks(c *contextmodel.ReqContext) []*navt Icon: "library-panel", }) - if s.features.IsEnabled(c.Req.Context(), featuremgmt.FlagPublicDashboards) && s.cfg.PublicDashboardsEnabled { + if s.cfg.PublicDashboardsEnabled { dashboardChildNavs = append(dashboardChildNavs, &navtree.NavLink{ Text: "Public dashboards", Id: "dashboards/public", diff --git a/pkg/services/publicdashboards/api/api.go b/pkg/services/publicdashboards/api/api.go index cbbbcf605f0..eda1a4a249e 100644 --- a/pkg/services/publicdashboards/api/api.go +++ b/pkg/services/publicdashboards/api/api.go @@ -55,14 +55,10 @@ func ProvideApi( } // register endpoints if the feature is enabled - if features.IsEnabledGlobally(featuremgmt.FlagPublicDashboards) && cfg.PublicDashboardsEnabled { + if cfg.PublicDashboardsEnabled { api.RegisterAPIEndpoints() } - if !features.IsEnabledGlobally(featuremgmt.FlagPublicDashboards) { - api.log.Warn("[Deprecated] The publicDashboards feature toggle will be removed in Grafana v11. To disable the public dashboards feature, use the public_dashboards.enabled setting.") - } - return api } diff --git a/pkg/services/publicdashboards/api/api_test.go b/pkg/services/publicdashboards/api/api_test.go index d76d0239a41..a05ad2a14ff 100644 --- a/pkg/services/publicdashboards/api/api_test.go +++ b/pkg/services/publicdashboards/api/api_test.go @@ -74,14 +74,7 @@ func TestAPIFeatureDisabled(t *testing.T) { cfg := setting.NewCfg() cfg.PublicDashboardsEnabled = false service := publicdashboards.NewFakePublicDashboardService(t) - testServer := setupTestServer(t, cfg, service, userAdmin, true) - response := callAPI(testServer, test.Method, test.Path, nil, t) - assert.Equal(t, http.StatusNotFound, response.Code) - }) - - t.Run(test.Name+" - feature flag disabled", func(t *testing.T) { - service := publicdashboards.NewFakePublicDashboardService(t) - testServer := setupTestServer(t, nil, service, userAdmin, false) + testServer := setupTestServer(t, cfg, service, userAdmin) response := callAPI(testServer, test.Method, test.Path, nil, t) assert.Equal(t, http.StatusNotFound, response.Code) }) @@ -136,7 +129,7 @@ func TestAPIListPublicDashboard(t *testing.T) { service.On("FindAllWithPagination", mock.Anything, mock.Anything, mock.Anything). Return(test.Response, test.ResponseErr).Maybe() - testServer := setupTestServer(t, nil, service, test.User, true) + testServer := setupTestServer(t, nil, service, test.User) response := callAPI(testServer, http.MethodGet, "/api/dashboards/public-dashboards", nil, t) assert.Equal(t, test.ExpectedHttpResponse, response.Code) @@ -263,7 +256,7 @@ func TestAPIDeletePublicDashboard(t *testing.T) { Return(test.ResponseErr) } - testServer := setupTestServer(t, nil, service, test.User, true) + testServer := setupTestServer(t, nil, service, test.User) response := callAPI(testServer, http.MethodDelete, fmt.Sprintf("/api/dashboards/uid/%s/public-dashboards/%s", test.DashboardUid, test.PublicDashboardUid), nil, t) assert.Equal(t, test.ExpectedHttpResponse, response.Code) @@ -345,7 +338,7 @@ func TestAPIGetPublicDashboard(t *testing.T) { Return(test.PublicDashboardResult, test.PublicDashboardErr) } - testServer := setupTestServer(t, nil, service, test.User, true) + testServer := setupTestServer(t, nil, service, test.User) response := callAPI( testServer, @@ -463,7 +456,7 @@ func TestApiCreatePublicDashboard(t *testing.T) { Return(&PublicDashboard{IsEnabled: true}, test.SaveDashboardErr) } - testServer := setupTestServer(t, nil, service, test.User, true) + testServer := setupTestServer(t, nil, service, test.User) response := callAPI( testServer, @@ -597,7 +590,7 @@ func TestAPIUpdatePublicDashboard(t *testing.T) { Return(test.ExpectedResponse, test.ExpectedError) } - testServer := setupTestServer(t, nil, service, test.User, true) + testServer := setupTestServer(t, nil, service, test.User) url := fmt.Sprintf("/api/dashboards/uid/%s/public-dashboards/%s", test.DashboardUid, test.PublicDashboardUid) body := strings.NewReader(test.Body) diff --git a/pkg/services/publicdashboards/api/common_test.go b/pkg/services/publicdashboards/api/common_test.go index 4c02be71c97..85de1714450 100644 --- a/pkg/services/publicdashboards/api/common_test.go +++ b/pkg/services/publicdashboards/api/common_test.go @@ -50,7 +50,6 @@ func setupTestServer( cfg *setting.Cfg, service publicdashboards.Service, user *user.SignedInUser, - ffEnabled bool, ) *web.Mux { t.Helper() @@ -66,9 +65,6 @@ func setupTestServer( m.Use(contextProvider(&testContext{user})) features := featuremgmt.WithFeatures() - if ffEnabled { - features = featuremgmt.WithFeatures(featuremgmt.FlagPublicDashboards) - } if cfg == nil { cfg = setting.NewCfg() diff --git a/pkg/services/publicdashboards/api/query_test.go b/pkg/services/publicdashboards/api/query_test.go index e94df756efa..10bd3b23a70 100644 --- a/pkg/services/publicdashboards/api/query_test.go +++ b/pkg/services/publicdashboards/api/query_test.go @@ -104,7 +104,7 @@ func TestAPIViewPublicDashboard(t *testing.T) { service.On("GetPublicDashboardForView", mock.Anything, mock.AnythingOfType("string")). Return(test.DashboardResult, test.Err).Maybe() - testServer := setupTestServer(t, nil, service, anonymousUser, true) + testServer := setupTestServer(t, nil, service, anonymousUser) response := callAPI(testServer, http.MethodGet, fmt.Sprintf("/api/public/dashboards/%s", test.AccessToken), @@ -193,7 +193,7 @@ func TestAPIQueryPublicDashboard(t *testing.T) { setup := func(enabled bool) (*web.Mux, *publicdashboards.FakePublicDashboardService) { service := publicdashboards.NewFakePublicDashboardService(t) - testServer := setupTestServer(t, nil, service, anonymousUser, true) + testServer := setupTestServer(t, nil, service, anonymousUser) return testServer, service } @@ -337,7 +337,7 @@ func TestIntegrationUnauthenticatedUserCanGetPubdashPanelQueryData(t *testing.T) require.NoError(t, err) // setup test server - server := setupTestServer(t, cfg, pds, anonymousUser, true) + server := setupTestServer(t, cfg, pds, anonymousUser) resp := callAPI(server, http.MethodPost, fmt.Sprintf("/api/public/dashboards/%s/panels/1/query", pubdash.AccessToken), @@ -420,7 +420,7 @@ func TestAPIGetAnnotations(t *testing.T) { Return(test.Annotations, test.ServiceError).Once() } - testServer := setupTestServer(t, nil, service, anonymousUser, true) + testServer := setupTestServer(t, nil, service, anonymousUser) path := fmt.Sprintf("/api/public/dashboards/%s/annotations?from=%s&to=%s", test.AccessToken, test.From, test.To) response := callAPI(testServer, http.MethodGet, path, nil, t) diff --git a/public/app/features/admin/UserListPage.test.tsx b/public/app/features/admin/UserListPage.test.tsx index 86e34581877..a59246fca23 100644 --- a/public/app/features/admin/UserListPage.test.tsx +++ b/public/app/features/admin/UserListPage.test.tsx @@ -38,7 +38,6 @@ const renderPage = () => { const enableEmailSharing = () => { config.featureToggles.publicDashboardsEmailSharing = true; - config.featureToggles.publicDashboards = true; config.licenseInfo = { ...config.licenseInfo, enabledFeatures: { publicDashboardsEmailSharing: true } }; }; diff --git a/public/app/features/dashboard-scene/sharing/ShareButton/ShareMenu.test.tsx b/public/app/features/dashboard-scene/sharing/ShareButton/ShareMenu.test.tsx index 0e7940e34d1..27271c66246 100644 --- a/public/app/features/dashboard-scene/sharing/ShareButton/ShareMenu.test.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareButton/ShareMenu.test.tsx @@ -28,7 +28,6 @@ describe('ShareMenu', () => { Object.defineProperty(contextSrv, 'isSignedIn', { value: true, }); - config.featureToggles.publicDashboards = true; config.publicDashboardsEnabled = true; config.snapshotEnabled = true; setup({ meta: { canEdit: true } }); @@ -38,7 +37,6 @@ describe('ShareMenu', () => { expect(await screen.findByTestId(selector.shareSnapshot)).toBeInTheDocument(); }); it('should not share externally when public dashboard is disabled', async () => { - config.featureToggles.publicDashboards = false; config.publicDashboardsEnabled = false; setup(); diff --git a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboard.test.tsx b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboard.test.tsx index a0cf8085e08..12d213f8501 100644 --- a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboard.test.tsx +++ b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboard.test.tsx @@ -68,7 +68,6 @@ beforeAll(() => { }); beforeEach(() => { - config.featureToggles.publicDashboards = true; config.publicDashboardsEnabled = true; jest.spyOn(contextSrv, 'hasPermission').mockReturnValue(true); @@ -151,13 +150,6 @@ describe('SharePublic', () => { expect(screen.getByRole('tablist')).toHaveTextContent('Link'); expect(screen.getByRole('tablist')).not.toHaveTextContent('Public dashboard'); }); - it('does not render share panel when public dashboards feature is disabled using feature toggle', async () => { - config.featureToggles.publicDashboards = false; - await renderSharePublicDashboard(undefined, false); - - expect(screen.getByRole('tablist')).toHaveTextContent('Link'); - expect(screen.getByRole('tablist')).not.toHaveTextContent('Public dashboard'); - }); it('renders default relative time in settings summary when they are closed', async () => { expect(mockDashboard.time).toEqual({ from: 'now-6h', to: 'now' }); diff --git a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.ts b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.ts index dde37ece294..34de4860b99 100644 --- a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.ts +++ b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils.ts @@ -95,7 +95,7 @@ export const generatePublicDashboardConfigUrl = (dashboardUid: string, dashboard export const validEmailRegex = /^[A-Z\d._%+-]+@[A-Z\d.-]+\.[A-Z]{2,}$/i; export const isPublicDashboardsEnabled = () => { - return Boolean(config.featureToggles.publicDashboards) && config.publicDashboardsEnabled; + return config.publicDashboardsEnabled; }; export const isEmailSharingEnabled = () => diff --git a/public/app/features/dashboard/containers/PublicDashboardPage.test.tsx b/public/app/features/dashboard/containers/PublicDashboardPage.test.tsx index d3e509db17c..b5b96868e02 100644 --- a/public/app/features/dashboard/containers/PublicDashboardPage.test.tsx +++ b/public/app/features/dashboard/containers/PublicDashboardPage.test.tsx @@ -6,8 +6,7 @@ import { Props as AutoSizerProps } from 'react-virtualized-auto-sizer'; import { render } from 'test/test-utils'; import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src'; -import { Dashboard, DashboardCursorSync, FieldConfigSource, ThresholdsMode, Panel } from '@grafana/schema/src'; -import config from 'app/core/config'; +import { Dashboard, DashboardCursorSync, FieldConfigSource, Panel, ThresholdsMode } from '@grafana/schema/src'; import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps'; import * as appTypes from 'app/types'; import { DashboardInitPhase, DashboardMeta, DashboardRoutes } from 'app/types'; @@ -122,8 +121,6 @@ const dashboardBase = { describe('PublicDashboardPage', () => { beforeEach(() => { - config.featureToggles.publicDashboards = true; - jest.clearAllMocks(); }); diff --git a/public/app/features/dashboard/routes.ts b/public/app/features/dashboard/routes.ts index 127d57b118e..4c20ec7229f 100644 --- a/public/app/features/dashboard/routes.ts +++ b/public/app/features/dashboard/routes.ts @@ -4,7 +4,7 @@ import { RouteDescriptor } from '../../core/navigation/types'; import { DashboardRoutes } from '../../types'; export const getPublicDashboardRoutes = (): RouteDescriptor[] => { - if (!config.publicDashboardsEnabled || !config.featureToggles.publicDashboards) { + if (!config.publicDashboardsEnabled) { return []; }