mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Rename "value" to "step" in resolution state
Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
parent
f195046b4d
commit
d3b6b0f288
|
@ -27,7 +27,7 @@ const ResolutionInput: FC<ResolutionInputProps> = ({
|
|||
const onChangeCustomResolutionInput = (resText: string): void => {
|
||||
const newResolution = parsePrometheusDuration(resText);
|
||||
|
||||
if (resolution.type === "custom" && newResolution === resolution.value) {
|
||||
if (resolution.type === "custom" && newResolution === resolution.step) {
|
||||
// Nothing changed.
|
||||
return;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ const ResolutionInput: FC<ResolutionInputProps> = ({
|
|||
formatPrometheusDuration(getEffectiveResolution(resolution, range))
|
||||
);
|
||||
} else {
|
||||
onChangeResolution({ type: "custom", value: newResolution });
|
||||
onChangeResolution({ type: "custom", step: newResolution });
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -77,7 +77,7 @@ const ResolutionInput: FC<ResolutionInputProps> = ({
|
|||
resolution.type === "auto"
|
||||
? resolution.density
|
||||
: resolution.type === "fixed"
|
||||
? resolution.value.toString()
|
||||
? resolution.step.toString()
|
||||
: "custom"
|
||||
}
|
||||
onChange={(_value, option) => {
|
||||
|
@ -97,7 +97,7 @@ const ResolutionInput: FC<ResolutionInputProps> = ({
|
|||
);
|
||||
onChangeResolution({
|
||||
type: "custom",
|
||||
value: effectiveResolution,
|
||||
step: effectiveResolution,
|
||||
});
|
||||
setCustomResolutionInput(
|
||||
formatPrometheusDuration(effectiveResolution)
|
||||
|
@ -109,7 +109,7 @@ const ResolutionInput: FC<ResolutionInputProps> = ({
|
|||
if (!isNaN(value)) {
|
||||
onChangeResolution({
|
||||
type: "fixed",
|
||||
value,
|
||||
step: value,
|
||||
});
|
||||
} else {
|
||||
throw new Error("Invalid resolution value");
|
||||
|
|
|
@ -15,11 +15,11 @@ export type GraphResolution =
|
|||
}
|
||||
| {
|
||||
type: "fixed";
|
||||
value: number; // Resolution step in milliseconds.
|
||||
step: number; // Resolution step in milliseconds.
|
||||
}
|
||||
| {
|
||||
type: "custom";
|
||||
value: number; // Resolution step in milliseconds.
|
||||
step: number; // Resolution step in milliseconds.
|
||||
};
|
||||
|
||||
// From the UI settings, compute the effective resolution
|
||||
|
@ -39,9 +39,9 @@ export const getEffectiveResolution = (
|
|||
return Math.max(Math.floor(range / factor / 1000) * 1000, 1000);
|
||||
}
|
||||
case "fixed":
|
||||
return resolution.value;
|
||||
return resolution.step;
|
||||
case "custom":
|
||||
return resolution.value;
|
||||
return resolution.step;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue