mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-14 07:17:52 -08:00
Correctly encode/decode new resolution states in URL
Some checks failed
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Some checks failed
CI / Go tests (push) Has been cancelled
CI / More Go tests (push) Has been cancelled
CI / Go tests with previous Go version (push) Has been cancelled
CI / UI tests (push) Has been cancelled
CI / Go tests on Windows (push) Has been cancelled
CI / Mixins tests (push) Has been cancelled
CI / Build Prometheus for common architectures (0) (push) Has been cancelled
CI / Build Prometheus for common architectures (1) (push) Has been cancelled
CI / Build Prometheus for common architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (0) (push) Has been cancelled
CI / Build Prometheus for all architectures (1) (push) Has been cancelled
CI / Build Prometheus for all architectures (10) (push) Has been cancelled
CI / Build Prometheus for all architectures (11) (push) Has been cancelled
CI / Build Prometheus for all architectures (2) (push) Has been cancelled
CI / Build Prometheus for all architectures (3) (push) Has been cancelled
CI / Build Prometheus for all architectures (4) (push) Has been cancelled
CI / Build Prometheus for all architectures (5) (push) Has been cancelled
CI / Build Prometheus for all architectures (6) (push) Has been cancelled
CI / Build Prometheus for all architectures (7) (push) Has been cancelled
CI / Build Prometheus for all architectures (8) (push) Has been cancelled
CI / Build Prometheus for all architectures (9) (push) Has been cancelled
CI / Check generated parser (push) Has been cancelled
CI / golangci-lint (push) Has been cancelled
CI / fuzzing (push) Has been cancelled
CI / codeql (push) Has been cancelled
CI / Report status of build Prometheus for all architectures (push) Has been cancelled
CI / Publish main branch artifacts (push) Has been cancelled
CI / Publish release artefacts (push) Has been cancelled
CI / Publish UI on npm Registry (push) Has been cancelled
Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
parent
2c972dba26
commit
4efd47741e
|
@ -55,17 +55,51 @@ export const decodePanelOptionsFromURLParams = (query: string): Panel[] => {
|
||||||
decodeSetting("end_input", (value) => {
|
decodeSetting("end_input", (value) => {
|
||||||
panel.visualizer.endTime = parseTime(value);
|
panel.visualizer.endTime = parseTime(value);
|
||||||
});
|
});
|
||||||
decodeSetting("moment_input", (value) => {
|
// Legacy "step_input" parameter, overriden below by
|
||||||
panel.visualizer.endTime = parseTime(value);
|
// "res_type" / "res_density" / "res_step" if present.
|
||||||
});
|
|
||||||
decodeSetting("step_input", (value) => {
|
decodeSetting("step_input", (value) => {
|
||||||
if (parseInt(value) > 0) {
|
if (parseInt(value) > 0) {
|
||||||
panel.visualizer.resolution = {
|
panel.visualizer.resolution = {
|
||||||
type: "custom",
|
type: "custom",
|
||||||
value: parseInt(value) * 1000,
|
step: parseInt(value) * 1000,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
decodeSetting("res_type", (value) => {
|
||||||
|
switch (value) {
|
||||||
|
case "auto":
|
||||||
|
decodeSetting("res_density", (density) => {
|
||||||
|
if (["low", "medium", "high"].includes(density)) {
|
||||||
|
panel.visualizer.resolution = {
|
||||||
|
type: "auto",
|
||||||
|
density: density as "low" | "medium" | "high",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "fixed":
|
||||||
|
decodeSetting("res_step", (step) => {
|
||||||
|
panel.visualizer.resolution = {
|
||||||
|
type: "fixed",
|
||||||
|
step: parseFloat(step) * 1000,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "custom":
|
||||||
|
decodeSetting("res_step", (step) => {
|
||||||
|
panel.visualizer.resolution = {
|
||||||
|
type: "custom",
|
||||||
|
step: parseFloat(step) * 1000,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log("Unknown resolution type", value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
decodeSetting("moment_input", (value) => {
|
||||||
|
panel.visualizer.endTime = parseTime(value);
|
||||||
|
});
|
||||||
|
|
||||||
panels.push(panel);
|
panels.push(panel);
|
||||||
}
|
}
|
||||||
|
@ -93,14 +127,30 @@ export const encodePanelOptionsToURLParams = (
|
||||||
addParam(idx, "moment_input", formatTime(p.visualizer.endTime));
|
addParam(idx, "moment_input", formatTime(p.visualizer.endTime));
|
||||||
}
|
}
|
||||||
addParam(idx, "range_input", formatPrometheusDuration(p.visualizer.range));
|
addParam(idx, "range_input", formatPrometheusDuration(p.visualizer.range));
|
||||||
// TODO: Support the other new resolution types.
|
|
||||||
if (p.visualizer.resolution.type === "custom") {
|
switch (p.visualizer.resolution.type) {
|
||||||
|
case "auto":
|
||||||
|
addParam(idx, "res_type", "auto");
|
||||||
|
addParam(idx, "res_density", p.visualizer.resolution.density);
|
||||||
|
break;
|
||||||
|
case "fixed":
|
||||||
|
addParam(idx, "res_type", "fixed");
|
||||||
addParam(
|
addParam(
|
||||||
idx,
|
idx,
|
||||||
"step_input",
|
"res_step",
|
||||||
(p.visualizer.resolution.value / 1000).toString()
|
(p.visualizer.resolution.step / 1000).toString()
|
||||||
);
|
);
|
||||||
|
break;
|
||||||
|
case "custom":
|
||||||
|
addParam(idx, "res_type", "custom");
|
||||||
|
addParam(
|
||||||
|
idx,
|
||||||
|
"res_step",
|
||||||
|
(p.visualizer.resolution.step / 1000).toString()
|
||||||
|
);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
addParam(idx, "display_mode", p.visualizer.displayMode);
|
addParam(idx, "display_mode", p.visualizer.displayMode);
|
||||||
addParam(idx, "show_exemplars", p.visualizer.showExemplars ? "1" : "0");
|
addParam(idx, "show_exemplars", p.visualizer.showExemplars ? "1" : "0");
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue