mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
vmui: fix the display of the link to vmalert (#7380)
### Describe Your Changes
Fix the issue mentioned in
https://github.com/VictoriaMetrics/VictoriaMetrics/pull/7088#issuecomment-2391360368
### Checklist
The following checks are **mandatory**:
- [ ] My change adheres [VictoriaMetrics contributing
guidelines](https://docs.victoriametrics.com/contributing/).
(cherry picked from commit bfb55d5f2f
)
This commit is contained in:
parent
dd6781b179
commit
a3c942d206
3 changed files with 7 additions and 4 deletions
|
@ -1,7 +1,6 @@
|
||||||
import { useAppDispatch, useAppState } from "../state/common/StateContext";
|
import { useAppDispatch, useAppState } from "../state/common/StateContext";
|
||||||
import { useEffect, useState } from "preact/compat";
|
import { useEffect, useState } from "preact/compat";
|
||||||
import { ErrorTypes } from "../types";
|
import { ErrorTypes } from "../types";
|
||||||
import { getUrlWithoutTenant } from "../utils/tenants";
|
|
||||||
|
|
||||||
const useFetchFlags = () => {
|
const useFetchFlags = () => {
|
||||||
const { serverUrl } = useAppState();
|
const { serverUrl } = useAppState();
|
||||||
|
@ -17,7 +16,7 @@ const useFetchFlags = () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const url = getUrlWithoutTenant(serverUrl);
|
const url = new URL(serverUrl).origin;
|
||||||
const response = await fetch(`${url}/flags`);
|
const response = await fetch(`${url}/flags`);
|
||||||
const data = await response.text();
|
const data = await response.text();
|
||||||
const flags = data.split("\n").filter(flag => flag.trim() !== "")
|
const flags = data.split("\n").filter(flag => flag.trim() !== "")
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import router, { routerOptions } from "./index";
|
import router, { routerOptions } from "./index";
|
||||||
|
import { getTenantIdFromUrl } from "../utils/tenants";
|
||||||
|
|
||||||
export enum NavigationItemType {
|
export enum NavigationItemType {
|
||||||
internalLink,
|
internalLink,
|
||||||
|
@ -24,10 +25,12 @@ interface NavigationConfig {
|
||||||
* Special case for alert link
|
* Special case for alert link
|
||||||
*/
|
*/
|
||||||
const getAlertLink = (url: string, showAlertLink: boolean) => {
|
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 {
|
return {
|
||||||
label: "Alerts",
|
label: "Alerts",
|
||||||
value: `${url}/vmalert`,
|
value,
|
||||||
type: NavigationItemType.externalLink,
|
type: NavigationItemType.externalLink,
|
||||||
hide: !showAlertLink,
|
hide: !showAlertLink,
|
||||||
};
|
};
|
||||||
|
|
|
@ -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: [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: [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: [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)
|
## [v1.105.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.105.0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue