Histogram: Fix crash when state was undefined (when combine was enabled) (#34514)

This commit is contained in:
Torkel Ödegaard 2021-05-20 17:36:20 +02:00 committed by GitHub
parent aa14621d29
commit d0769397b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -285,16 +285,18 @@ func getPanelSort(id string) int {
sort = 10
case "status-grid":
sort = 11
case "graph":
case "histogram":
sort = 12
case "text":
case "graph":
sort = 13
case "alertlist":
case "text":
sort = 14
case "dashlist":
case "alertlist":
sort = 15
case "news":
case "dashlist":
sort = 16
case "news":
sort = 17
}
return sort
}

View File

@ -57,7 +57,7 @@ export const VisualizationSelectPane: FC<Props> = ({ panel }) => {
const match = filterPluginList(plugins, query, plugin.meta);
if (match && match.length) {
onPluginTypeChange(match[0], true);
onPluginTypeChange(match[0], false);
}
}
},

View File

@ -123,7 +123,8 @@ const prepConfig = (frame: DataFrame, theme: GrafanaTheme2) => {
for (let i = 2; i < frame.fields.length; i++) {
const field = frame.fields[i];
field.state!.seriesIndex = seriesIndex++;
field.state = field.state ?? {};
field.state.seriesIndex = seriesIndex++;
const customConfig = { ...field.config.custom };