Skip to content

Commit

Permalink
storage: Put the minimum of a slider at the far left
Browse files Browse the repository at this point in the history
Instead of always putting zero at the far left.

The previous code was written for a older version of the slider that
could be restricted, and would not allow the user to slide below the
minimum. Patternfly sliders can not be restricted in this way and will
allow the user to slide the knob into every position. Thus, we need to
make the far left the minimum to avoid confusion.
  • Loading branch information
mvollmer committed Oct 23, 2023
1 parent 54a27a6 commit bb02ebf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/storaged/dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,7 @@ class SizeSliderElement extends React.Component {
const { unit } = this.state;

const change_slider = (_event, f) => {
onChange(Math.max(min, size_slider_round(f * max / 100, round)));
onChange(Math.max(min, size_slider_round(f, round)));
};

const change_text = (value) => {
Expand Down Expand Up @@ -972,7 +972,7 @@ class SizeSliderElement extends React.Component {
return (
<Grid hasGutter className="size-slider">
<GridItem span={12} sm={8}>
<Slider showBoundaries={false} value={(slider_val / max) * 100} onChange={change_slider} />
<Slider showBoundaries={false} min={min} max={max} value={slider_val} onChange={change_slider} />
</GridItem>
<GridItem span={6} sm={2}>
<TextInputPF4 className="size-text" value={text_val} onChange={(_event, value) => change_text(value)} />
Expand Down

0 comments on commit bb02ebf

Please sign in to comment.