fix(status-page): allow DNS monitors to be added to status pages
The monitor picker on the status page create/configure form fetched candidates using a hardcoded list of monitor types that omitted "dns", so DNS monitors were filtered out server-side and never appeared in the dialog. Everything else was already in place: the DNS provider stores checks like any other monitor type, and the status page renders them once attached. Rather than appending "dns" to the hardcoded list, derive the query from the existing SelectableMonitorTypes tuple in @/Types/Monitor. The two lists had silently drifted apart, and deriving prevents the next new monitor type from hitting the same bug. "hardware" is appended explicitly because infrastructure monitors are created on their own page and so are absent from the selectable set. Net effect on the requested types: gains "dns", loses none. Fixes #3721
This commit is contained in:
1 parent
40e06a2f2b
commit
7096afcdf2
1 file changed
+6
-3
@@ -15,6 +15,7 @@ import type { StatusPageFormData } from "@/Validation/statusPage";
|
||||
import { statusPageStepCount, statusPageStepFieldsFor } from "@/Validation/statusPage";
|
||||
import { useGet, usePost, usePut, useDelete } from "@/Hooks/UseApi";
|
||||
import type { Monitor } from "@/Types/Monitor";
|
||||
import { SelectableMonitorTypes } from "@/Types/Monitor";
|
||||
import type { MonitorDisplayType, StatusPageResponse } from "@/Types/StatusPage";
|
||||
import { getMonitorTypeLabel } from "@/Types/StatusPage";
|
||||
import { timezoneOptions } from "@/Utils/timezoneOptions";
|
||||
@@ -58,11 +59,13 @@ const LogoUploadField = () => {
|
||||
);
|
||||
};
|
||||
|
||||
// Derived from SelectableMonitorTypes so a newly supported monitor type is
|
||||
// offered here automatically; the previous hardcoded list silently omitted DNS.
|
||||
// "hardware" is appended because infrastructure monitors are created on their
|
||||
// own page and so are absent from the selectable set.
|
||||
const monitorsUrl = (() => {
|
||||
const params = new URLSearchParams();
|
||||
["http", "ping", "port", "docker", "game", "grpc", "websocket", "hardware"].forEach(
|
||||
(type) => params.append("type", type)
|
||||
);
|
||||
[...SelectableMonitorTypes, "hardware"].forEach((type) => params.append("type", type));
|
||||
return `/monitors/team?${params.toString()}`;
|
||||
})();
|
||||
|
||||
|
||||
Reference in new issue
Block a user