grafana/public/app/features
Josh Myers eb7dd8e377
Dashboard: protect against missing overrides section (#35577)
* Protect against missing overrides section

We are using grafonnet-lib to generate dashboards. These dashboards do
not contain any `override` keys in `fieldConfig` by default and that is
causing this DashboardMigrator script to blow up when trying to import
the dashboards, see [1]. In Grafana v7, an empty overrides is
automatically added but using grafonnet-lib, it isn't possible to set an
empty overrides attribute e.g. [2] requires matcher/properties to be
set. Setting to null ends up giving me [3], which causes the panel to
not be displayed.

[1]
```
initDashboard.ts:137 TypeError: t.overrides is not iterable
    at v.w (DashboardMigrator.ts:960)
    at v.updateSchema (DashboardMigrator.ts:672)
    at D.updateSchema (DashboardModel.ts:993)
    at new D (DashboardModel.ts:156)
    at initDashboard.ts:134
```

[2]
https://github.com/grafana/grafonnet-lib/blob/master/grafonnet/stat_panel.libsonnet#L150-L164

[3]
```
"fieldConfig": {
   "defaults": {
      "links": [ ],
      "mappings": [ ],
      "thresholds": {
         "mode": "absolute",
         "steps": [
            {
               "color": "red",
               "value": 0
            },
            {
               "color": "orange",
               "value": 1
            },
            {
               "color": "green",
               "value": 3
            }
         ]
      },
      "unit": "none"
   },
   "overrides": [
      { }
   ]
},
```

* Update public/app/features/dashboard/state/DashboardMigrator.ts

Co-authored-by: Marcus Andersson <systemvetaren@gmail.com>
2021-06-17 08:33:36 +02:00
..
admin Chore: Fix more strict typescript errors (#35514) 2021-06-14 15:13:48 +01:00
alerting Chore: Fix more strict typescript errors (#35514) 2021-06-14 15:13:48 +01:00
annotations Annotations: Fix annotation line and marker colors (#35608) 2021-06-14 11:36:33 +02:00
api-keys Theme: Renames new theme model from GrafanaThemeV2 to just GrafanaTheme (#33619) 2021-05-03 09:45:54 +02:00
dashboard Dashboard: protect against missing overrides section (#35577) 2021-06-17 08:33:36 +02:00
datasources Plugins: Update plugin signing copy + docs (#34716) 2021-05-31 21:54:53 +02:00
explore Theme: Change white base in dark theme (#35564) 2021-06-11 17:33:56 +02:00
expressions Alerting: Don't reset value when changing evaluator method on classic condition (#35750) 2021-06-16 14:11:36 +02:00
folders LibraryPanels: removes feature toggle (#33839) 2021-05-12 08:48:17 +02:00
inspector Dashboard: Fix changes doesn't reflect after changing panel sizes in inspect JSON and click on apply (#35276) 2021-06-15 14:12:32 +02:00
library-panels Library Panels: Fix refresh when changing to angular library panel (#35048) 2021-06-02 13:35:12 +01:00
live Live: only connect when user has a role (#35339) 2021-06-08 14:00:24 -07:00
manage-dashboards Form: Expose all return values from useForm (#34380) 2021-05-24 15:09:33 +03:00
org Theme: Page styles move to emotion global styles and design tweaks (#33529) 2021-04-30 10:04:01 +02:00
panel Library Panels: Fix refresh when changing to angular library panel (#35048) 2021-06-02 13:35:12 +01:00
playlist Card: Defend against conditional action buttons (#35204) 2021-06-04 14:38:29 +02:00
plugins Plugins: Update plugin signing copy + docs (#34716) 2021-05-31 21:54:53 +02:00
profile Admin: Fixes infinite loading edit profile page (#34627) 2021-05-25 14:48:16 +02:00
query Chore: Refactors flaky Frontend test (#35645) 2021-06-15 13:33:24 +02:00
sandbox GraphNG: refactor (#33348) 2021-05-05 03:44:31 -05:00
search Search: runAllTimers => runOnlyPendingTimers (#35509) 2021-06-11 12:45:18 +03:00
teams Theme: Page styles move to emotion global styles and design tweaks (#33529) 2021-04-30 10:04:01 +02:00
templating Performance: Standardize lodash imports to use destructured members (#33040) 2021-04-21 09:38:00 +02:00
users v8: Update login page design (#33923) 2021-05-11 16:34:44 +02:00
variables Fix: allow variables in nested objects (#35684) 2021-06-16 08:36:25 +02:00
all.ts TimeSrv: Refactor service to have no dependency on angular (#32562) 2021-04-01 06:33:11 +02:00