Angular: Add feature toggle to disable angular at runtime (#65245)

pull/65191/head^2
Ryan McKinley 2 years ago committed by GitHub
parent 0975e53fc0
commit 5870439026
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 871
      devenv/dev-dashboards/migrations/migrations.json
  2. 25
      docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md
  3. 1
      packages/grafana-data/src/types/featureToggles.gen.ts
  4. 4
      packages/grafana-runtime/src/config.ts
  5. 2
      packages/grafana-ui/src/options/builder/tooltip.tsx
  6. 7
      pkg/services/featuremgmt/registry.go
  7. 1
      pkg/services/featuremgmt/toggles_gen.csv
  8. 4
      pkg/services/featuremgmt/toggles_gen.go

@ -1,346 +1,585 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"links": [
{
"asDropdown": false,
"icon": "dashboard",
"includeVars": false,
"keepTime": false,
"tags": [],
"targetBlank": true,
"title": "Auto migrate (TRUE)",
"tooltip": "",
"type": "link",
"url": "/d/cdd412c4/?__feature.autoMigrateOldPanels=true"
},
{
"asDropdown": false,
"icon": "external link",
"includeVars": false,
"keepTime": false,
"tags": [],
"targetBlank": true,
"title": "Auto migrate (FALSE)",
"tooltip": "",
"type": "link",
"url": "/d/cdd412c4/?__feature.autoMigrateOldPanels=false"
}
],
"liveNow": false,
"panels": [
"annotations": {
"list": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"builtIn": 1,
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
"type": "grafana",
"uid": "-- Grafana --"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"links": [
{
"asDropdown": false,
"icon": "dashboard",
"includeVars": false,
"keepTime": false,
"tags": [],
"targetBlank": true,
"title": "Auto migrate (TRUE)",
"tooltip": "",
"type": "link",
"url": "/d/cdd412c4/?__feature.autoMigrateOldPanels=true"
},
{
"asDropdown": false,
"icon": "external link",
"includeVars": false,
"keepTime": false,
"tags": [],
"targetBlank": true,
"title": "Auto migrate (FALSE)",
"tooltip": "",
"type": "link",
"url": "/d/cdd412c4/?__feature.autoMigrateOldPanels=false"
},
{
"asDropdown": false,
"icon": "dashboard",
"includeVars": false,
"keepTime": false,
"tags": [],
"targetBlank": true,
"title": "Disable angular (TRUE)",
"tooltip": "",
"type": "link",
"url": "/d/cdd412c4/?__feature.disableAngular=true"
},
{
"asDropdown": false,
"icon": "external link",
"includeVars": false,
"keepTime": false,
"tags": [],
"targetBlank": true,
"title": "Disable angular (FALSE)",
"tooltip": "",
"type": "link",
"url": "/d/cdd412c4/?__feature.disableAngular=false"
}
],
"liveNow": false,
"panels": [
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
"lineInterpolation": "linear",
"lineWidth": 1,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"unit": "short"
"thresholdsStyle": {
"mode": "off"
}
},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 11,
"w": 15,
"x": 0,
"y": 0
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"hiddenSeries": false,
"id": 4,
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 11,
"w": 16,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": 4,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true,
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "none"
}
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"percentage": false,
"pluginVersion": "9.5.0-pre",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"refId": "A",
"scenarioId": "random_walk",
"seriesCount": 3
}
],
"thresholds": [],
"timeRegions": [],
"title": "Flot graph",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "timeseries",
"xaxis": {
"mode": "time",
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"logBase": 1,
"show": true
},
{
"format": "short",
"logBase": 1,
"show": true
}
],
"yaxis": {
"align": false
"mode": "multi",
"sort": "none"
}
},
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"gridPos": {
"h": 11,
"w": 9,
"x": 15,
"y": 0
},
"id": 6,
"options": {
"code": {
"language": "plaintext",
"showLineNumbers": false,
"showMiniMap": false
"percentage": false,
"pluginVersion": "9.5.0-pre",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"content": "# Graph panel >> Timeseries panel\n\nKnown issues:\n* hiding null/empty series\n* time regions",
"mode": "markdown"
},
"pluginVersion": "9.5.0-pre",
"title": "Status + Notes",
"type": "text"
"refId": "A",
"scenarioId": "random_walk",
"seriesCount": 3
}
],
"thresholds": [],
"timeRegions": [],
"title": "Flot graph",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
{
"columns": [],
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
"type": "timeseries",
"xaxis": {
"mode": "time",
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"logBase": 1,
"show": true
},
"fontSize": "100%",
"gridPos": {
"h": 10,
"w": 15,
"x": 0,
"y": 11
{
"format": "short",
"logBase": 1,
"show": true
}
],
"yaxis": {
"align": false
}
},
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"gridPos": {
"h": 11,
"w": 8,
"x": 16,
"y": 0
},
"id": 6,
"options": {
"code": {
"language": "plaintext",
"showLineNumbers": false,
"showMiniMap": false
},
"id": 2,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
"content": "# Graph panel >> Timeseries panel\n\nKnown issues:\n* hiding null/empty series\n* time regions",
"mode": "markdown"
},
"pluginVersion": "9.5.0-pre",
"targets": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"showHeader": true,
"showRowNums": false
"refId": "A"
}
],
"title": "Status + Notes",
"type": "text"
},
{
"columns": [],
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"fontSize": "100%",
"gridPos": {
"h": 10,
"w": 16,
"x": 0,
"y": 11
},
"id": 2,
"options": {
"cellHeight": "sm",
"footer": {
"countRows": false,
"fields": "",
"reducer": [
"sum"
],
"show": false
},
"pluginVersion": "9.5.0-pre",
"showHeader": true,
"sort": {
"col": 0,
"desc": true
"showRowNums": false
},
"pluginVersion": "9.5.0-pre",
"showHeader": true,
"sort": {
"col": 0,
"desc": true
},
"styles": [
{
"alias": "Time",
"align": "auto",
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"pattern": "Time",
"type": "date"
},
"styles": [
{
"alias": "Time",
"align": "auto",
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"pattern": "Time",
"type": "date"
{
"alias": "",
"align": "right",
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"decimals": 2,
"pattern": "/.*/",
"thresholds": [],
"type": "number",
"unit": "short"
}
],
"targets": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
{
"alias": "",
"align": "right",
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"decimals": 2,
"pattern": "/.*/",
"thresholds": [],
"type": "number",
"unit": "short"
}
],
"targets": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"refId": "A",
"scenarioId": "random_walk_table"
}
],
"title": "Table (old)",
"transform": "table",
"transformations": [
{
"id": "merge",
"options": {
"reducers": []
}
"refId": "A",
"scenarioId": "random_walk_table"
}
],
"title": "Table (old)",
"transform": "table",
"transformations": [
{
"id": "merge",
"options": {
"reducers": []
}
],
"type": "table-old"
}
],
"type": "table-old"
},
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"gridPos": {
"h": 10,
"w": 9,
"x": 15,
"y": 11
"gridPos": {
"h": 10,
"w": 8,
"x": 16,
"y": 11
},
"id": 7,
"options": {
"code": {
"language": "plaintext",
"showLineNumbers": false,
"showMiniMap": false
},
"id": 7,
"options": {
"code": {
"language": "plaintext",
"showLineNumbers": false,
"showMiniMap": false
"content": "# Table (old) >> Table\n\nKnown issues:\n* wrapping text\n* style changes",
"mode": "markdown"
},
"pluginVersion": "9.5.0-pre",
"targets": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"content": "# Table (old) >> Table\n\nKnown issues:\n* wrapping text\n* style changes",
"mode": "markdown"
"refId": "A"
}
],
"title": "Status + Notes",
"type": "text"
},
{
"colorBackground": false,
"colorValue": true,
"colors": [
"#299c46",
"rgba(237, 129, 40, 0.89)",
"#d44a3a"
],
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"format": "areaF2",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 8,
"w": 8,
"x": 0,
"y": 21
},
"id": 9,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
"pluginVersion": "9.5.0-pre",
"title": "Status + Notes",
"type": "text"
}
],
"refresh": "",
"schemaVersion": 35,
"style": "dark",
"tags": [
"gdev",
"migrations",
"angular"
],
"templating": {
"list": []
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"postfix": "b",
"postfixFontSize": "50%",
"prefix": "a",
"prefixFontSize": "50%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "",
"targets": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"refId": "A"
}
],
"thresholds": "",
"title": "grafana-singlestat-panel",
"type": "grafana-singlestat-panel",
"valueFontSize": "80%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
"time": {
"from": "now-6h",
"to": "now"
{
"colorBackground": false,
"colorValue": true,
"colors": [
"#299c46",
"#73BF69",
"#d44a3a"
],
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"format": "ms",
"gauge": {
"maxValue": 100,
"minValue": 0,
"show": false,
"thresholdLabels": false,
"thresholdMarkers": true
},
"gridPos": {
"h": 8,
"w": 8,
"x": 8,
"y": 21
},
"id": 23,
"links": [],
"mappingType": 1,
"mappingTypes": [
{
"name": "value to text",
"value": 1
},
{
"name": "range to text",
"value": 2
}
],
"maxDataPoints": 100,
"nullPointMode": "connected",
"pluginVersion": "6.2.0-pre",
"postfix": "",
"postfixFontSize": "50%",
"prefix": "p95",
"prefixFontSize": "80%",
"rangeMaps": [
{
"from": "null",
"text": "N/A",
"to": "null"
}
],
"sparkline": {
"fillColor": "rgba(31, 118, 189, 0.18)",
"full": false,
"lineColor": "rgb(31, 120, 193)",
"show": true
},
"tableColumn": "",
"targets": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"refId": "A"
}
],
"thresholds": "",
"title": "singlestat (old, internal. Migrated if schema < 28)",
"type": "singlestat",
"valueFontSize": "120%",
"valueMaps": [
{
"op": "=",
"text": "N/A",
"value": "null"
}
],
"valueName": "avg"
},
"timepicker": {},
"timezone": "",
"title": "Devenv - Panel migrations",
"uid": "cdd412c4",
"version": 9,
"weekStart": ""
}
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"gridPos": {
"h": 8,
"w": 8,
"x": 16,
"y": 21
},
"id": 10,
"options": {
"code": {
"language": "plaintext",
"showLineNumbers": false,
"showMiniMap": false
},
"content": "# Singlestat >> Stat\n\nKnown issues:\n* limited options",
"mode": "markdown"
},
"pluginVersion": "9.5.0-pre",
"targets": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"refId": "A"
}
],
"title": "Status + Notes",
"type": "text"
}
],
"refresh": "",
"schemaVersion": 34,
"style": "dark",
"tags": [
"gdev",
"migrations",
"angular"
],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "Devenv - Panel migrations",
"uid": "cdd412c4",
"version": 6,
"weekStart": ""
}

@ -34,18 +34,19 @@ Some stable features are enabled by default. You can disable a stable feature by
## Beta feature toggles
| Feature toggle name | Description |
| --------------------------------- | ---------------------------------------------------------------------------------- |
| `trimDefaults` | Use cue schema to remove values that will be applied automatically |
| `panelTitleSearch` | Search for dashboards using panel title |
| `prometheusAzureOverrideAudience` | Experimental. Allow override default AAD audience for Azure Prometheus endpoint |
| `migrationLocking` | Lock database during migrations |
| `newDBLibrary` | Use jmoiron/sqlx rather than xorm for a few backend services |
| `validateDashboardsOnSave` | Validate dashboard JSON POSTed to api/dashboards/db |
| `autoMigrateOldPanels` | Migrate old angular panels to supported versions (graph, table-old, worldmap, etc) |
| `topnav` | Displays new top nav and page layouts |
| `accessControlOnCall` | Access control primitives for OnCall |
| `alertingNoNormalState` | Stop maintaining state of alerts that are not firing |
| Feature toggle name | Description |
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `trimDefaults` | Use cue schema to remove values that will be applied automatically |
| `panelTitleSearch` | Search for dashboards using panel title |
| `prometheusAzureOverrideAudience` | Experimental. Allow override default AAD audience for Azure Prometheus endpoint |
| `migrationLocking` | Lock database during migrations |
| `newDBLibrary` | Use jmoiron/sqlx rather than xorm for a few backend services |
| `validateDashboardsOnSave` | Validate dashboard JSON POSTed to api/dashboards/db |
| `autoMigrateOldPanels` | Migrate old angular panels to supported versions (graph, table-old, worldmap, etc) |
| `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. |
| `topnav` | Displays new top nav and page layouts |
| `accessControlOnCall` | Access control primitives for OnCall |
| `alertingNoNormalState` | Stop maintaining state of alerts that are not firing |
## Alpha feature toggles

@ -44,6 +44,7 @@ export interface FeatureToggles {
newDBLibrary?: boolean;
validateDashboardsOnSave?: boolean;
autoMigrateOldPanels?: boolean;
disableAngular?: boolean;
prometheusWideSeries?: boolean;
canvasPanelNesting?: boolean;
scenes?: boolean;

@ -188,6 +188,10 @@ export class GrafanaBootConfig implements GrafanaConfig {
overrideFeatureTogglesFromUrl(this);
if (this.featureToggles.disableAngular) {
this.angularSupportEnabled = false;
}
// Creating theme after applying feature toggle overrides in case we need to toggle anything
this.theme2 = createTheme(getThemeCustomizations(this));

@ -38,7 +38,7 @@ export function addTooltipOptions<T extends OptionsWithTooltip>(
name: 'Values sort order',
category,
defaultValue: SortOrder.None,
showIf: (options: T) => options.tooltip.mode === TooltipDisplayMode.Multi,
showIf: (options: T) => options.tooltip?.mode === TooltipDisplayMode.Multi,
settings: {
options: sortOptions,
},

@ -175,6 +175,13 @@ var (
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.",
State: FeatureStateBeta,
FrontendOnly: true,
Owner: grafanaDatavizSquad,
},
{
Name: "prometheusWideSeries",
Description: "Enable wide series responses in the Prometheus datasource",

@ -25,6 +25,7 @@ traceToMetrics,alpha,@grafana/observability-traces-and-profiling,false,false,fal
newDBLibrary,beta,@grafana/backend-platform,false,false,false,false
validateDashboardsOnSave,beta,@grafana/grafana-as-code,false,false,true,false
autoMigrateOldPanels,beta,@grafana/dataviz-squad,false,false,false,true
disableAngular,beta,@grafana/dataviz-squad,false,false,false,true
prometheusWideSeries,alpha,@grafana/observability-metrics,false,false,false,false
canvasPanelNesting,alpha,@grafana/dataviz-squad,false,false,false,true
scenes,alpha,@grafana/dashboards-squad,false,false,false,true

1 Name State Owner requiresDevMode RequiresLicense RequiresRestart FrontendOnly
25 newDBLibrary beta @grafana/backend-platform false false false false
26 validateDashboardsOnSave beta @grafana/grafana-as-code false false true false
27 autoMigrateOldPanels beta @grafana/dataviz-squad false false false true
28 disableAngular beta @grafana/dataviz-squad false false false true
29 prometheusWideSeries alpha @grafana/observability-metrics false false false false
30 canvasPanelNesting alpha @grafana/dataviz-squad false false false true
31 scenes alpha @grafana/dashboards-squad false false false true

@ -111,6 +111,10 @@ const (
// Migrate old angular panels to supported versions (graph, table-old, worldmap, etc)
FlagAutoMigrateOldPanels = "autoMigrateOldPanels"
// 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"
// FlagPrometheusWideSeries
// Enable wide series responses in the Prometheus datasource
FlagPrometheusWideSeries = "prometheusWideSeries"

Loading…
Cancel
Save