mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Deprecation: Create explicit feature toggle to auto-migrate from graph panel (#79369)
This commit is contained in:
@@ -21,7 +21,31 @@
|
|||||||
"links": [
|
"links": [
|
||||||
{
|
{
|
||||||
"asDropdown": false,
|
"asDropdown": false,
|
||||||
"icon": "dashboard",
|
"icon": "external link",
|
||||||
|
"includeVars": false,
|
||||||
|
"keepTime": false,
|
||||||
|
"tags": [],
|
||||||
|
"targetBlank": true,
|
||||||
|
"title": "Auto migrate graph panel (TRUE)",
|
||||||
|
"tooltip": "",
|
||||||
|
"type": "link",
|
||||||
|
"url": " /d/cdd412c4/?__feature.autoMigrateGraphPanel=true"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"asDropdown": false,
|
||||||
|
"icon": "external link",
|
||||||
|
"includeVars": false,
|
||||||
|
"keepTime": false,
|
||||||
|
"tags": [],
|
||||||
|
"targetBlank": true,
|
||||||
|
"title": "Auto migrate graph panel (FALSE)",
|
||||||
|
"tooltip": "",
|
||||||
|
"type": "link",
|
||||||
|
"url": " /d/cdd412c4/?__feature.autoMigrateGraphPanel=false"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"asDropdown": false,
|
||||||
|
"icon": "external link",
|
||||||
"includeVars": false,
|
"includeVars": false,
|
||||||
"keepTime": false,
|
"keepTime": false,
|
||||||
"tags": [],
|
"tags": [],
|
||||||
@@ -45,7 +69,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"asDropdown": false,
|
"asDropdown": false,
|
||||||
"icon": "dashboard",
|
"icon": "external link",
|
||||||
"includeVars": false,
|
"includeVars": false,
|
||||||
"keepTime": false,
|
"keepTime": false,
|
||||||
"tags": [],
|
"tags": [],
|
||||||
@@ -198,7 +222,7 @@
|
|||||||
"sort": 0,
|
"sort": 0,
|
||||||
"value_type": "individual"
|
"value_type": "individual"
|
||||||
},
|
},
|
||||||
"type": "timeseries",
|
"type": "graph",
|
||||||
"xaxis": {
|
"xaxis": {
|
||||||
"mode": "time",
|
"mode": "time",
|
||||||
"show": true,
|
"show": true,
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ Some features are enabled by default. You can disable these feature by setting t
|
|||||||
| `panelTitleSearch` | Search for dashboards using panel title |
|
| `panelTitleSearch` | Search for dashboards using panel title |
|
||||||
| `migrationLocking` | Lock database during migrations |
|
| `migrationLocking` | Lock database during migrations |
|
||||||
| `autoMigrateOldPanels` | Migrate old angular panels to supported versions (graph, table-old, worldmap, etc) |
|
| `autoMigrateOldPanels` | Migrate old angular panels to supported versions (graph, table-old, worldmap, etc) |
|
||||||
|
| `autoMigrateGraphPanel` | Migrate old graph panel to supported time series panel - broken out from autoMigrateOldPanels to enable granular tracking |
|
||||||
| `disableAngular` | Dynamic flag to disable angular at runtime. The preferred method is to set `angular_support_enabled` to `false` in the [security] settings, which allows you to change the state at runtime. |
|
| `disableAngular` | Dynamic flag to disable angular at runtime. The preferred method is to set `angular_support_enabled` to `false` in the [security] settings, which allows you to change the state at runtime. |
|
||||||
| `newVizTooltips` | New visualizations tooltips UX |
|
| `newVizTooltips` | New visualizations tooltips UX |
|
||||||
| `grpcServer` | Run the GRPC server |
|
| `grpcServer` | Run the GRPC server |
|
||||||
|
|||||||
@@ -1,18 +1,50 @@
|
|||||||
import { e2e } from '../utils';
|
import { e2e } from '../utils';
|
||||||
|
|
||||||
const DASHBOARD_ID = 'XMjIZPmik';
|
const DASHBOARD_ID = 'XMjIZPmik';
|
||||||
const DASHBOARD_NAME = 'Panel Tests - Graph Time Regions';
|
const DASHBOARD_NAME = 'Panel Tests - Graph Time Regions';
|
||||||
|
const UPLOT_MAIN_DIV_SELECTOR = '[data-testid="uplot-main-div"]';
|
||||||
|
|
||||||
describe('Auto-migrate graph panel', () => {
|
describe('Auto-migrate graph panel', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
|
e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Graph panel is migrated with `autoMigrateOldPanels` feature toggle', () => {
|
||||||
|
e2e.flows.openDashboard({ uid: DASHBOARD_ID });
|
||||||
|
cy.contains(DASHBOARD_NAME).should('be.visible');
|
||||||
|
cy.get(UPLOT_MAIN_DIV_SELECTOR).should('not.exist');
|
||||||
|
|
||||||
|
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { '__feature.autoMigrateOldPanels': true } });
|
||||||
|
|
||||||
|
cy.get(UPLOT_MAIN_DIV_SELECTOR).should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Graph panel is migrated with config `disableAngular` feature toggle', () => {
|
||||||
|
e2e.flows.openDashboard({ uid: DASHBOARD_ID });
|
||||||
|
cy.contains(DASHBOARD_NAME).should('be.visible');
|
||||||
|
cy.get(UPLOT_MAIN_DIV_SELECTOR).should('not.exist');
|
||||||
|
|
||||||
|
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { '__feature.disableAngular': true } });
|
||||||
|
|
||||||
|
cy.get(UPLOT_MAIN_DIV_SELECTOR).should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Graph panel is migrated with `autoMigrateGraphPanel` feature toggle', () => {
|
||||||
|
e2e.flows.openDashboard({ uid: DASHBOARD_ID });
|
||||||
|
cy.contains(DASHBOARD_NAME).should('be.visible');
|
||||||
|
cy.get(UPLOT_MAIN_DIV_SELECTOR).should('not.exist');
|
||||||
|
|
||||||
|
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { '__feature.autoMigrateGraphPanel': true } });
|
||||||
|
|
||||||
|
cy.get(UPLOT_MAIN_DIV_SELECTOR).should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
it('Annotation markers exist for time regions', () => {
|
it('Annotation markers exist for time regions', () => {
|
||||||
e2e.flows.openDashboard({ uid: DASHBOARD_ID });
|
e2e.flows.openDashboard({ uid: DASHBOARD_ID });
|
||||||
cy.contains(DASHBOARD_NAME).should('be.visible');
|
cy.contains(DASHBOARD_NAME).should('be.visible');
|
||||||
cy.contains('uplot-main-div').should('not.exist');
|
cy.get(UPLOT_MAIN_DIV_SELECTOR).should('not.exist');
|
||||||
|
|
||||||
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { '__feature.autoMigrateOldPanels': true } });
|
e2e.flows.openDashboard({ uid: DASHBOARD_ID, queryParams: { '__feature.autoMigrateGraphPanel': true } });
|
||||||
|
|
||||||
e2e.components.Panels.Panel.title('Business Hours')
|
e2e.components.Panels.Panel.title('Business Hours')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ export interface FeatureToggles {
|
|||||||
datasourceQueryMultiStatus?: boolean;
|
datasourceQueryMultiStatus?: boolean;
|
||||||
traceToMetrics?: boolean;
|
traceToMetrics?: boolean;
|
||||||
autoMigrateOldPanels?: boolean;
|
autoMigrateOldPanels?: boolean;
|
||||||
|
autoMigrateGraphPanel?: boolean;
|
||||||
disableAngular?: boolean;
|
disableAngular?: boolean;
|
||||||
canvasPanelNesting?: boolean;
|
canvasPanelNesting?: boolean;
|
||||||
newVizTooltips?: boolean;
|
newVizTooltips?: boolean;
|
||||||
|
|||||||
@@ -134,6 +134,14 @@ var (
|
|||||||
Owner: grafanaDatavizSquad,
|
Owner: grafanaDatavizSquad,
|
||||||
Created: time.Date(2022, time.June, 11, 12, 0, 0, 0, time.UTC),
|
Created: time.Date(2022, time.June, 11, 12, 0, 0, 0, time.UTC),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "autoMigrateGraphPanel",
|
||||||
|
Description: "Migrate old graph panel to supported time series panel - broken out from autoMigrateOldPanels to enable granular tracking",
|
||||||
|
Stage: FeatureStagePublicPreview,
|
||||||
|
FrontendOnly: true,
|
||||||
|
Owner: grafanaDatavizSquad,
|
||||||
|
Created: time.Date(2023, time.December, 11, 7, 0, 0, 0, time.UTC),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "disableAngular",
|
Name: "disableAngular",
|
||||||
Description: "Dynamic flag to disable angular at runtime. The preferred method is to set `angular_support_enabled` to `false` in the [security] settings, which allows you to change the state at runtime.",
|
Description: "Dynamic flag to disable angular at runtime. The preferred method is to set `angular_support_enabled` to `false` in the [security] settings, which allows you to change the state at runtime.",
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ exploreContentOutline,GA,@grafana/explore-squad,2023-11-03,false,false,true
|
|||||||
datasourceQueryMultiStatus,experimental,@grafana/plugins-platform-backend,2022-05-03,false,false,false
|
datasourceQueryMultiStatus,experimental,@grafana/plugins-platform-backend,2022-05-03,false,false,false
|
||||||
traceToMetrics,experimental,@grafana/observability-traces-and-profiling,2022-03-07,false,false,true
|
traceToMetrics,experimental,@grafana/observability-traces-and-profiling,2022-03-07,false,false,true
|
||||||
autoMigrateOldPanels,preview,@grafana/dataviz-squad,2022-06-11,false,false,true
|
autoMigrateOldPanels,preview,@grafana/dataviz-squad,2022-06-11,false,false,true
|
||||||
|
autoMigrateGraphPanel,preview,@grafana/dataviz-squad,2023-12-11,false,false,true
|
||||||
disableAngular,preview,@grafana/dataviz-squad,2023-03-23,false,false,true
|
disableAngular,preview,@grafana/dataviz-squad,2023-03-23,false,false,true
|
||||||
canvasPanelNesting,experimental,@grafana/dataviz-squad,2022-05-31,false,false,true
|
canvasPanelNesting,experimental,@grafana/dataviz-squad,2022-05-31,false,false,true
|
||||||
newVizTooltips,preview,@grafana/dataviz-squad,2023-11-03,false,false,true
|
newVizTooltips,preview,@grafana/dataviz-squad,2023-11-03,false,false,true
|
||||||
|
|||||||
|
@@ -67,6 +67,10 @@ const (
|
|||||||
// Migrate old angular panels to supported versions (graph, table-old, worldmap, etc)
|
// Migrate old angular panels to supported versions (graph, table-old, worldmap, etc)
|
||||||
FlagAutoMigrateOldPanels = "autoMigrateOldPanels"
|
FlagAutoMigrateOldPanels = "autoMigrateOldPanels"
|
||||||
|
|
||||||
|
// FlagAutoMigrateGraphPanel
|
||||||
|
// Migrate old graph panel to supported time series panel - broken out from autoMigrateOldPanels to enable granular tracking
|
||||||
|
FlagAutoMigrateGraphPanel = "autoMigrateGraphPanel"
|
||||||
|
|
||||||
// FlagDisableAngular
|
// FlagDisableAngular
|
||||||
// Dynamic flag to disable angular at runtime. The preferred method is to set `angular_support_enabled` to `false` in the [security] settings, which allows you to change the state at runtime.
|
// Dynamic flag to disable angular at runtime. The preferred method is to set `angular_support_enabled` to `false` in the [security] settings, which allows you to change the state at runtime.
|
||||||
FlagDisableAngular = "disableAngular"
|
FlagDisableAngular = "disableAngular"
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import { getTimeSrv } from '../services/TimeSrv';
|
|||||||
import { mergePanels, PanelMergeInfo } from '../utils/panelMerge';
|
import { mergePanels, PanelMergeInfo } from '../utils/panelMerge';
|
||||||
|
|
||||||
import { DashboardMigrator } from './DashboardMigrator';
|
import { DashboardMigrator } from './DashboardMigrator';
|
||||||
import { PanelModel, autoMigrateAngular } from './PanelModel';
|
import { PanelModel, autoMigrateAngular, explicitlyControlledMigrationPanels } from './PanelModel';
|
||||||
import { TimeModel } from './TimeModel';
|
import { TimeModel } from './TimeModel';
|
||||||
import { deleteScopeVars, isOnTheSameGridRow } from './utils';
|
import { deleteScopeVars, isOnTheSameGridRow } from './utils';
|
||||||
|
|
||||||
@@ -173,6 +173,12 @@ export class DashboardModel implements TimeModel {
|
|||||||
if (options?.autoMigrateOldPanels || !config.angularSupportEnabled || config.featureToggles.autoMigrateOldPanels) {
|
if (options?.autoMigrateOldPanels || !config.angularSupportEnabled || config.featureToggles.autoMigrateOldPanels) {
|
||||||
for (const p of this.panelIterator()) {
|
for (const p of this.panelIterator()) {
|
||||||
const newType = autoMigrateAngular[p.type];
|
const newType = autoMigrateAngular[p.type];
|
||||||
|
|
||||||
|
// Skip explicitly controlled panels
|
||||||
|
if (explicitlyControlledMigrationPanels.includes(p.type)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!p.autoMigrateFrom && newType) {
|
if (!p.autoMigrateFrom && newType) {
|
||||||
p.autoMigrateFrom = p.type;
|
p.autoMigrateFrom = p.type;
|
||||||
p.type = newType;
|
p.type = newType;
|
||||||
@@ -180,6 +186,21 @@ export class DashboardModel implements TimeModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Explicit handling of graph -> time series migration (and eventually others)
|
||||||
|
if (
|
||||||
|
options?.autoMigrateOldPanels ||
|
||||||
|
!config.angularSupportEnabled ||
|
||||||
|
config.featureToggles.autoMigrateOldPanels ||
|
||||||
|
config.featureToggles.autoMigrateGraphPanel
|
||||||
|
) {
|
||||||
|
for (const p of this.panelIterator()) {
|
||||||
|
if (!p.autoMigrateFrom && p.type === 'graph') {
|
||||||
|
p.autoMigrateFrom = p.type;
|
||||||
|
p.type = 'timeseries';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.addBuiltInAnnotationQuery();
|
this.addBuiltInAnnotationQuery();
|
||||||
this.sortPanelsByGridPos();
|
this.sortPanelsByGridPos();
|
||||||
this.panelsAffectedByVariableChange = null;
|
this.panelsAffectedByVariableChange = null;
|
||||||
|
|||||||
@@ -130,6 +130,8 @@ const defaults: any = {
|
|||||||
title: '',
|
title: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const explicitlyControlledMigrationPanels = ['graph'];
|
||||||
|
|
||||||
export const autoMigrateAngular: Record<string, string> = {
|
export const autoMigrateAngular: Record<string, string> = {
|
||||||
graph: 'timeseries',
|
graph: 'timeseries',
|
||||||
'table-old': 'table',
|
'table-old': 'table',
|
||||||
|
|||||||
Reference in New Issue
Block a user