mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-10 15:14:09 +00:00
vmui: fix layout and add server url by default (#1519)
* fix: change layout for correctly display big query * fix: set default server from url * fix: change get default server url
This commit is contained in:
parent
d5ca07bd71
commit
aca2cb245e
3 changed files with 12 additions and 3 deletions
|
@ -50,17 +50,18 @@ const HomeLayout: FC = () => {
|
|||
<UrlCopy url={fetchUrl}/>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
<Box display="flex" flexDirection="column" style={{height: "calc(100vh - 64px)"}}>
|
||||
<Box display="flex" flexDirection="column" style={{minHeight: "calc(100vh - 64px)"}}>
|
||||
<Box m={2}>
|
||||
<QueryConfigurator/>
|
||||
</Box>
|
||||
<Box flexShrink={1} style={{overflowY: "scroll"}}>
|
||||
<Box flexShrink={1}>
|
||||
{isLoading && <Fade in={isLoading} style={{
|
||||
transitionDelay: isLoading ? "300ms" : "0ms",
|
||||
}}>
|
||||
<Box alignItems="center" flexDirection="column" display="flex"
|
||||
style={{
|
||||
width: "100%",
|
||||
maxWidth: "calc(100vh - 32px)",
|
||||
position: "absolute",
|
||||
height: "150px",
|
||||
background: "linear-gradient(rgba(255,255,255,.7), rgba(255,255,255,.7), rgba(255,255,255,0))"
|
||||
|
|
|
@ -2,6 +2,7 @@ import {DisplayType} from "../../components/Home/Configurator/DisplayTypeSwitch"
|
|||
import {TimeParams, TimePeriod} from "../../types";
|
||||
import {dateFromSeconds, getDurationFromPeriod, getTimeperiodForDuration} from "../../utils/time";
|
||||
import {getFromStorage} from "../../utils/storage";
|
||||
import {getDefaultServer} from "../../utils/default-server-url";
|
||||
|
||||
export interface TimeState {
|
||||
duration: string;
|
||||
|
@ -31,8 +32,9 @@ export type Action =
|
|||
| { type: "TOGGLE_AUTOREFRESH"}
|
||||
| { type: "TOGGLE_AUTOCOMPLETE"}
|
||||
|
||||
|
||||
export const initialState: AppState = {
|
||||
serverUrl: getFromStorage("PREFERRED_URL") as string || "https://", // https://demo.promlabs.com or https://play.victoriametrics.com/select/accounting/1/6a716b0f-38bc-4856-90ce-448fd713e3fe/prometheus",
|
||||
serverUrl: getFromStorage("PREFERRED_URL") as string || getDefaultServer(), // https://demo.promlabs.com or https://play.victoriametrics.com/select/accounting/1/6a716b0f-38bc-4856-90ce-448fd713e3fe/prometheus",
|
||||
displayType: "chart",
|
||||
query: getFromStorage("LAST_QUERY") as string || "\n", // demo_memory_usage_bytes
|
||||
time: {
|
||||
|
|
6
app/vmui/packages/vmui/src/utils/default-server-url.ts
Normal file
6
app/vmui/packages/vmui/src/utils/default-server-url.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
export const getDefaultServer = (): string => {
|
||||
const {href} = window.location;
|
||||
const regexp = /^http.+\/vmui/;
|
||||
const [result] = href.match(regexp) || ["https://"];
|
||||
return result.replace("vmui", "prometheus");
|
||||
};
|
Loading…
Reference in a new issue