mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-11 15:34:56 +00:00
vmui/vmanomaly: fix default server url (#6178)
This PR for ui vmanomaly eliminates URL parameters to automatically use the default server URL, simplifying URLs like: From http://localhost:3000/#/?g0.expr=vm_blocks... to http://localhost:3000 From http://localhost:3000/select/0/vmui/#/?g0.expr=vm_blocks... to http://localhost:3000/select/0/vmui/ etc.
This commit is contained in:
parent
de98688489
commit
29bd120126
1 changed files with 2 additions and 2 deletions
|
@ -8,7 +8,7 @@ export const getDefaultServer = (tenantId?: string): string => {
|
|||
const { serverURL } = getAppModeParams();
|
||||
const storageURL = getFromStorage("SERVER_URL") as string;
|
||||
const logsURL = window.location.href.replace(/\/(select\/)?(vmui)\/.*/, "");
|
||||
const anomalyURL = window.location.href.replace(/(?:graph|vmui)\/.*/, "");
|
||||
const anomalyURL = `${window.location.origin}${window.location.pathname}`;
|
||||
const defaultURL = window.location.href.replace(/\/(?:prometheus\/)?(?:graph|vmui)\/.*/, "/prometheus");
|
||||
const url = serverURL || storageURL || defaultURL;
|
||||
|
||||
|
@ -16,7 +16,7 @@ export const getDefaultServer = (tenantId?: string): string => {
|
|||
case AppType.logs:
|
||||
return logsURL;
|
||||
case AppType.anomaly:
|
||||
return serverURL || storageURL || anomalyURL;
|
||||
return storageURL || anomalyURL;
|
||||
default:
|
||||
return tenantId ? replaceTenantId(url, tenantId) : url;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue