diff --git a/devenv/dev-dashboards/migrations/migrations.json b/devenv/dev-dashboards/migrations/migrations.json index 9b75a6d8345..27979e11172 100644 --- a/devenv/dev-dashboards/migrations/migrations.json +++ b/devenv/dev-dashboards/migrations/migrations.json @@ -43,6 +43,102 @@ "type": "link", "url": " /d/cdd412c4/?__feature.autoMigrateGraphPanel=false" }, + { + "asDropdown": false, + "icon": "external link", + "includeVars": false, + "keepTime": false, + "tags": [], + "targetBlank": true, + "title": "Auto migrate table (old) panel (TRUE)", + "tooltip": "", + "type": "link", + "url": " /d/cdd412c4/?__feature.autoMigrateTablePanel=true" + }, + { + "asDropdown": false, + "icon": "external link", + "includeVars": false, + "keepTime": false, + "tags": [], + "targetBlank": true, + "title": "Auto migrate table (old) panel (FALSE)", + "tooltip": "", + "type": "link", + "url": " /d/cdd412c4/?__feature.autoMigrateTablePanel=false" + }, + { + "asDropdown": false, + "icon": "external link", + "includeVars": false, + "keepTime": false, + "tags": [], + "targetBlank": true, + "title": "Auto migrate piechart panel (TRUE)", + "tooltip": "", + "type": "link", + "url": " /d/cdd412c4/?__feature.autoMigratePiechartPanel=true" + }, + { + "asDropdown": false, + "icon": "external link", + "includeVars": false, + "keepTime": false, + "tags": [], + "targetBlank": true, + "title": "Auto migrate piechart panel (FALSE)", + "tooltip": "", + "type": "link", + "url": " /d/cdd412c4/?__feature.autoMigratePiechartPanel=false" + }, + { + "asDropdown": false, + "icon": "external link", + "includeVars": false, + "keepTime": false, + "tags": [], + "targetBlank": true, + "title": "Auto migrate worldmap panel (TRUE)", + "tooltip": "", + "type": "link", + "url": " /d/cdd412c4/?__feature.autoMigrateWorldmapPanel=true" + }, + { + "asDropdown": false, + "icon": "external link", + "includeVars": false, + "keepTime": false, + "tags": [], + "targetBlank": true, + "title": "Auto migrate worldmap panel (FALSE)", + "tooltip": "", + "type": "link", + "url": " /d/cdd412c4/?__feature.autoMigrateWorldmapPanel=false" + }, + { + "asDropdown": false, + "icon": "external link", + "includeVars": false, + "keepTime": false, + "tags": [], + "targetBlank": true, + "title": "Auto migrate stat panel (TRUE)", + "tooltip": "", + "type": "link", + "url": " /d/cdd412c4/?__feature.autoMigrateStatPanel=true" + }, + { + "asDropdown": false, + "icon": "external link", + "includeVars": false, + "keepTime": false, + "tags": [], + "targetBlank": true, + "title": "Auto migrate stat panel (FALSE)", + "tooltip": "", + "type": "link", + "url": " /d/cdd412c4/?__feature.autoMigrateStatPanel=false" + }, { "asDropdown": false, "icon": "external link", @@ -105,57 +201,7 @@ }, "fieldConfig": { "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 10, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "never", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "short", - "unitScale": true + "unit": "short" }, "overrides": [] }, @@ -195,7 +241,7 @@ } }, "percentage": false, - "pluginVersion": "9.5.0-pre", + "pluginVersion": "10.4.0-pre", "pointradius": 2, "points": false, "renderer": "flot", @@ -265,7 +311,7 @@ "content": "# Graph panel >> Timeseries panel\n\nKnown issues:\n* hiding null/empty series\n* time regions", "mode": "markdown" }, - "pluginVersion": "10.3.0-pre", + "pluginVersion": "10.4.0-pre", "targets": [ { "datasource": { @@ -377,7 +423,7 @@ "content": "# Table (old) >> Table\n\nKnown issues:\n* wrapping text\n* style changes", "mode": "markdown" }, - "pluginVersion": "10.3.0-pre", + "pluginVersion": "10.4.0-pre", "targets": [ { "datasource": { @@ -417,7 +463,6 @@ "y": 21 }, "id": 9, - "links": [], "mappingType": 1, "mappingTypes": [ { @@ -498,7 +543,6 @@ "y": 21 }, "id": 23, - "links": [], "mappingType": 1, "mappingTypes": [ { @@ -574,7 +618,7 @@ "content": "# Singlestat >> Stat\n\nKnown issues:\n* limited options", "mode": "markdown" }, - "pluginVersion": "10.3.0-pre", + "pluginVersion": "10.4.0-pre", "targets": [ { "datasource": { @@ -661,7 +705,7 @@ "content": "# grafana-piechart-panel >> piechart\n\nKnown issues:\n* TBD", "mode": "markdown" }, - "pluginVersion": "10.3.0-pre", + "pluginVersion": "10.4.0-pre", "targets": [ { "datasource": { @@ -675,38 +719,54 @@ "type": "text" }, { - "circleMaxSize": 30, - "circleMinSize": 2, - "colors": [ - "rgba(245, 54, 54, 0.9)", - "rgba(237, 129, 40, 0.89)", - "rgba(50, 172, 45, 0.97)" - ], "datasource": { "type": "grafana-testdata-datasource", "uid": "PD8C576611E62080A" }, - "decimals": 0, - "esMetric": "Count", + "fieldConfig": { + "defaults": { + "custom": { + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "rgba(245, 54, 54, 0.9)" + }, + { + "color": "rgba(237, 129, 40, 0.89)", + "value": 0 + }, + { + "color": "rgba(50, 172, 45, 0.97)", + "value": 10 + } + ] + } + }, + "overrides": [] + }, "gridPos": { "h": 10, "w": 16, "x": 0, "y": 39 }, - "hideEmpty": false, - "hideZero": false, "id": 26, - "initialZoom": 1, - "locationData": "countries", - "mapCenter": "(0°, 0°)", - "mapCenterLatitude": 0, - "mapCenterLongitude": 0, "maxDataPoints": 1, - "mouseWheelZoom": false, "options": { + "basemap": { + "name": "Basemap", + "type": "default" + }, "controls": { - "mouseWheelZoom": true, + "mouseWheelZoom": false, "showAttribution": true, "showDebug": false, "showMeasure": false, @@ -730,7 +790,7 @@ }, "size": { "fixed": 5, - "max": 15, + "max": 30, "min": 2 }, "symbol": { @@ -751,9 +811,10 @@ } }, "location": { - "mode": "auto" + "gazetteer": "public/gazetteer/countries.json", + "mode": "lookup" }, - "name": "Layer 1", + "name": "Layer 0", "tooltip": true, "type": "markers" } @@ -769,16 +830,7 @@ "zoom": 1 } }, - "pluginVersion": "10.3.0-pre", - "showLegend": true, - "stickyLabels": false, - "tableQueryOptions": { - "geohashField": "geohash", - "latitudeField": "latitude", - "longitudeField": "longitude", - "metricField": "metric", - "queryType": "geohash" - }, + "pluginVersion": "10.4.0-pre", "targets": [ { "csvFileName": "flight_info_by_state.csv", @@ -790,7 +842,6 @@ "scenarioId": "csv_file" } ], - "thresholds": "0,10", "title": "grafana-worldmap-panel", "transformations": [ { @@ -798,12 +849,17 @@ "options": { "reducers": [] } + }, + { + "id": "reduce", + "options": { + "reducers": [ + "sum" + ] + } } ], - "type": "grafana-worldmap-panel", - "unitPlural": "", - "unitSingle": "", - "valueName": "total" + "type": "grafana-worldmap-panel" }, { "datasource": { @@ -826,7 +882,7 @@ "content": "# grafana-worldmap-panel >> geomap\n\nKnown issues:\n* TBD", "mode": "markdown" }, - "pluginVersion": "10.3.0-pre", + "pluginVersion": "10.4.0-pre", "targets": [ { "datasource": { @@ -858,6 +914,6 @@ "timezone": "", "title": "Devenv - Panel migrations", "uid": "cdd412c4", - "version": 34, + "version": 67, "weekStart": "" } \ No newline at end of file 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 1c89be2d4f8..2e1a47552db 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -65,6 +65,10 @@ Some features are enabled by default. You can disable these feature by setting t | `migrationLocking` | Lock database during migrations | | `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 | +| `autoMigrateTablePanel` | Migrate old table panel to supported table panel - broken out from autoMigrateOldPanels to enable granular tracking | +| `autoMigratePiechartPanel` | Migrate old piechart panel to supported piechart panel - broken out from autoMigrateOldPanels to enable granular tracking | +| `autoMigrateWorldmapPanel` | Migrate old worldmap panel to supported geomap panel - broken out from autoMigrateOldPanels to enable granular tracking | +| `autoMigrateStatPanel` | Migrate old stat panel to supported stat 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. | | `newVizTooltips` | New visualizations tooltips UX | | `grpcServer` | Run the GRPC server | diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index 64109324df6..ff3d6acc005 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -34,6 +34,10 @@ export interface FeatureToggles { traceToMetrics?: boolean; autoMigrateOldPanels?: boolean; autoMigrateGraphPanel?: boolean; + autoMigrateTablePanel?: boolean; + autoMigratePiechartPanel?: boolean; + autoMigrateWorldmapPanel?: boolean; + autoMigrateStatPanel?: boolean; disableAngular?: boolean; canvasPanelNesting?: boolean; newVizTooltips?: boolean; diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 9d9f60edccd..63338b3a313 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -129,6 +129,34 @@ var ( FrontendOnly: true, Owner: grafanaDatavizSquad, }, + { + Name: "autoMigrateTablePanel", + Description: "Migrate old table panel to supported table panel - broken out from autoMigrateOldPanels to enable granular tracking", + Stage: FeatureStagePublicPreview, + FrontendOnly: true, + Owner: grafanaDatavizSquad, + }, + { + Name: "autoMigratePiechartPanel", + Description: "Migrate old piechart panel to supported piechart panel - broken out from autoMigrateOldPanels to enable granular tracking", + Stage: FeatureStagePublicPreview, + FrontendOnly: true, + Owner: grafanaDatavizSquad, + }, + { + Name: "autoMigrateWorldmapPanel", + Description: "Migrate old worldmap panel to supported geomap panel - broken out from autoMigrateOldPanels to enable granular tracking", + Stage: FeatureStagePublicPreview, + FrontendOnly: true, + Owner: grafanaDatavizSquad, + }, + { + Name: "autoMigrateStatPanel", + Description: "Migrate old stat panel to supported stat panel - broken out from autoMigrateOldPanels to enable granular tracking", + Stage: FeatureStagePublicPreview, + FrontendOnly: true, + Owner: grafanaDatavizSquad, + }, { 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.", diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index ad0575f2234..d9afdaddd8f 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -15,6 +15,10 @@ datasourceQueryMultiStatus,experimental,@grafana/plugins-platform-backend,false, traceToMetrics,experimental,@grafana/observability-traces-and-profiling,false,false,true autoMigrateOldPanels,preview,@grafana/dataviz-squad,false,false,true autoMigrateGraphPanel,preview,@grafana/dataviz-squad,false,false,true +autoMigrateTablePanel,preview,@grafana/dataviz-squad,false,false,true +autoMigratePiechartPanel,preview,@grafana/dataviz-squad,false,false,true +autoMigrateWorldmapPanel,preview,@grafana/dataviz-squad,false,false,true +autoMigrateStatPanel,preview,@grafana/dataviz-squad,false,false,true disableAngular,preview,@grafana/dataviz-squad,false,false,true canvasPanelNesting,experimental,@grafana/dataviz-squad,false,false,true newVizTooltips,preview,@grafana/dataviz-squad,false,false,true diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index 8c6f3f2c0f2..6cf98f2576f 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -71,6 +71,22 @@ const ( // Migrate old graph panel to supported time series panel - broken out from autoMigrateOldPanels to enable granular tracking FlagAutoMigrateGraphPanel = "autoMigrateGraphPanel" + // FlagAutoMigrateTablePanel + // Migrate old table panel to supported table panel - broken out from autoMigrateOldPanels to enable granular tracking + FlagAutoMigrateTablePanel = "autoMigrateTablePanel" + + // FlagAutoMigratePiechartPanel + // Migrate old piechart panel to supported piechart panel - broken out from autoMigrateOldPanels to enable granular tracking + FlagAutoMigratePiechartPanel = "autoMigratePiechartPanel" + + // FlagAutoMigrateWorldmapPanel + // Migrate old worldmap panel to supported geomap panel - broken out from autoMigrateOldPanels to enable granular tracking + FlagAutoMigrateWorldmapPanel = "autoMigrateWorldmapPanel" + + // FlagAutoMigrateStatPanel + // Migrate old stat panel to supported stat panel - broken out from autoMigrateOldPanels to enable granular tracking + FlagAutoMigrateStatPanel = "autoMigrateStatPanel" + // 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. FlagDisableAngular = "disableAngular" diff --git a/pkg/services/featuremgmt/toggles_gen.json b/pkg/services/featuremgmt/toggles_gen.json index a2cb7135f7b..a28c68c5842 100644 --- a/pkg/services/featuremgmt/toggles_gen.json +++ b/pkg/services/featuremgmt/toggles_gen.json @@ -2079,6 +2079,58 @@ "codeowner": "@grafana/grafana-app-platform-squad", "requiresRestart": true } + }, + { + "metadata": { + "name": "autoMigrateStatPanel", + "resourceVersion": "1707922335937", + "creationTimestamp": "2024-02-14T14:52:15Z" + }, + "spec": { + "description": "Migrate old stat panel to supported stat panel - broken out from autoMigrateOldPanels to enable granular tracking", + "stage": "preview", + "codeowner": "@grafana/dataviz-squad", + "frontend": true + } + }, + { + "metadata": { + "name": "autoMigratePiechartPanel", + "resourceVersion": "1707922335937", + "creationTimestamp": "2024-02-14T14:52:15Z" + }, + "spec": { + "description": "Migrate old piechart panel to supported piechart panel - broken out from autoMigrateOldPanels to enable granular tracking", + "stage": "preview", + "codeowner": "@grafana/dataviz-squad", + "frontend": true + } + }, + { + "metadata": { + "name": "autoMigrateTablePanel", + "resourceVersion": "1707922335937", + "creationTimestamp": "2024-02-14T14:52:15Z" + }, + "spec": { + "description": "Migrate old table panel to supported table panel - broken out from autoMigrateOldPanels to enable granular tracking", + "stage": "preview", + "codeowner": "@grafana/dataviz-squad", + "frontend": true + } + }, + { + "metadata": { + "name": "autoMigrateWorldmapPanel", + "resourceVersion": "1707922335937", + "creationTimestamp": "2024-02-14T14:52:15Z" + }, + "spec": { + "description": "Migrate old worldmap panel to supported geomap panel - broken out from autoMigrateOldPanels to enable granular tracking", + "stage": "preview", + "codeowner": "@grafana/dataviz-squad", + "frontend": true + } } ] } \ No newline at end of file diff --git a/public/app/features/dashboard/state/DashboardModel.ts b/public/app/features/dashboard/state/DashboardModel.ts index 1e937d035ce..e406dae5206 100644 --- a/public/app/features/dashboard/state/DashboardModel.ts +++ b/public/app/features/dashboard/state/DashboardModel.ts @@ -44,7 +44,7 @@ import { getTimeSrv } from '../services/TimeSrv'; import { mergePanels, PanelMergeInfo } from '../utils/panelMerge'; import { DashboardMigrator } from './DashboardMigrator'; -import { PanelModel, autoMigrateAngular, explicitlyControlledMigrationPanels } from './PanelModel'; +import { PanelModel } from './PanelModel'; import { TimeModel } from './TimeModel'; import { deleteScopeVars, isOnTheSameGridRow } from './utils'; @@ -170,33 +170,54 @@ export class DashboardModel implements TimeModel { this.updateSchema(data); // Auto-migrate old angular panels - if (options?.autoMigrateOldPanels || !config.angularSupportEnabled || config.featureToggles.autoMigrateOldPanels) { - for (const p of this.panelIterator()) { - const newType = autoMigrateAngular[p.type]; + const shouldMigrateAllAngularPanels = + options?.autoMigrateOldPanels || !config.angularSupportEnabled || config.featureToggles.autoMigrateOldPanels; - // Skip explicitly controlled panels - if (explicitlyControlledMigrationPanels.includes(p.type)) { - continue; - } + const shouldMigrateExplicitAngularPanels = + config.featureToggles.autoMigrateGraphPanel || + config.featureToggles.autoMigrateTablePanel || + config.featureToggles.autoMigratePiechartPanel || + config.featureToggles.autoMigrateWorldmapPanel || + config.featureToggles.autoMigrateStatPanel; - if (!p.autoMigrateFrom && newType) { - p.autoMigrateFrom = p.type; - p.type = newType; - } - } - } - - // 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'; + // Handles both granular and all angular panel migration + if (shouldMigrateAllAngularPanels || shouldMigrateExplicitAngularPanels) { + for (const panel of this.panelIterator()) { + if ( + !panel.autoMigrateFrom && + panel.type === 'graph' && + (config.featureToggles.autoMigrateGraphPanel || shouldMigrateAllAngularPanels) + ) { + panel.autoMigrateFrom = panel.type; + panel.type = 'timeseries'; + } else if ( + !panel.autoMigrateFrom && + panel.type === 'table-old' && + (config.featureToggles.autoMigrateTablePanel || shouldMigrateAllAngularPanels) + ) { + panel.autoMigrateFrom = panel.type; + panel.type = 'table'; + } else if ( + !panel.autoMigrateFrom && + panel.type === 'grafana-piechart-panel' && + (config.featureToggles.autoMigratePiechartPanel || shouldMigrateAllAngularPanels) + ) { + panel.autoMigrateFrom = panel.type; + panel.type = 'piechart'; + } else if ( + !panel.autoMigrateFrom && + panel.type === 'grafana-worldmap-panel' && + (config.featureToggles.autoMigrateWorldmapPanel || shouldMigrateAllAngularPanels) + ) { + panel.autoMigrateFrom = panel.type; + panel.type = 'geomap'; + } else if ( + !panel.autoMigrateFrom && + (panel.type === 'singlestat' || panel.type === 'grafana-singlestat-panel') && + (config.featureToggles.autoMigrateStatPanel || shouldMigrateAllAngularPanels) + ) { + panel.autoMigrateFrom = panel.type; + panel.type = 'stat'; } } } diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts index 447cce8518e..2bf12614a0d 100644 --- a/public/app/features/dashboard/state/PanelModel.ts +++ b/public/app/features/dashboard/state/PanelModel.ts @@ -130,7 +130,14 @@ const defaults: any = { title: '', }; -export const explicitlyControlledMigrationPanels = ['graph']; +export const explicitlyControlledMigrationPanels = [ + 'graph', + 'table-old', + 'grafana-piechart-panel', + 'grafana-worldmap-panel', + 'singlestat', + 'grafana-singlestat-panel', +]; export const autoMigrateAngular: Record = { graph: 'timeseries',