diff --git a/frontend/web/components/Feature.js b/frontend/web/components/Feature.js index 7d149631d6e7..bc15c9c502cf 100644 --- a/frontend/web/components/Feature.js +++ b/frontend/web/components/Feature.js @@ -7,10 +7,31 @@ import AddVariationButton from './mv/AddVariationButton' import ErrorMessage from './ErrorMessage' import Tooltip from './Tooltip' import Icon from './Icon' +import Select from 'react-select' +import InputGroup from './base/forms/InputGroup' +import WarningMessage from './WarningMessage' +function isNegativeNumberString(str) { + if (typeof Utils.getTypedValue(str) !== 'number') { + return false + } + if (typeof str !== 'string') { + return false + } + const num = parseFloat(str) + return !isNaN(num) && num < 0 +} export default class Feature extends PureComponent { static displayName = 'Feature' + constructor(props) { + super(props) + this.state = { + isNegativeNumberString: isNegativeNumberString( + props.environmentFlag?.feature_state_value, + ), + } + } removeVariation = (i) => { const idToRemove = this.props.multivariate_options[i].id @@ -102,13 +123,30 @@ export default class Feature extends PureComponent { } tooltip={`${Constants.strings.REMOTE_CONFIG_DESCRIPTION}${ !isEdit - ? '
Setting this when creating a feature will set the value for all environments. You can edit the this individually for each environment once the feature is created.' + ? '
Setting this when creating a feature will set the value for all environments. You can edit this individually for each environment once the feature is created.' : '' }`} title={`${valueString}`} /> )} + {this.state.isNegativeNumberString && ( + + This feature currently has the value of{' '} + "{environmentFlag?.feature_state_value}" as a + string. As of version 2.137.0, saving this + feature will convert its value from a string to a number. If you + wish to preserve this value as a string, please save it via our + + API + + . + + } + /> + )} {!!error && (