mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 12:31:07 +01:00
feat: store display type in URL
This commit is contained in:
parent
e3534dca20
commit
ccc242c69a
@ -12,8 +12,12 @@ export type DisplayType = "table" | "chart" | "code";
|
|||||||
|
|
||||||
const StylizedToggleButton = withStyles({
|
const StylizedToggleButton = withStyles({
|
||||||
root: {
|
root: {
|
||||||
padding: 6,
|
display: "grid",
|
||||||
|
gridTemplateColumns: "18px auto",
|
||||||
|
gridGap: 6,
|
||||||
|
padding: "8px 12px",
|
||||||
color: "white",
|
color: "white",
|
||||||
|
lineHeight: "19px",
|
||||||
"&.Mui-selected": {
|
"&.Mui-selected": {
|
||||||
color: "white"
|
color: "white"
|
||||||
}
|
}
|
||||||
@ -34,13 +38,13 @@ export const DisplayTypeSwitch: FC = () => {
|
|||||||
dispatch({type: "SET_DISPLAY_TYPE", payload: val ?? displayType})
|
dispatch({type: "SET_DISPLAY_TYPE", payload: val ?? displayType})
|
||||||
}>
|
}>
|
||||||
<StylizedToggleButton value="chart" aria-label="display as chart">
|
<StylizedToggleButton value="chart" aria-label="display as chart">
|
||||||
<ShowChartIcon/> Query Range as Chart
|
<ShowChartIcon/><span>Query Range as Chart</span>
|
||||||
</StylizedToggleButton>
|
</StylizedToggleButton>
|
||||||
<StylizedToggleButton value="code" aria-label="display as code">
|
<StylizedToggleButton value="code" aria-label="display as code">
|
||||||
<CodeIcon/> Instant Query as JSON
|
<CodeIcon/><span>Instant Query as JSON</span>
|
||||||
</StylizedToggleButton>
|
</StylizedToggleButton>
|
||||||
<StylizedToggleButton value="table" aria-label="display as table">
|
<StylizedToggleButton value="table" aria-label="display as table">
|
||||||
<TableChartIcon/> Instant Query as Table
|
<TableChartIcon/><span>Instant Query as Table</span>
|
||||||
</StylizedToggleButton>
|
</StylizedToggleButton>
|
||||||
</ToggleButtonGroup>;
|
</ToggleButtonGroup>;
|
||||||
};
|
};
|
@ -50,7 +50,7 @@ const query = getQueryStringValue("g0.expr", getFromStorage("LAST_QUERY") as str
|
|||||||
|
|
||||||
export const initialState: AppState = {
|
export const initialState: AppState = {
|
||||||
serverUrl: getDefaultServer(),
|
serverUrl: getDefaultServer(),
|
||||||
displayType: "chart",
|
displayType: getQueryStringValue("tab", "chart") as DisplayType,
|
||||||
query: query, // demo_memory_usage_bytes
|
query: query, // demo_memory_usage_bytes
|
||||||
queryHistory: { index: 0, values: [query] },
|
queryHistory: { index: 0, values: [query] },
|
||||||
time: {
|
time: {
|
||||||
|
@ -6,7 +6,7 @@ const stateToUrlParams = {
|
|||||||
"time.duration": "g0.range_input",
|
"time.duration": "g0.range_input",
|
||||||
"time.period.date": "g0.end_input",
|
"time.period.date": "g0.end_input",
|
||||||
"time.period.step": "g0.step_input",
|
"time.period.step": "g0.step_input",
|
||||||
"stacked": "g0.stacked",
|
"displayType": "tab"
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO need function for detect types.
|
// TODO need function for detect types.
|
||||||
|
Loading…
Reference in New Issue
Block a user