Fix proxies dropdown in Problems query editor (#2200)

Part 2 of #2197 

Zabbix has two ways of processing and returning proxies depending on the
zabbix version being used:

1. Before 7.0.0 it uses `host`
2. After 7.0.0 it uses `name`


when we made the call to the backend, we accounted for this
[difference](592380851c/src/datasource/zabbix/connectors/zabbix_api/zabbixAPIConnector.ts (L940C5-L944C6)).
However, in the frontend, we always populated the dropdown using
`proxy.host` regardless of the version customers were using.

So for customers that had proxies in their zabbix set up AND were using
a zabbix version `>-7.0.0`, the query editor would crash because we
ended up with a list of undefined options.

This PR changes it so that when `host` is not present, it uses `name` or
otherwise defaults to `''` to ensure that we never have and array of
options with undefined values.
This commit is contained in:
Jocelyn Collado-Kuri
2026-01-14 11:50:17 -08:00
committed by GitHub
parent 592380851c
commit 3a4f3280be
2 changed files with 140 additions and 8 deletions

View File

@@ -43,8 +43,8 @@ export const ProblemsQueryEditor = ({ query, datasource, onChange }: Props) => {
const loadGroupOptions = async () => {
const groups = await datasource.zabbix.getAllGroups();
const options = groups?.map((group) => ({
value: group.name,
label: group.name,
value: group.name ?? '',
label: group.name ?? '',
}));
options.unshift(...getVariableOptions());
return options;
@@ -58,8 +58,8 @@ export const ProblemsQueryEditor = ({ query, datasource, onChange }: Props) => {
const loadHostOptions = async (group: string) => {
const hosts = await datasource.zabbix.getAllHosts(group);
let options: Array<ComboboxOption<string>> = hosts?.map((host) => ({
value: host.name,
label: host.name,
value: host.name ?? '',
label: host.name ?? '',
}));
options = _.uniqBy(options, (o) => o.value);
options.unshift({ value: '/.*/' });
@@ -75,8 +75,8 @@ export const ProblemsQueryEditor = ({ query, datasource, onChange }: Props) => {
const loadAppOptions = async (group: string, host: string) => {
const apps = await datasource.zabbix.getAllApps(group, host);
let options: Array<ComboboxOption<string>> = apps?.map((app) => ({
value: app.name,
label: app.name,
value: app.name ?? '',
label: app.name ?? '',
}));
options = _.uniqBy(options, (o) => o.value);
options.unshift(...getVariableOptions());
@@ -91,8 +91,8 @@ export const ProblemsQueryEditor = ({ query, datasource, onChange }: Props) => {
const loadProxyOptions = async () => {
const proxies = await datasource.zabbix.getProxies();
const options = proxies?.map((proxy) => ({
value: proxy.host,
label: proxy.host,
value: (!!proxy.host ? proxy.host : proxy.name) ?? '',
label: (!!proxy.host ? proxy.host : proxy.name) ?? '',
}));
options.unshift(...getVariableOptions());
return options;