diff --git a/app/vmui/packages/vmui/src/hooks/useFetchFlags.ts b/app/vmui/packages/vmui/src/hooks/useFetchFlags.ts index 7c695323a..25162157c 100644 --- a/app/vmui/packages/vmui/src/hooks/useFetchFlags.ts +++ b/app/vmui/packages/vmui/src/hooks/useFetchFlags.ts @@ -1,7 +1,6 @@ import { useAppDispatch, useAppState } from "../state/common/StateContext"; import { useEffect, useState } from "preact/compat"; import { ErrorTypes } from "../types"; -import { getUrlWithoutTenant } from "../utils/tenants"; const useFetchFlags = () => { const { serverUrl } = useAppState(); @@ -17,7 +16,7 @@ const useFetchFlags = () => { setIsLoading(true); try { - const url = getUrlWithoutTenant(serverUrl); + const url = new URL(serverUrl).origin; const response = await fetch(`${url}/flags`); const data = await response.text(); const flags = data.split("\n").filter(flag => flag.trim() !== "") diff --git a/app/vmui/packages/vmui/src/router/navigation.ts b/app/vmui/packages/vmui/src/router/navigation.ts index bf96205fe..54ab01398 100644 --- a/app/vmui/packages/vmui/src/router/navigation.ts +++ b/app/vmui/packages/vmui/src/router/navigation.ts @@ -1,4 +1,5 @@ import router, { routerOptions } from "./index"; +import { getTenantIdFromUrl } from "../utils/tenants"; export enum NavigationItemType { internalLink, @@ -24,10 +25,12 @@ interface NavigationConfig { * Special case for alert link */ const getAlertLink = (url: string, showAlertLink: boolean) => { - // see more https://docs.victoriametrics.com/cluster-victoriametrics/?highlight=vmalertproxyurl#vmalert + // see more https://docs.victoriametrics.com/cluster-victoriametrics/#vmalert + const isCluster = !!getTenantIdFromUrl(url); + const value = isCluster ? `${url}/vmalert` : url.replace(/\/prometheus$/, "/vmalert"); return { label: "Alerts", - value: `${url}/vmalert`, + value, type: NavigationItemType.externalLink, hide: !showAlertLink, }; diff --git a/docs/changelog/CHANGELOG.md b/docs/changelog/CHANGELOG.md index 3e1bcfded..4f1e4f095 100644 --- a/docs/changelog/CHANGELOG.md +++ b/docs/changelog/CHANGELOG.md @@ -28,6 +28,7 @@ See also [LTS releases](https://docs.victoriametrics.com/lts-releases/). * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert): properly set `group_name` and `file` fields for recording rules in `/api/v1/rules`. * BUGFIX: [Single-node VictoriaMetrics](https://docs.victoriametrics.com/) and `vmstorage` in [VictoriaMetrics cluster](https://docs.victoriametrics.com/cluster-victoriametrics/): prevent panic when ingesting samples which are outisde of configured [retention filters](https://docs.victoriametrics.com/#retention-filters). This could happen when backfilling data with retention filters which exclude samples from the backfill range. * BUGFIX: [vmctl](https://docs.victoriametrics.com/vmctl/): fix issue with series matching for `vmctl vm-native` with `--vm-native-disable-per-metric-migration` flag enabled. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/7309). +* BUGFIX: [vmui](https://docs.victoriametrics.com/#vmui): fix the display of the link to vmalert. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5924). ## [v1.105.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.105.0)