Fix timeout setting in milliseconds (#4881)

* feat: make NumberSetting support step

* fix: correct request timeout help message

* make default step 1 for NumberInput

* Provide similar experience for other inputs with ms

Co-authored-by: tangweikun <tangweikun@corp.netease.com>
Co-authored-by: gatzjames <jamesgatzos@gmail.com>
This commit is contained in:
tangweikun 2022-06-23 21:12:59 +08:00 committed by GitHub
parent 00a383690e
commit 1aca90a810
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -138,11 +138,12 @@ export const General: FC = () => {
/>
<NumberSetting
label="Autocomplete popup delay"
label="Autocomplete popup delay (ms)"
setting="autocompleteDelay"
help="Delay the autocomplete popup by milliseconds. Enter 0 to disable the autocomplete delay."
min={0}
max={3000}
step={100}
/>
</div>
@ -286,10 +287,11 @@ export const General: FC = () => {
min={-1}
/>
<NumberSetting
label="Request timeout"
label="Request timeout (ms)"
setting="timeout"
help="Enter the maximum seconds allotted before a request will timeout. Enter -1 to disable timeouts. "
min={-1}
help="Enter the maximum milliseconds allotted before a request will timeout. Enter 0 to disable timeouts. "
min={0}
step={100}
/>
</div>

View File

@ -13,6 +13,7 @@ interface Props {
max?: InputHTMLAttributes<HTMLInputElement>['max'];
min: InputHTMLAttributes<HTMLInputElement>['min'];
setting: SettingsOfType<number>;
step?: InputHTMLAttributes<HTMLInputElement>['step'];
}
export const NumberSetting: FC<Props> = ({
@ -21,6 +22,7 @@ export const NumberSetting: FC<Props> = ({
max,
min,
setting,
step = 1,
}) => {
const settings = useSelector(selectSettings);
@ -54,6 +56,7 @@ export const NumberSetting: FC<Props> = ({
name={setting}
onChange={handleOnChange}
type={'number'}
step={step}
/>
</label>
</div>