1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-11-24 20:06:55 +01:00

feat: improve safeguard threshold field (#11004)

This commit is contained in:
Mateusz Kwasniewski 2025-11-19 17:13:03 +01:00 committed by GitHub
parent 415978d965
commit 4890b16b49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 15 deletions

View File

@ -75,8 +75,7 @@ export const MilestoneProgressionTimeInput = ({
return (
<StyledInputGroup>
<StyledTextField
type='text'
inputMode='numeric'
type='number'
value={timeValue}
onChange={onTimeValueChange}
onPaste={handleNumericPaste}

View File

@ -244,7 +244,6 @@ export const SafeguardForm = ({
<StyledLabel>filtered by</StyledLabel>
<FormControl variant='outlined' size='small'>
<StyledSelect
sx={{ minWidth: 200 }}
value={appName}
onChange={(e) =>
handleApplicationChange(String(e.target.value))
@ -287,12 +286,15 @@ export const SafeguardForm = ({
<FormControl variant='outlined' size='small'>
<TextField
sx={{ minWidth: 120 }}
type='number'
inputProps={{
step: 0.1,
}}
value={threshold}
onChange={(e) =>
handleThresholdChange(Number(e.target.value))
}
onChange={(e) => {
const value = e.target.value;
handleThresholdChange(Number(value));
}}
placeholder='Value'
variant='outlined'
size='small'

View File

@ -1,5 +1,5 @@
import { useState, useCallback } from 'react';
import { isPast, addMinutes } from 'date-fns';
import { useCallback, useState } from 'react';
import { addMinutes, isPast } from 'date-fns';
import type { MilestoneStatus } from '../ReleasePlanMilestone/ReleasePlanMilestoneStatus.tsx';
import { formatDateYMDHM } from 'utils/formatDate.ts';
@ -112,10 +112,7 @@ export const useMilestoneProgressionForm = (
event: React.ChangeEvent<HTMLInputElement>,
) => {
const inputValue = event.target.value;
if (inputValue === '' || /^\d+$/.test(inputValue)) {
const value = inputValue === '' ? 0 : Number.parseInt(inputValue);
setTimeValue(value);
}
setTimeValue(Number(inputValue));
};
const clearErrors = useCallback(() => {

View File

@ -15,7 +15,7 @@ export const ModeSelector: FC<ModeSelectorProps> = ({
}) => {
if (metricType === 'unknown') return null;
return (
<FormControl variant='outlined' size='small' sx={{ minWidth: 200 }}>
<FormControl variant='outlined' size='small'>
<InputLabel id='mode-select-label'>Mode</InputLabel>
<Select
labelId='mode-select-label'

View File

@ -9,7 +9,7 @@ export type RangeSelectorProps = {
};
export const RangeSelector: FC<RangeSelectorProps> = ({ value, onChange }) => (
<FormControl variant='outlined' size='small' sx={{ minWidth: 200 }}>
<FormControl variant='outlined' size='small'>
<InputLabel id='range-select-label'>Time</InputLabel>
<Select
labelId='range-select-label'