diff options
author | Jeremy Davis <jeremy.davis@sonarsource.com> | 2024-10-08 15:37:00 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-10-08 20:02:47 +0000 |
commit | f49678493a80f08984b13f8003fca362fe081c9f (patch) | |
tree | b051e1d1fb3133b2f892118eecd17aade027ef36 /server | |
parent | c9ecf7fa2f9af18f474a2aea2c7c3cefd3a6e80f (diff) | |
download | sonarqube-f49678493a80f08984b13f8003fca362fe081c9f.tar.gz sonarqube-f49678493a80f08984b13f8003fca362fe081c9f.zip |
SONAR-23137 Remove success status around legacy input
Diffstat (limited to 'server')
14 files changed, 6 insertions, 37 deletions
diff --git a/server/sonar-web/design-system/src/components/input/InputField.tsx b/server/sonar-web/design-system/src/components/input/InputField.tsx index ecd47e6d768..2b6adb2bbff 100644 --- a/server/sonar-web/design-system/src/components/input/InputField.tsx +++ b/server/sonar-web/design-system/src/components/input/InputField.tsx @@ -29,14 +29,12 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, ' as?: React.ElementType; className?: string; isInvalid?: boolean; - isValid?: boolean; size?: InputSizeKeys; } interface InputTextAreaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> { className?: string; isInvalid?: boolean; - isValid?: boolean; size?: InputSizeKeys; } @@ -70,18 +68,10 @@ const dangerStyle = (props: ThemedProps) => css` --focusOutline: ${themeBorder('focus', 'inputDangerFocus')(props)}; `; -const successStyle = (props: ThemedProps) => css` - --border: ${themeBorder('default', 'inputSuccess')(props)}; - --focusBorder: ${themeBorder('default', 'inputSuccessFocus')(props)}; - --focusOutline: ${themeBorder('focus', 'inputSuccessFocus')(props)}; -`; - const getInputVariant = (props: ThemedProps & { isInvalid?: boolean; isValid?: boolean }) => { - const { isValid, isInvalid } = props; + const { isInvalid } = props; if (isInvalid) { return dangerStyle; - } else if (isValid) { - return successStyle; } return defaultStyle; }; diff --git a/server/sonar-web/design-system/src/components/input/__tests__/InputField-test.tsx b/server/sonar-web/design-system/src/components/input/__tests__/InputField-test.tsx index ccac9ace735..1682fca211a 100644 --- a/server/sonar-web/design-system/src/components/input/__tests__/InputField-test.tsx +++ b/server/sonar-web/design-system/src/components/input/__tests__/InputField-test.tsx @@ -22,11 +22,10 @@ import { InputField } from '../InputField'; describe('Input Field', () => { it.each([ - ['default', false, false, 'defaultStyle'], - ['invalid', true, false, 'dangerStyle'], - ['valid', false, true, 'successStyle'], - ])('should handle status %s', (_, isInvalid, isValid, expectedStyle) => { - render(<InputField isInvalid={isInvalid} isValid={isValid} />); + ['default', false, 'defaultStyle'], + ['invalid', true, 'dangerStyle'], + ])('should handle status %s', (_, isInvalid, expectedStyle) => { + render(<InputField isInvalid={isInvalid} />); // Emotion classes contain pseudo-random parts, we're interesting in the fixed part // so we can't just check a specific class diff --git a/server/sonar-web/src/main/js/apps/create/project/components/ProjectValidation.tsx b/server/sonar-web/src/main/js/apps/create/project/components/ProjectValidation.tsx index 481711667b9..6505f36e235 100644 --- a/server/sonar-web/src/main/js/apps/create/project/components/ProjectValidation.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/components/ProjectValidation.tsx @@ -248,7 +248,6 @@ export default function ProjectValidation<I>(props: Readonly<Props<I>>) { value={name} autoFocus isInvalid={projectNameIsInvalid} - isValid={projectNameIsValid} required /> {projectNameIsInvalid && <FlagErrorIcon className="sw-ml-2" />} @@ -278,7 +277,6 @@ export default function ProjectValidation<I>(props: Readonly<Props<I>>) { type="text" value={key} isInvalid={projectKeyIsInvalid} - isValid={projectKeyIsValid} required /> {projectKeyIsInvalid && <FlagErrorIcon className="sw-ml-2" />} diff --git a/server/sonar-web/src/main/js/apps/create/project/manual/ManualProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/manual/ManualProjectCreate.tsx index bc7a765f741..a174902cec5 100644 --- a/server/sonar-web/src/main/js/apps/create/project/manual/ManualProjectCreate.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/manual/ManualProjectCreate.tsx @@ -185,7 +185,6 @@ export default function ManualProjectCreate(props: Readonly<Props>) { type="text" value={mainBranchName} isInvalid={mainBranchNameIsInvalid} - isValid={mainBranchNameIsValid} required /> {mainBranchNameIsInvalid && <FlagErrorIcon className="sw-ml-2" />} diff --git a/server/sonar-web/src/main/js/apps/projectKey/UpdateForm.tsx b/server/sonar-web/src/main/js/apps/projectKey/UpdateForm.tsx index 7d20cbb1b82..5c439b81d83 100644 --- a/server/sonar-web/src/main/js/apps/projectKey/UpdateForm.tsx +++ b/server/sonar-web/src/main/js/apps/projectKey/UpdateForm.tsx @@ -85,7 +85,6 @@ export default function UpdateForm(props: UpdateFormProps) { name="update_key.new_key" required isInvalid={hasChanged && error !== undefined} - isValid={hasChanged && error === undefined} autoFocus onChange={onInputChange} value={newKey} diff --git a/server/sonar-web/src/main/js/apps/projectNewCode/components/BranchNewCodeDefinitionSettingModal.tsx b/server/sonar-web/src/main/js/apps/projectNewCode/components/BranchNewCodeDefinitionSettingModal.tsx index 31360afa2ad..301ede63c7f 100644 --- a/server/sonar-web/src/main/js/apps/projectNewCode/components/BranchNewCodeDefinitionSettingModal.tsx +++ b/server/sonar-web/src/main/js/apps/projectNewCode/components/BranchNewCodeDefinitionSettingModal.tsx @@ -185,7 +185,6 @@ export default class BranchNewCodeDefinitionSettingModal extends React.PureCompo /> <NewCodeDefinitionDaysOption days={days} - isChanged={isChanged} isValid={isValid} onChangeDays={this.handleSelectDays} onSelect={this.handleSelectSetting} diff --git a/server/sonar-web/src/main/js/apps/projectNewCode/components/ProjectNewCodeDefinitionSelector.tsx b/server/sonar-web/src/main/js/apps/projectNewCode/components/ProjectNewCodeDefinitionSelector.tsx index 23d3d156c94..6e6d6252f41 100644 --- a/server/sonar-web/src/main/js/apps/projectNewCode/components/ProjectNewCodeDefinitionSelector.tsx +++ b/server/sonar-web/src/main/js/apps/projectNewCode/components/ProjectNewCodeDefinitionSelector.tsx @@ -139,7 +139,6 @@ export default function ProjectNewCodeDefinitionSelector( } days={days} disabled={!overrideGlobalNewCodeDefinition} - isChanged={isChanged} isValid={isValid} onChangeDays={props.onSelectDays} onSelect={props.onSelectSetting} diff --git a/server/sonar-web/src/main/js/apps/settings/components/NewCodeDefinition.tsx b/server/sonar-web/src/main/js/apps/settings/components/NewCodeDefinition.tsx index 6810c2a1263..ddd07fb4086 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/NewCodeDefinition.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/NewCodeDefinition.tsx @@ -138,7 +138,6 @@ export default function NewCodeDefinition() { previousNonCompliantValue={newCodeDefinition?.previousNonCompliantValue} projectKey={newCodeDefinition?.projectKey} updatedAt={newCodeDefinition?.updatedAt} - isChanged={isFormTouched} isValid={isValid} onChangeDays={setNumberOfDays} onSelect={setSelectedNewCodeDefinitionType} diff --git a/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx b/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx index 6f8dbc6d68a..2e8c807a6cb 100644 --- a/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx +++ b/server/sonar-web/src/main/js/apps/users/components/UserForm.tsx @@ -185,7 +185,6 @@ export default function UserForm(props: Props) { !doesLoginHaveValidCharacter || !doesLoginStartWithLetterOrNumber } - isValid={!isLoginAlreadyUsed && login.length >= MINIMUM_LOGIN_LENGTH} maxLength={MAXIMUM_LOGIN_LENGTH} minLength={MINIMUM_LOGIN_LENGTH} size="full" @@ -242,7 +241,6 @@ export default function UserForm(props: Props) { > <div className="sw-flex sw-items-center"> <InputField - isValid={isCreateUserForm ? nameIsValid : undefined} isInvalid={nameIsInvalid} autoFocus={!!user} autoComplete="off" diff --git a/server/sonar-web/src/main/js/components/common/EmailInput.tsx b/server/sonar-web/src/main/js/components/common/EmailInput.tsx index 54b4c96782d..ef63d66d8d0 100644 --- a/server/sonar-web/src/main/js/components/common/EmailInput.tsx +++ b/server/sonar-web/src/main/js/components/common/EmailInput.tsx @@ -51,7 +51,6 @@ export default function EmailIput(props: Readonly<Props>) { <InputField id={id} isInvalid={isEmailValid === false} - isValid={isEmailValid === true} size="full" onChange={({ currentTarget }) => { const isValid = isMandotory diff --git a/server/sonar-web/src/main/js/components/common/UserPasswordInput.tsx b/server/sonar-web/src/main/js/components/common/UserPasswordInput.tsx index 98ccd7077cb..e4ecbe830b7 100644 --- a/server/sonar-web/src/main/js/components/common/UserPasswordInput.tsx +++ b/server/sonar-web/src/main/js/components/common/UserPasswordInput.tsx @@ -57,7 +57,6 @@ export default function UserPasswordInput(props: Readonly<Props>) { <div className="sw-flex sw-items-center"> <InputField isInvalid={isInvalid} - isValid={isValid} onFocus={() => setIsFocused(true)} id="create-password" size={size} @@ -93,7 +92,6 @@ export default function UserPasswordInput(props: Readonly<Props>) { <div className="sw-flex sw-items-center"> <InputField isInvalid={passwordDontMatch} - isValid={passwordMatch} onFocus={() => setIsFocused(true)} id="confirm-password" size={size} diff --git a/server/sonar-web/src/main/js/components/controls/InputValidationField.tsx b/server/sonar-web/src/main/js/components/controls/InputValidationField.tsx index de41934095f..9b9bd6ca412 100644 --- a/server/sonar-web/src/main/js/components/controls/InputValidationField.tsx +++ b/server/sonar-web/src/main/js/components/controls/InputValidationField.tsx @@ -45,9 +45,7 @@ export default function InputValidationField({ ...props }: Readonly<Props>) { const modalValidationProps = { description, dirty, error, label, touched, required }; return ( <ModalValidationField id={props.id} {...modalValidationProps}> - {({ isInvalid, isValid }) => ( - <InputField size="full" isInvalid={isInvalid} isValid={isValid} {...inputProps} /> - )} + {({ isInvalid }) => <InputField size="full" isInvalid={isInvalid} {...inputProps} />} </ModalValidationField> ); } diff --git a/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionDaysOption.tsx b/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionDaysOption.tsx index f49479708df..4a4629cc763 100644 --- a/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionDaysOption.tsx +++ b/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionDaysOption.tsx @@ -46,7 +46,6 @@ export interface Props { currentDaysValue?: string; days: string; disabled?: boolean; - isChanged: boolean; isValid: boolean; onChangeDays: (value: string) => void; onSelect: (selection: NewCodeDefinitionType) => void; @@ -66,7 +65,6 @@ export default function NewCodeDefinitionDaysOption(props: Props) { projectKey, updatedAt, disabled, - isChanged, isValid, onChangeDays, onSelect, @@ -133,7 +131,6 @@ export default function NewCodeDefinitionDaysOption(props: Props) { <InputField id="baseline_number_of_days" isInvalid={!isValid} - isValid={isChanged && isValid} max={NUMBER_OF_DAYS_MAX_VALUE} min={NUMBER_OF_DAYS_MIN_VALUE} onChange={(e) => onChangeDays(e.currentTarget.value)} diff --git a/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionSelector.tsx b/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionSelector.tsx index 535803665c5..bf09cda52eb 100644 --- a/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionSelector.tsx +++ b/server/sonar-web/src/main/js/components/new-code-definition/NewCodeDefinitionSelector.tsx @@ -54,7 +54,6 @@ export default function NewCodeDefinitionSelector(props: Props) { const [globalNcd, setGlobalNcd] = React.useState<NewCodeDefinition | null>(null); const [selectedNcdType, setSelectedNcdType] = React.useState<NewCodeDefinitionType | null>(null); const [days, setDays] = React.useState<string>(''); - const [isChanged, setIsChanged] = React.useState<boolean>(false); React.useEffect(() => { const numberOfDays = getNumberOfDaysDefaultValue(globalNcd); @@ -75,7 +74,6 @@ export default function NewCodeDefinitionSelector(props: Props) { (newNcdType: NewCodeDefinitionType) => { if (newNcdType && newNcdType !== selectedNcdType) { setSelectedNcdType(newNcdType); - setIsChanged(true); } }, [selectedNcdType], @@ -157,7 +155,6 @@ export default function NewCodeDefinitionSelector(props: Props) { disabled={Boolean( !selectedNcdType || selectedNcdType === NewCodeDefinitionType.Inherited, )} - isChanged={isChanged} isValid={isCompliant} onChangeDays={setDays} onSelect={handleNcdChanged} |