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:
parent
415978d965
commit
4890b16b49
@ -75,8 +75,7 @@ export const MilestoneProgressionTimeInput = ({
|
|||||||
return (
|
return (
|
||||||
<StyledInputGroup>
|
<StyledInputGroup>
|
||||||
<StyledTextField
|
<StyledTextField
|
||||||
type='text'
|
type='number'
|
||||||
inputMode='numeric'
|
|
||||||
value={timeValue}
|
value={timeValue}
|
||||||
onChange={onTimeValueChange}
|
onChange={onTimeValueChange}
|
||||||
onPaste={handleNumericPaste}
|
onPaste={handleNumericPaste}
|
||||||
|
|||||||
@ -244,7 +244,6 @@ export const SafeguardForm = ({
|
|||||||
<StyledLabel>filtered by</StyledLabel>
|
<StyledLabel>filtered by</StyledLabel>
|
||||||
<FormControl variant='outlined' size='small'>
|
<FormControl variant='outlined' size='small'>
|
||||||
<StyledSelect
|
<StyledSelect
|
||||||
sx={{ minWidth: 200 }}
|
|
||||||
value={appName}
|
value={appName}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
handleApplicationChange(String(e.target.value))
|
handleApplicationChange(String(e.target.value))
|
||||||
@ -287,12 +286,15 @@ export const SafeguardForm = ({
|
|||||||
|
|
||||||
<FormControl variant='outlined' size='small'>
|
<FormControl variant='outlined' size='small'>
|
||||||
<TextField
|
<TextField
|
||||||
sx={{ minWidth: 120 }}
|
|
||||||
type='number'
|
type='number'
|
||||||
|
inputProps={{
|
||||||
|
step: 0.1,
|
||||||
|
}}
|
||||||
value={threshold}
|
value={threshold}
|
||||||
onChange={(e) =>
|
onChange={(e) => {
|
||||||
handleThresholdChange(Number(e.target.value))
|
const value = e.target.value;
|
||||||
}
|
handleThresholdChange(Number(value));
|
||||||
|
}}
|
||||||
placeholder='Value'
|
placeholder='Value'
|
||||||
variant='outlined'
|
variant='outlined'
|
||||||
size='small'
|
size='small'
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useState, useCallback } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { isPast, addMinutes } from 'date-fns';
|
import { addMinutes, isPast } from 'date-fns';
|
||||||
import type { MilestoneStatus } from '../ReleasePlanMilestone/ReleasePlanMilestoneStatus.tsx';
|
import type { MilestoneStatus } from '../ReleasePlanMilestone/ReleasePlanMilestoneStatus.tsx';
|
||||||
import { formatDateYMDHM } from 'utils/formatDate.ts';
|
import { formatDateYMDHM } from 'utils/formatDate.ts';
|
||||||
|
|
||||||
@ -112,10 +112,7 @@ export const useMilestoneProgressionForm = (
|
|||||||
event: React.ChangeEvent<HTMLInputElement>,
|
event: React.ChangeEvent<HTMLInputElement>,
|
||||||
) => {
|
) => {
|
||||||
const inputValue = event.target.value;
|
const inputValue = event.target.value;
|
||||||
if (inputValue === '' || /^\d+$/.test(inputValue)) {
|
setTimeValue(Number(inputValue));
|
||||||
const value = inputValue === '' ? 0 : Number.parseInt(inputValue);
|
|
||||||
setTimeValue(value);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const clearErrors = useCallback(() => {
|
const clearErrors = useCallback(() => {
|
||||||
|
|||||||
@ -15,7 +15,7 @@ export const ModeSelector: FC<ModeSelectorProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
if (metricType === 'unknown') return null;
|
if (metricType === 'unknown') return null;
|
||||||
return (
|
return (
|
||||||
<FormControl variant='outlined' size='small' sx={{ minWidth: 200 }}>
|
<FormControl variant='outlined' size='small'>
|
||||||
<InputLabel id='mode-select-label'>Mode</InputLabel>
|
<InputLabel id='mode-select-label'>Mode</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
labelId='mode-select-label'
|
labelId='mode-select-label'
|
||||||
|
|||||||
@ -9,7 +9,7 @@ export type RangeSelectorProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const RangeSelector: FC<RangeSelectorProps> = ({ value, onChange }) => (
|
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>
|
<InputLabel id='range-select-label'>Time</InputLabel>
|
||||||
<Select
|
<Select
|
||||||
labelId='range-select-label'
|
labelId='range-select-label'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user