mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Remove returnToPrevious feature toggle (#88332)
This commit is contained in:
@@ -28,7 +28,6 @@ For more information about feature release stages, refer to [Release life cycle
|
|||||||
| `featureHighlights` | Highlight Grafana Enterprise features | |
|
| `featureHighlights` | Highlight Grafana Enterprise features | |
|
||||||
| `correlations` | Correlations page | Yes |
|
| `correlations` | Correlations page | Yes |
|
||||||
| `exploreContentOutline` | Content outline sidebar | Yes |
|
| `exploreContentOutline` | Content outline sidebar | Yes |
|
||||||
| `returnToPrevious` | Enables the return to previous context functionality | Yes |
|
|
||||||
| `cloudWatchCrossAccountQuerying` | Enables cross-account querying in CloudWatch datasources | Yes |
|
| `cloudWatchCrossAccountQuerying` | Enables cross-account querying in CloudWatch datasources | Yes |
|
||||||
| `nestedFolders` | Enable folder nesting | Yes |
|
| `nestedFolders` | Enable folder nesting | Yes |
|
||||||
| `nestedFolderPicker` | Enables the new folder picker to work with nested folders. Requires the nestedFolders feature toggle | Yes |
|
| `nestedFolderPicker` | Enables the new folder picker to work with nested folders. Requires the nestedFolders feature toggle | Yes |
|
||||||
|
|||||||
@@ -3,9 +3,6 @@ import { e2e } from '../utils';
|
|||||||
describe('ReturnToPrevious button', () => {
|
describe('ReturnToPrevious button', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
|
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
|
||||||
cy.window().then((win) => {
|
|
||||||
win.localStorage.setItem('grafana.featureToggles', 'returnToPrevious=1');
|
|
||||||
});
|
|
||||||
|
|
||||||
cy.visit('/alerting/list');
|
cy.visit('/alerting/list');
|
||||||
e2e.components.AlertRules.groupToggle().first().click();
|
e2e.components.AlertRules.groupToggle().first().click();
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ export interface FeatureToggles {
|
|||||||
disableSecretsCompatibility?: boolean;
|
disableSecretsCompatibility?: boolean;
|
||||||
logRequestsInstrumentedAsUnknown?: boolean;
|
logRequestsInstrumentedAsUnknown?: boolean;
|
||||||
topnav?: boolean;
|
topnav?: boolean;
|
||||||
returnToPrevious?: boolean;
|
|
||||||
grpcServer?: boolean;
|
grpcServer?: boolean;
|
||||||
unifiedStorage?: boolean;
|
unifiedStorage?: boolean;
|
||||||
dualWritePlaylistsMode2?: boolean;
|
dualWritePlaylistsMode2?: boolean;
|
||||||
|
|||||||
@@ -206,14 +206,6 @@ var (
|
|||||||
Expression: "true", // enabled by default
|
Expression: "true", // enabled by default
|
||||||
Owner: grafanaFrontendPlatformSquad,
|
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",
|
Name: "grpcServer",
|
||||||
Description: "Run the GRPC server",
|
Description: "Run the GRPC server",
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ scenes,experimental,@grafana/dashboards-squad,false,false,true
|
|||||||
disableSecretsCompatibility,experimental,@grafana/hosted-grafana-team,false,true,false
|
disableSecretsCompatibility,experimental,@grafana/hosted-grafana-team,false,true,false
|
||||||
logRequestsInstrumentedAsUnknown,experimental,@grafana/hosted-grafana-team,false,false,false
|
logRequestsInstrumentedAsUnknown,experimental,@grafana/hosted-grafana-team,false,false,false
|
||||||
topnav,deprecated,@grafana/grafana-frontend-platform,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
|
grpcServer,preview,@grafana/grafana-app-platform-squad,false,false,false
|
||||||
unifiedStorage,experimental,@grafana/grafana-app-platform-squad,false,true,false
|
unifiedStorage,experimental,@grafana/grafana-app-platform-squad,false,true,false
|
||||||
dualWritePlaylistsMode2,experimental,@grafana/search-and-storage,false,false,false
|
dualWritePlaylistsMode2,experimental,@grafana/search-and-storage,false,false,false
|
||||||
|
|||||||
|
@@ -111,10 +111,6 @@ const (
|
|||||||
// Enables topnav support in external plugins. The new Grafana navigation cannot be disabled.
|
// Enables topnav support in external plugins. The new Grafana navigation cannot be disabled.
|
||||||
FlagTopnav = "topnav"
|
FlagTopnav = "topnav"
|
||||||
|
|
||||||
// FlagReturnToPrevious
|
|
||||||
// Enables the return to previous context functionality
|
|
||||||
FlagReturnToPrevious = "returnToPrevious"
|
|
||||||
|
|
||||||
// FlagGrpcServer
|
// FlagGrpcServer
|
||||||
// Run the GRPC server
|
// Run the GRPC server
|
||||||
FlagGrpcServer = "grpcServer"
|
FlagGrpcServer = "grpcServer"
|
||||||
|
|||||||
@@ -60,7 +60,8 @@
|
|||||||
"metadata": {
|
"metadata": {
|
||||||
"name": "returnToPrevious",
|
"name": "returnToPrevious",
|
||||||
"resourceVersion": "1716448665531",
|
"resourceVersion": "1716448665531",
|
||||||
"creationTimestamp": "2024-05-23T07:17:45Z"
|
"creationTimestamp": "2024-05-23T07:17:45Z",
|
||||||
|
"deletionTimestamp": "2024-05-27T09:59:33Z"
|
||||||
},
|
},
|
||||||
"spec": {
|
"spec": {
|
||||||
"description": "Enables the return to previous context functionality",
|
"description": "Enables the return to previous context functionality",
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import React, { PropsWithChildren, useEffect } from 'react';
|
|||||||
import { GrafanaTheme2 } from '@grafana/data';
|
import { GrafanaTheme2 } from '@grafana/data';
|
||||||
import { locationSearchToObject, locationService } from '@grafana/runtime';
|
import { locationSearchToObject, locationService } from '@grafana/runtime';
|
||||||
import { useStyles2, LinkButton, useTheme2 } from '@grafana/ui';
|
import { useStyles2, LinkButton, useTheme2 } from '@grafana/ui';
|
||||||
import config from 'app/core/config';
|
|
||||||
import { useGrafana } from 'app/core/context/GrafanaContext';
|
import { useGrafana } from 'app/core/context/GrafanaContext';
|
||||||
import { useMediaQueryChange } from 'app/core/hooks/useMediaQueryChange';
|
import { useMediaQueryChange } from 'app/core/hooks/useMediaQueryChange';
|
||||||
import store from 'app/core/store';
|
import store from 'app/core/store';
|
||||||
@@ -55,8 +54,7 @@ export function AppChrome({ children }: Props) {
|
|||||||
|
|
||||||
const { pathname, search } = locationService.getLocation();
|
const { pathname, search } = locationService.getLocation();
|
||||||
const url = pathname + search;
|
const url = pathname + search;
|
||||||
const shouldShowReturnToPrevious =
|
const shouldShowReturnToPrevious = state.returnToPrevious && url !== state.returnToPrevious.href;
|
||||||
config.featureToggles.returnToPrevious && state.returnToPrevious && url !== state.returnToPrevious.href;
|
|
||||||
|
|
||||||
// Clear returnToPrevious when the page is manually navigated to
|
// Clear returnToPrevious when the page is manually navigated to
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -90,10 +90,6 @@ export class AppChromeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setReturnToPrevious = (returnToPrevious: ReturnToPreviousProps) => {
|
public setReturnToPrevious = (returnToPrevious: ReturnToPreviousProps) => {
|
||||||
const isReturnToPreviousEnabled = config.featureToggles.returnToPrevious;
|
|
||||||
if (!isReturnToPreviousEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const previousPage = this.state.getValue().returnToPrevious;
|
const previousPage = this.state.getValue().returnToPrevious;
|
||||||
reportInteraction('grafana_return_to_previous_button_created', {
|
reportInteraction('grafana_return_to_previous_button_created', {
|
||||||
page: returnToPrevious.href,
|
page: returnToPrevious.href,
|
||||||
@@ -105,10 +101,6 @@ export class AppChromeService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public clearReturnToPrevious = (interactionAction: 'clicked' | 'dismissed' | 'auto_dismissed') => {
|
public clearReturnToPrevious = (interactionAction: 'clicked' | 'dismissed' | 'auto_dismissed') => {
|
||||||
const isReturnToPreviousEnabled = config.featureToggles.returnToPrevious;
|
|
||||||
if (!isReturnToPreviousEnabled) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const existingRtp = this.state.getValue().returnToPrevious;
|
const existingRtp = this.state.getValue().returnToPrevious;
|
||||||
if (existingRtp) {
|
if (existingRtp) {
|
||||||
reportInteraction('grafana_return_to_previous_button_dismissed', {
|
reportInteraction('grafana_return_to_previous_button_dismissed', {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import React from 'react';
|
|||||||
import { TestProvider } from 'test/helpers/TestProvider';
|
import { TestProvider } from 'test/helpers/TestProvider';
|
||||||
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
||||||
|
|
||||||
import { config, reportInteraction } from '@grafana/runtime';
|
import { reportInteraction } from '@grafana/runtime';
|
||||||
|
|
||||||
import { ReturnToPrevious, ReturnToPreviousProps } from './ReturnToPrevious';
|
import { ReturnToPrevious, ReturnToPreviousProps } from './ReturnToPrevious';
|
||||||
|
|
||||||
@@ -36,14 +36,9 @@ const setup = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
describe('ReturnToPrevious', () => {
|
describe('ReturnToPrevious', () => {
|
||||||
beforeEach(() => {
|
|
||||||
/* We enabled the feature toggle */
|
|
||||||
config.featureToggles.returnToPrevious = true;
|
|
||||||
});
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
window.sessionStorage.clear();
|
window.sessionStorage.clear();
|
||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
config.featureToggles.returnToPrevious = false;
|
|
||||||
});
|
});
|
||||||
it('should render component', async () => {
|
it('should render component', async () => {
|
||||||
setup();
|
setup();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
|
|
||||||
import { textUtil } from '@grafana/data';
|
import { textUtil } from '@grafana/data';
|
||||||
import { config, useReturnToPrevious } from '@grafana/runtime';
|
import { useReturnToPrevious } from '@grafana/runtime';
|
||||||
import { Button, LinkButton, Stack } from '@grafana/ui';
|
import { Button, LinkButton, Stack } from '@grafana/ui';
|
||||||
import { CombinedRule, RulesSource } from 'app/types/unified-alerting';
|
import { CombinedRule, RulesSource } from 'app/types/unified-alerting';
|
||||||
|
|
||||||
@@ -68,7 +68,6 @@ const RuleDetailsButtons = ({ rule, rulesSource }: Props) => {
|
|||||||
}
|
}
|
||||||
if (rule.annotations[Annotation.dashboardUID]) {
|
if (rule.annotations[Annotation.dashboardUID]) {
|
||||||
const dashboardUID = rule.annotations[Annotation.dashboardUID];
|
const dashboardUID = rule.annotations[Annotation.dashboardUID];
|
||||||
const isReturnToPreviousEnabled = config.featureToggles.returnToPrevious;
|
|
||||||
if (dashboardUID) {
|
if (dashboardUID) {
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<LinkButton
|
<LinkButton
|
||||||
@@ -76,7 +75,6 @@ const RuleDetailsButtons = ({ rule, rulesSource }: Props) => {
|
|||||||
key="dashboard"
|
key="dashboard"
|
||||||
variant="primary"
|
variant="primary"
|
||||||
icon="apps"
|
icon="apps"
|
||||||
target={isReturnToPreviousEnabled ? undefined : '_blank'}
|
|
||||||
href={`d/${encodeURIComponent(dashboardUID)}`}
|
href={`d/${encodeURIComponent(dashboardUID)}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setReturnToPrevious(rule.name);
|
setReturnToPrevious(rule.name);
|
||||||
@@ -93,7 +91,6 @@ const RuleDetailsButtons = ({ rule, rulesSource }: Props) => {
|
|||||||
key="panel"
|
key="panel"
|
||||||
variant="primary"
|
variant="primary"
|
||||||
icon="apps"
|
icon="apps"
|
||||||
target={isReturnToPreviousEnabled ? undefined : '_blank'}
|
|
||||||
href={`d/${encodeURIComponent(dashboardUID)}?viewPanel=${encodeURIComponent(panelId)}`}
|
href={`d/${encodeURIComponent(dashboardUID)}?viewPanel=${encodeURIComponent(panelId)}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setReturnToPrevious(rule.name);
|
setReturnToPrevious(rule.name);
|
||||||
|
|||||||
Reference in New Issue
Block a user