Chore: Remove returnToPrevious feature toggle (#88332)

This commit is contained in:
Laura Fernández
2024-05-27 17:47:57 +02:00
committed by GitHub
parent 08b18113d2
commit 6d98f53e8b
11 changed files with 5 additions and 40 deletions

View File

@@ -28,7 +28,6 @@ For more information about feature release stages, refer to [Release life cycle
| `featureHighlights` | Highlight Grafana Enterprise features | |
| `correlations` | Correlations page | Yes |
| `exploreContentOutline` | Content outline sidebar | Yes |
| `returnToPrevious` | Enables the return to previous context functionality | Yes |
| `cloudWatchCrossAccountQuerying` | Enables cross-account querying in CloudWatch datasources | Yes |
| `nestedFolders` | Enable folder nesting | Yes |
| `nestedFolderPicker` | Enables the new folder picker to work with nested folders. Requires the nestedFolders feature toggle | Yes |

View File

@@ -3,9 +3,6 @@ import { e2e } from '../utils';
describe('ReturnToPrevious button', () => {
beforeEach(() => {
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
cy.window().then((win) => {
win.localStorage.setItem('grafana.featureToggles', 'returnToPrevious=1');
});
cy.visit('/alerting/list');
e2e.components.AlertRules.groupToggle().first().click();

View File

@@ -44,7 +44,6 @@ export interface FeatureToggles {
disableSecretsCompatibility?: boolean;
logRequestsInstrumentedAsUnknown?: boolean;
topnav?: boolean;
returnToPrevious?: boolean;
grpcServer?: boolean;
unifiedStorage?: boolean;
dualWritePlaylistsMode2?: boolean;

View File

@@ -206,14 +206,6 @@ var (
Expression: "true", // enabled by default
Owner: grafanaFrontendPlatformSquad,
},
{
Name: "returnToPrevious",
Description: "Enables the return to previous context functionality",
Stage: FeatureStageGeneralAvailability,
FrontendOnly: true,
Expression: "true", // enabled by default
Owner: grafanaFrontendPlatformSquad,
},
{
Name: "grpcServer",
Description: "Run the GRPC server",

View File

@@ -25,7 +25,6 @@ scenes,experimental,@grafana/dashboards-squad,false,false,true
disableSecretsCompatibility,experimental,@grafana/hosted-grafana-team,false,true,false
logRequestsInstrumentedAsUnknown,experimental,@grafana/hosted-grafana-team,false,false,false
topnav,deprecated,@grafana/grafana-frontend-platform,false,false,false
returnToPrevious,GA,@grafana/grafana-frontend-platform,false,false,true
grpcServer,preview,@grafana/grafana-app-platform-squad,false,false,false
unifiedStorage,experimental,@grafana/grafana-app-platform-squad,false,true,false
dualWritePlaylistsMode2,experimental,@grafana/search-and-storage,false,false,false
1 Name Stage Owner requiresDevMode RequiresRestart FrontendOnly
25 disableSecretsCompatibility experimental @grafana/hosted-grafana-team false true false
26 logRequestsInstrumentedAsUnknown experimental @grafana/hosted-grafana-team false false false
27 topnav deprecated @grafana/grafana-frontend-platform false false false
returnToPrevious GA @grafana/grafana-frontend-platform false false true
28 grpcServer preview @grafana/grafana-app-platform-squad false false false
29 unifiedStorage experimental @grafana/grafana-app-platform-squad false true false
30 dualWritePlaylistsMode2 experimental @grafana/search-and-storage false false false

View File

@@ -111,10 +111,6 @@ const (
// Enables topnav support in external plugins. The new Grafana navigation cannot be disabled.
FlagTopnav = "topnav"
// FlagReturnToPrevious
// Enables the return to previous context functionality
FlagReturnToPrevious = "returnToPrevious"
// FlagGrpcServer
// Run the GRPC server
FlagGrpcServer = "grpcServer"

View File

@@ -60,7 +60,8 @@
"metadata": {
"name": "returnToPrevious",
"resourceVersion": "1716448665531",
"creationTimestamp": "2024-05-23T07:17:45Z"
"creationTimestamp": "2024-05-23T07:17:45Z",
"deletionTimestamp": "2024-05-27T09:59:33Z"
},
"spec": {
"description": "Enables the return to previous context functionality",

View File

@@ -5,7 +5,6 @@ import React, { PropsWithChildren, useEffect } from 'react';
import { GrafanaTheme2 } from '@grafana/data';
import { locationSearchToObject, locationService } from '@grafana/runtime';
import { useStyles2, LinkButton, useTheme2 } from '@grafana/ui';
import config from 'app/core/config';
import { useGrafana } from 'app/core/context/GrafanaContext';
import { useMediaQueryChange } from 'app/core/hooks/useMediaQueryChange';
import store from 'app/core/store';
@@ -55,8 +54,7 @@ export function AppChrome({ children }: Props) {
const { pathname, search } = locationService.getLocation();
const url = pathname + search;
const shouldShowReturnToPrevious =
config.featureToggles.returnToPrevious && state.returnToPrevious && url !== state.returnToPrevious.href;
const shouldShowReturnToPrevious = state.returnToPrevious && url !== state.returnToPrevious.href;
// Clear returnToPrevious when the page is manually navigated to
useEffect(() => {

View File

@@ -90,10 +90,6 @@ export class AppChromeService {
}
public setReturnToPrevious = (returnToPrevious: ReturnToPreviousProps) => {
const isReturnToPreviousEnabled = config.featureToggles.returnToPrevious;
if (!isReturnToPreviousEnabled) {
return;
}
const previousPage = this.state.getValue().returnToPrevious;
reportInteraction('grafana_return_to_previous_button_created', {
page: returnToPrevious.href,
@@ -105,10 +101,6 @@ export class AppChromeService {
};
public clearReturnToPrevious = (interactionAction: 'clicked' | 'dismissed' | 'auto_dismissed') => {
const isReturnToPreviousEnabled = config.featureToggles.returnToPrevious;
if (!isReturnToPreviousEnabled) {
return;
}
const existingRtp = this.state.getValue().returnToPrevious;
if (existingRtp) {
reportInteraction('grafana_return_to_previous_button_dismissed', {

View File

@@ -4,7 +4,7 @@ import React from 'react';
import { TestProvider } from 'test/helpers/TestProvider';
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
import { config, reportInteraction } from '@grafana/runtime';
import { reportInteraction } from '@grafana/runtime';
import { ReturnToPrevious, ReturnToPreviousProps } from './ReturnToPrevious';
@@ -36,14 +36,9 @@ const setup = () => {
};
describe('ReturnToPrevious', () => {
beforeEach(() => {
/* We enabled the feature toggle */
config.featureToggles.returnToPrevious = true;
});
afterEach(() => {
window.sessionStorage.clear();
jest.resetAllMocks();
config.featureToggles.returnToPrevious = false;
});
it('should render component', async () => {
setup();

View File

@@ -1,7 +1,7 @@
import React, { Fragment } from 'react';
import { textUtil } from '@grafana/data';
import { config, useReturnToPrevious } from '@grafana/runtime';
import { useReturnToPrevious } from '@grafana/runtime';
import { Button, LinkButton, Stack } from '@grafana/ui';
import { CombinedRule, RulesSource } from 'app/types/unified-alerting';
@@ -68,7 +68,6 @@ const RuleDetailsButtons = ({ rule, rulesSource }: Props) => {
}
if (rule.annotations[Annotation.dashboardUID]) {
const dashboardUID = rule.annotations[Annotation.dashboardUID];
const isReturnToPreviousEnabled = config.featureToggles.returnToPrevious;
if (dashboardUID) {
buttons.push(
<LinkButton
@@ -76,7 +75,6 @@ const RuleDetailsButtons = ({ rule, rulesSource }: Props) => {
key="dashboard"
variant="primary"
icon="apps"
target={isReturnToPreviousEnabled ? undefined : '_blank'}
href={`d/${encodeURIComponent(dashboardUID)}`}
onClick={() => {
setReturnToPrevious(rule.name);
@@ -93,7 +91,6 @@ const RuleDetailsButtons = ({ rule, rulesSource }: Props) => {
key="panel"
variant="primary"
icon="apps"
target={isReturnToPreviousEnabled ? undefined : '_blank'}
href={`d/${encodeURIComponent(dashboardUID)}?viewPanel=${encodeURIComponent(panelId)}`}
onClick={() => {
setReturnToPrevious(rule.name);