diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index ea0c05415ab..51ab303baf6 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -58,6 +58,7 @@ export interface FeatureToggles { autoMigrateGraphPanels?: boolean; prometheusWideSeries?: boolean; canvasPanelNesting?: boolean; + useLegacyHeatmapPanel?: boolean; cloudMonitoringExperimentalUI?: boolean; logRequestsInstrumentedAsUnknown?: boolean; dataConnectionsConsole?: boolean; diff --git a/pkg/codegen/pluggen.go b/pkg/codegen/pluggen.go index 6e88bae5cf9..8ad0a67d1da 100644 --- a/pkg/codegen/pluggen.go +++ b/pkg/codegen/pluggen.go @@ -40,7 +40,8 @@ var skipPaths = []string{ "public/app/plugins/panel/barchart/models.cue", "public/app/plugins/panel/canvas/models.cue", "public/app/plugins/panel/histogram/models.cue", - "public/app/plugins/panel/heatmap-new/models.cue", + "public/app/plugins/panel/heatmap/models.cue", + "public/app/plugins/panel/heatmap-old/models.cue", "public/app/plugins/panel/candlestick/models.cue", "public/app/plugins/panel/state-timeline/models.cue", "public/app/plugins/panel/status-history/models.cue", diff --git a/pkg/plugins/manager/manager_integration_test.go b/pkg/plugins/manager/manager_integration_test.go index 3aaade7aa19..308635bbb89 100644 --- a/pkg/plugins/manager/manager_integration_test.go +++ b/pkg/plugins/manager/manager_integration_test.go @@ -120,7 +120,7 @@ func verifyCorePluginCatalogue(t *testing.T, ctx context.Context, pm *PluginMana "gettingstarted": {}, "graph": {}, "heatmap": {}, - "heatmap-new": {}, + "heatmap-old": {}, "histogram": {}, "icon": {}, "live": {}, diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 604f5dd5419..8d62cb44d0a 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -238,6 +238,11 @@ var ( State: FeatureStateAlpha, FrontendOnly: true, }, + { + Name: "useLegacyHeatmapPanel", + Description: "Continue to use the angular/flot based heatmap panel", + State: FeatureStateStable, + }, { Name: "cloudMonitoringExperimentalUI", Description: "Use grafana-experimental UI in Cloud Monitoring", diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index ac69baf47cc..236c12f1349 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -175,6 +175,10 @@ const ( // Allow elements nesting FlagCanvasPanelNesting = "canvasPanelNesting" + // FlagUseLegacyHeatmapPanel + // Continue to use the angular/flot based heatmap panel + FlagUseLegacyHeatmapPanel = "useLegacyHeatmapPanel" + // FlagCloudMonitoringExperimentalUI // Use grafana-experimental UI in Cloud Monitoring FlagCloudMonitoringExperimentalUI = "cloudMonitoringExperimentalUI" diff --git a/pkg/tests/api/plugins/data/expectedListResp.json b/pkg/tests/api/plugins/data/expectedListResp.json index 903cc3a1eff..3ac893eb187 100644 --- a/pkg/tests/api/plugins/data/expectedListResp.json +++ b/pkg/tests/api/plugins/data/expectedListResp.json @@ -628,16 +628,7 @@ "url": "https://grafana.com" }, "description": "Like a histogram over time", - "links": [ - { - "name": "Brendan Gregg - Heatmaps", - "url": "http://www.brendangregg.com/heatmaps.html" - }, - { - "name": "Brendan Gregg - Latency Heatmaps", - "url": " http://www.brendangregg.com/HeatMaps/latency.html" - } - ], + "links": null, "logos": { "small": "public/app/plugins/panel/heatmap/img/icn-heatmap-panel.svg", "large": "public/app/plugins/panel/heatmap/img/icn-heatmap-panel.svg" @@ -662,9 +653,9 @@ "signatureOrg": "" }, { - "name": "Heatmap (new)", + "name": "Heatmap (legacy)", "type": "panel", - "id": "heatmap-new", + "id": "heatmap-old", "enabled": true, "pinned": false, "info": { @@ -672,11 +663,20 @@ "name": "Grafana Labs", "url": "https://grafana.com" }, - "description": "This heatmap panel will replace the heatmap panel in 9.1", - "links": null, + "description": "Legacy heatmap panel based on angular, d3, and flot", + "links": [ + { + "name": "Brendan Gregg - Heatmaps", + "url": "http://www.brendangregg.com/heatmaps.html" + }, + { + "name": "Brendan Gregg - Latency Heatmaps", + "url": " http://www.brendangregg.com/HeatMaps/latency.html" + } + ], "logos": { - "small": "public/app/plugins/panel/heatmap-new/img/icn-heatmap-panel.svg", - "large": "public/app/plugins/panel/heatmap-new/img/icn-heatmap-panel.svg" + "small": "public/app/plugins/panel/heatmap-old/img/icn-heatmap-panel.svg", + "large": "public/app/plugins/panel/heatmap-old/img/icn-heatmap-panel.svg" }, "build": {}, "screenshots": null, @@ -690,9 +690,9 @@ }, "latestVersion": "", "hasUpdate": false, - "defaultNavUrl": "/plugins/heatmap-new/", + "defaultNavUrl": "/plugins/heatmap-old/", "category": "", - "state": "beta", + "state": "deprecated", "signature": "internal", "signatureType": "", "signatureOrg": "" diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts index cca68f6b76b..52badec1b66 100644 --- a/public/app/features/dashboard/state/PanelModel.ts +++ b/public/app/features/dashboard/state/PanelModel.ts @@ -224,10 +224,17 @@ export class PanelModel implements DataConfigSource, IPanelModel { (this as any)[property] = model[property]; } - // Special 'graph' migration logic - if (this.type === 'graph' && config?.featureToggles?.autoMigrateGraphPanels) { - this.autoMigrateFrom = this.type; - this.type = 'timeseries'; + switch (this.type) { + case 'graph': + if (config?.featureToggles?.autoMigrateGraphPanels) { + this.autoMigrateFrom = this.type; + this.type = 'timeseries'; + } + break; + case 'heatmap-new': + this.autoMigrateFrom = this.type; + this.type = 'heatmap'; + break; } // defaults diff --git a/public/app/features/plugins/built_in_plugins.ts b/public/app/features/plugins/built_in_plugins.ts index 6202e566bb6..d8e9bf1d86b 100644 --- a/public/app/features/plugins/built_in_plugins.ts +++ b/public/app/features/plugins/built_in_plugins.ts @@ -40,6 +40,7 @@ const tempoPlugin = async () => const alertmanagerPlugin = async () => await import(/* webpackChunkName: "alertmanagerPlugin" */ 'app/plugins/datasource/alertmanager/module'); +import { config } from '@grafana/runtime'; import * as alertGroupsPanel from 'app/plugins/panel/alertGroups/module'; import * as alertListPanel from 'app/plugins/panel/alertlist/module'; import * as annoListPanel from 'app/plugins/panel/annolist/module'; @@ -50,7 +51,6 @@ import * as dashListPanel from 'app/plugins/panel/dashlist/module'; import * as debugPanel from 'app/plugins/panel/debug/module'; import * as gaugePanel from 'app/plugins/panel/gauge/module'; import * as gettingStartedPanel from 'app/plugins/panel/gettingstarted/module'; -import * as heatmapPanelNG from 'app/plugins/panel/heatmap-new/module'; import * as histogramPanel from 'app/plugins/panel/histogram/module'; import * as livePanel from 'app/plugins/panel/live/module'; import * as logsPanel from 'app/plugins/panel/logs/module'; @@ -73,10 +73,24 @@ const canvasPanel = async () => await import(/* webpackChunkName: "canvasPanel" const iconPanel = async () => await import(/* webpackChunkName: "iconPanel" */ 'app/plugins/panel/icon/module'); const graphPanel = async () => await import(/* webpackChunkName: "graphPlugin" */ 'app/plugins/panel/graph/module'); const heatmapPanel = async () => - await import(/* webpackChunkName: "heatmapPlugin" */ 'app/plugins/panel/heatmap/module'); + await import(/* webpackChunkName: "heatmapPanel" */ 'app/plugins/panel/heatmap/module'); +const heatmapPanelOLD = async () => + await import(/* webpackChunkName: "heatmapPanelOLD" */ 'app/plugins/panel/heatmap-old/module'); + const tableOldPanel = async () => await import(/* webpackChunkName: "tableOldPlugin" */ 'app/plugins/panel/table-old/module'); +// Automatically migrate heatmap panel. +if (config.featureToggles.useLegacyHeatmapPanel) { + const heatmap = config.panels['heatmap']; + const legacy = config.panels['heatmap-old']; + legacy.id = heatmap.id; + legacy.module = heatmap.module; + legacy.state = heatmap.state; + config.panels['heatmap'] = legacy; +} +delete config.panels['heatmap-old']; + const builtInPlugins: any = { 'app/plugins/datasource/graphite/module': graphitePlugin, 'app/plugins/datasource/cloudwatch/module': cloudwatchPlugin, @@ -112,8 +126,7 @@ const builtInPlugins: any = { 'app/plugins/panel/dashlist/module': dashListPanel, 'app/plugins/panel/alertlist/module': alertListPanel, 'app/plugins/panel/annolist/module': annoListPanel, - 'app/plugins/panel/heatmap/module': heatmapPanel, - 'app/plugins/panel/heatmap-new/module': heatmapPanelNG, + 'app/plugins/panel/heatmap/module': config.featureToggles.useLegacyHeatmapPanel ? heatmapPanelOLD : heatmapPanel, 'app/plugins/panel/table/module': tablePanel, 'app/plugins/panel/table-old/module': tableOldPanel, 'app/plugins/panel/news/module': newsPanel, diff --git a/public/app/plugins/panel/heatmap-new/plugin.json b/public/app/plugins/panel/heatmap-new/plugin.json deleted file mode 100644 index 7d271f1e320..00000000000 --- a/public/app/plugins/panel/heatmap-new/plugin.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "type": "panel", - "name": "Heatmap (new)", - "id": "heatmap-new", - "state": "beta", - - "info": { - "description": "This heatmap panel will replace the heatmap panel in 9.1", - "author": { - "name": "Grafana Labs", - "url": "https://grafana.com" - }, - "logos": { - "small": "img/icn-heatmap-panel.svg", - "large": "img/icn-heatmap-panel.svg" - } - } -} diff --git a/public/app/plugins/panel/heatmap-new/README.md b/public/app/plugins/panel/heatmap-old/README.md similarity index 83% rename from public/app/plugins/panel/heatmap-new/README.md rename to public/app/plugins/panel/heatmap-old/README.md index 626bf160c4f..17a080b9cc7 100644 --- a/public/app/plugins/panel/heatmap-new/README.md +++ b/public/app/plugins/panel/heatmap-old/README.md @@ -1,4 +1,4 @@ -# Heatmap Panel (NEXT GEN) - Native Plugin +# Heatmap Panel - Native Plugin The Heatmap panel allows you to view histograms over time and is **included** with Grafana. diff --git a/public/app/plugins/panel/heatmap/axes_editor.ts b/public/app/plugins/panel/heatmap-old/axes_editor.ts similarity index 100% rename from public/app/plugins/panel/heatmap/axes_editor.ts rename to public/app/plugins/panel/heatmap-old/axes_editor.ts diff --git a/public/app/plugins/panel/heatmap/color_legend.ts b/public/app/plugins/panel/heatmap-old/color_legend.ts similarity index 100% rename from public/app/plugins/panel/heatmap/color_legend.ts rename to public/app/plugins/panel/heatmap-old/color_legend.ts diff --git a/public/app/plugins/panel/heatmap/color_scale.ts b/public/app/plugins/panel/heatmap-old/color_scale.ts similarity index 100% rename from public/app/plugins/panel/heatmap/color_scale.ts rename to public/app/plugins/panel/heatmap-old/color_scale.ts diff --git a/public/app/plugins/panel/heatmap/display_editor.ts b/public/app/plugins/panel/heatmap-old/display_editor.ts similarity index 100% rename from public/app/plugins/panel/heatmap/display_editor.ts rename to public/app/plugins/panel/heatmap-old/display_editor.ts diff --git a/public/app/plugins/panel/heatmap/heatmap_ctrl.ts b/public/app/plugins/panel/heatmap-old/heatmap_ctrl.ts similarity index 98% rename from public/app/plugins/panel/heatmap/heatmap_ctrl.ts rename to public/app/plugins/panel/heatmap-old/heatmap_ctrl.ts index 0ad0642afbd..74a112b5f16 100644 --- a/public/app/plugins/panel/heatmap/heatmap_ctrl.ts +++ b/public/app/plugins/panel/heatmap-old/heatmap_ctrl.ts @@ -155,6 +155,9 @@ export class HeatmapCtrl extends MetricsPanelCtrl { this.events.on(PanelEvents.editModeInitialized, this.onInitEditMode.bind(this)); this.onCardColorChange = this.onCardColorChange.bind(this); + + // Make sure we do not save the version so migration to react version is kicked off + delete this.panel.pluginVersion; } onInitEditMode() { diff --git a/public/app/plugins/panel/heatmap/heatmap_data_converter.ts b/public/app/plugins/panel/heatmap-old/heatmap_data_converter.ts similarity index 100% rename from public/app/plugins/panel/heatmap/heatmap_data_converter.ts rename to public/app/plugins/panel/heatmap-old/heatmap_data_converter.ts diff --git a/public/app/plugins/panel/heatmap/heatmap_tooltip.ts b/public/app/plugins/panel/heatmap-old/heatmap_tooltip.ts similarity index 100% rename from public/app/plugins/panel/heatmap/heatmap_tooltip.ts rename to public/app/plugins/panel/heatmap-old/heatmap_tooltip.ts diff --git a/public/app/plugins/panel/heatmap-new/img/icn-heatmap-panel.svg b/public/app/plugins/panel/heatmap-old/img/icn-heatmap-panel.svg similarity index 100% rename from public/app/plugins/panel/heatmap-new/img/icn-heatmap-panel.svg rename to public/app/plugins/panel/heatmap-old/img/icn-heatmap-panel.svg diff --git a/public/app/plugins/panel/heatmap/module.html b/public/app/plugins/panel/heatmap-old/module.html similarity index 100% rename from public/app/plugins/panel/heatmap/module.html rename to public/app/plugins/panel/heatmap-old/module.html diff --git a/public/app/plugins/panel/heatmap/module.ts b/public/app/plugins/panel/heatmap-old/module.ts similarity index 100% rename from public/app/plugins/panel/heatmap/module.ts rename to public/app/plugins/panel/heatmap-old/module.ts diff --git a/public/app/plugins/panel/heatmap-old/plugin.json b/public/app/plugins/panel/heatmap-old/plugin.json new file mode 100644 index 00000000000..5a00015d78f --- /dev/null +++ b/public/app/plugins/panel/heatmap-old/plugin.json @@ -0,0 +1,22 @@ +{ + "type": "panel", + "name": "Heatmap (legacy)", + "id": "heatmap-old", + "state": "deprecated", + + "info": { + "description": "Legacy heatmap panel based on angular, d3, and flot", + "author": { + "name": "Grafana Labs", + "url": "https://grafana.com" + }, + "logos": { + "small": "img/icn-heatmap-panel.svg", + "large": "img/icn-heatmap-panel.svg" + }, + "links": [ + { "name": "Brendan Gregg - Heatmaps", "url": "http://www.brendangregg.com/heatmaps.html" }, + { "name": "Brendan Gregg - Latency Heatmaps", "url": " http://www.brendangregg.com/HeatMaps/latency.html" } + ] + } +} diff --git a/public/app/plugins/panel/heatmap/rendering.ts b/public/app/plugins/panel/heatmap-old/rendering.ts similarity index 100% rename from public/app/plugins/panel/heatmap/rendering.ts rename to public/app/plugins/panel/heatmap-old/rendering.ts diff --git a/public/app/plugins/panel/heatmap/specs/heatmap_ctrl.test.ts b/public/app/plugins/panel/heatmap-old/specs/heatmap_ctrl.test.ts similarity index 100% rename from public/app/plugins/panel/heatmap/specs/heatmap_ctrl.test.ts rename to public/app/plugins/panel/heatmap-old/specs/heatmap_ctrl.test.ts diff --git a/public/app/plugins/panel/heatmap/specs/heatmap_data_converter.test.ts b/public/app/plugins/panel/heatmap-old/specs/heatmap_data_converter.test.ts similarity index 100% rename from public/app/plugins/panel/heatmap/specs/heatmap_data_converter.test.ts rename to public/app/plugins/panel/heatmap-old/specs/heatmap_data_converter.test.ts diff --git a/public/app/plugins/panel/heatmap/types.ts b/public/app/plugins/panel/heatmap-old/types.ts similarity index 100% rename from public/app/plugins/panel/heatmap/types.ts rename to public/app/plugins/panel/heatmap-old/types.ts diff --git a/public/app/plugins/panel/heatmap-new/HeatmapHoverView.tsx b/public/app/plugins/panel/heatmap/HeatmapHoverView.tsx similarity index 100% rename from public/app/plugins/panel/heatmap-new/HeatmapHoverView.tsx rename to public/app/plugins/panel/heatmap/HeatmapHoverView.tsx diff --git a/public/app/plugins/panel/heatmap-new/HeatmapPanel.tsx b/public/app/plugins/panel/heatmap/HeatmapPanel.tsx similarity index 100% rename from public/app/plugins/panel/heatmap-new/HeatmapPanel.tsx rename to public/app/plugins/panel/heatmap/HeatmapPanel.tsx diff --git a/public/app/plugins/panel/heatmap-new/fields.test.ts b/public/app/plugins/panel/heatmap/fields.test.ts similarity index 100% rename from public/app/plugins/panel/heatmap-new/fields.test.ts rename to public/app/plugins/panel/heatmap/fields.test.ts diff --git a/public/app/plugins/panel/heatmap-new/fields.ts b/public/app/plugins/panel/heatmap/fields.ts similarity index 100% rename from public/app/plugins/panel/heatmap-new/fields.ts rename to public/app/plugins/panel/heatmap/fields.ts diff --git a/public/app/plugins/panel/heatmap-new/migrations.test.ts b/public/app/plugins/panel/heatmap/migrations.test.ts similarity index 98% rename from public/app/plugins/panel/heatmap-new/migrations.test.ts rename to public/app/plugins/panel/heatmap/migrations.test.ts index 44f92e3851a..e70d46d350d 100644 --- a/public/app/plugins/panel/heatmap-new/migrations.test.ts +++ b/public/app/plugins/panel/heatmap/migrations.test.ts @@ -47,7 +47,7 @@ describe('Heatmap Migrations', () => { }, "color": Object { "exponent": 0.5, - "fill": "dark-orange", + "fill": "#b4ff00", "max": 100, "min": 5, "mode": "scheme", diff --git a/public/app/plugins/panel/heatmap-new/migrations.ts b/public/app/plugins/panel/heatmap/migrations.ts similarity index 99% rename from public/app/plugins/panel/heatmap-new/migrations.ts rename to public/app/plugins/panel/heatmap/migrations.ts index 915a4dfe010..5f40fff6888 100644 --- a/public/app/plugins/panel/heatmap-new/migrations.ts +++ b/public/app/plugins/panel/heatmap/migrations.ts @@ -140,6 +140,7 @@ export function angularToReactHeatmap(angular: any): { fieldConfig: FieldConfigS break; } } + options.color.fill = color.cardColor; options.color.min = color.min; options.color.max = color.max; diff --git a/public/app/plugins/panel/heatmap-new/models.cue b/public/app/plugins/panel/heatmap/models.cue similarity index 97% rename from public/app/plugins/panel/heatmap-new/models.cue rename to public/app/plugins/panel/heatmap/models.cue index 90e840998ac..78903bfaa8f 100644 --- a/public/app/plugins/panel/heatmap-new/models.cue +++ b/public/app/plugins/panel/heatmap/models.cue @@ -17,7 +17,7 @@ package grafanaschema import "github.com/grafana/thema" Panel: thema.#Lineage & { - name: "heatmap-new" + name: "heatmap" seqs: [ { schemas: [ diff --git a/public/app/plugins/panel/heatmap-new/models.gen.ts b/public/app/plugins/panel/heatmap/models.gen.ts similarity index 100% rename from public/app/plugins/panel/heatmap-new/models.gen.ts rename to public/app/plugins/panel/heatmap/models.gen.ts diff --git a/public/app/plugins/panel/heatmap-new/module.tsx b/public/app/plugins/panel/heatmap/module.tsx similarity index 100% rename from public/app/plugins/panel/heatmap-new/module.tsx rename to public/app/plugins/panel/heatmap/module.tsx diff --git a/public/app/plugins/panel/heatmap-new/palettes.ts b/public/app/plugins/panel/heatmap/palettes.ts similarity index 100% rename from public/app/plugins/panel/heatmap-new/palettes.ts rename to public/app/plugins/panel/heatmap/palettes.ts diff --git a/public/app/plugins/panel/heatmap/plugin.json b/public/app/plugins/panel/heatmap/plugin.json index 9a325635f0c..0f7cbaba096 100644 --- a/public/app/plugins/panel/heatmap/plugin.json +++ b/public/app/plugins/panel/heatmap/plugin.json @@ -12,10 +12,6 @@ "logos": { "small": "img/icn-heatmap-panel.svg", "large": "img/icn-heatmap-panel.svg" - }, - "links": [ - { "name": "Brendan Gregg - Heatmaps", "url": "http://www.brendangregg.com/heatmaps.html" }, - { "name": "Brendan Gregg - Latency Heatmaps", "url": " http://www.brendangregg.com/HeatMaps/latency.html" } - ] + } } } diff --git a/public/app/plugins/panel/heatmap-new/suggestions.ts b/public/app/plugins/panel/heatmap/suggestions.ts similarity index 96% rename from public/app/plugins/panel/heatmap-new/suggestions.ts rename to public/app/plugins/panel/heatmap/suggestions.ts index 057e39acf2e..4600430cd91 100644 --- a/public/app/plugins/panel/heatmap-new/suggestions.ts +++ b/public/app/plugins/panel/heatmap/suggestions.ts @@ -25,7 +25,7 @@ export class HeatmapSuggestionsSupplier { builder.getListAppender({ name: '', - pluginId: 'heatmap-new', + pluginId: 'heatmap', options: {}, fieldConfig: { defaults: { diff --git a/public/app/plugins/panel/heatmap-new/utils.test.ts b/public/app/plugins/panel/heatmap/utils.test.ts similarity index 100% rename from public/app/plugins/panel/heatmap-new/utils.test.ts rename to public/app/plugins/panel/heatmap/utils.test.ts diff --git a/public/app/plugins/panel/heatmap-new/utils.ts b/public/app/plugins/panel/heatmap/utils.ts similarity index 100% rename from public/app/plugins/panel/heatmap-new/utils.ts rename to public/app/plugins/panel/heatmap/utils.ts