mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 06:04: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 onChangeCustomResolutionInput = (resText: string): void => {
|
||||||
const newResolution = parsePrometheusDuration(resText);
|
const newResolution = parsePrometheusDuration(resText);
|
||||||
|
|
||||||
if (resolution.type === "custom" && newResolution === resolution.value) {
|
if (resolution.type === "custom" && newResolution === resolution.step) {
|
||||||
// Nothing changed.
|
// Nothing changed.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ const ResolutionInput: FC<ResolutionInputProps> = ({
|
||||||
formatPrometheusDuration(getEffectiveResolution(resolution, range))
|
formatPrometheusDuration(getEffectiveResolution(resolution, range))
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
onChangeResolution({ type: "custom", value: newResolution });
|
onChangeResolution({ type: "custom", step: newResolution });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ const ResolutionInput: FC<ResolutionInputProps> = ({
|
||||||
resolution.type === "auto"
|
resolution.type === "auto"
|
||||||
? resolution.density
|
? resolution.density
|
||||||
: resolution.type === "fixed"
|
: resolution.type === "fixed"
|
||||||
? resolution.value.toString()
|
? resolution.step.toString()
|
||||||
: "custom"
|
: "custom"
|
||||||
}
|
}
|
||||||
onChange={(_value, option) => {
|
onChange={(_value, option) => {
|
||||||
|
@ -97,7 +97,7 @@ const ResolutionInput: FC<ResolutionInputProps> = ({
|
||||||
);
|
);
|
||||||
onChangeResolution({
|
onChangeResolution({
|
||||||
type: "custom",
|
type: "custom",
|
||||||
value: effectiveResolution,
|
step: effectiveResolution,
|
||||||
});
|
});
|
||||||
setCustomResolutionInput(
|
setCustomResolutionInput(
|
||||||
formatPrometheusDuration(effectiveResolution)
|
formatPrometheusDuration(effectiveResolution)
|
||||||
|
@ -109,7 +109,7 @@ const ResolutionInput: FC<ResolutionInputProps> = ({
|
||||||
if (!isNaN(value)) {
|
if (!isNaN(value)) {
|
||||||
onChangeResolution({
|
onChangeResolution({
|
||||||
type: "fixed",
|
type: "fixed",
|
||||||
value,
|
step: value,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Invalid resolution value");
|
throw new Error("Invalid resolution value");
|
||||||
|
|
|
@ -15,11 +15,11 @@ export type GraphResolution =
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: "fixed";
|
type: "fixed";
|
||||||
value: number; // Resolution step in milliseconds.
|
step: number; // Resolution step in milliseconds.
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
type: "custom";
|
type: "custom";
|
||||||
value: number; // Resolution step in milliseconds.
|
step: number; // Resolution step in milliseconds.
|
||||||
};
|
};
|
||||||
|
|
||||||
// From the UI settings, compute the effective resolution
|
// 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);
|
return Math.max(Math.floor(range / factor / 1000) * 1000, 1000);
|
||||||
}
|
}
|
||||||
case "fixed":
|
case "fixed":
|
||||||
return resolution.value;
|
return resolution.step;
|
||||||
case "custom":
|
case "custom":
|
||||||
return resolution.value;
|
return resolution.step;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue