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

pull/65191/head^2
Ryan McKinley 3 years ago committed by GitHub
parent 0975e53fc0
commit 5870439026
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 257
      devenv/dev-dashboards/migrations/migrations.json
  2. 3
      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

@ -42,6 +42,30 @@
"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,
@ -112,7 +136,7 @@
"fillGradient": 0,
"gridPos": {
"h": 11,
"w": 15,
"w": 16,
"x": 0,
"y": 0
},
@ -200,8 +224,8 @@
},
"gridPos": {
"h": 11,
"w": 9,
"x": 15,
"w": 8,
"x": 16,
"y": 0
},
"id": 6,
@ -215,6 +239,15 @@
"mode": "markdown"
},
"pluginVersion": "9.5.0-pre",
"targets": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"refId": "A"
}
],
"title": "Status + Notes",
"type": "text"
},
@ -227,7 +260,7 @@
"fontSize": "100%",
"gridPos": {
"h": 10,
"w": 15,
"w": 16,
"x": 0,
"y": 11
},
@ -303,8 +336,8 @@
},
"gridPos": {
"h": 10,
"w": 9,
"x": 15,
"w": 8,
"x": 16,
"y": 11
},
"id": 7,
@ -318,12 +351,218 @@
"mode": "markdown"
},
"pluginVersion": "9.5.0-pre",
"targets": [
{
"datasource": {
"type": "testdata",
"uid": "PD8C576611E62080A"
},
"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
},
{
"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"
},
{
"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"
},
{
"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": 35,
"schemaVersion": 34,
"style": "dark",
"tags": [
"gdev",
@ -341,6 +580,6 @@
"timezone": "",
"title": "Devenv - Panel migrations",
"uid": "cdd412c4",
"version": 9,
"version": 6,
"weekStart": ""
}
}

@ -35,7 +35,7 @@ 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 |
@ -43,6 +43,7 @@ Some stable features are enabled by default. You can disable a stable feature by
| `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 |

@ -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