]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17838 Portfolio creation: invalid characters in the key should prevent form...
authorDavid Cho-Lerat <117642976+david-cho-lerat-sonarsource@users.noreply.github.com>
Wed, 11 Jan 2023 12:51:36 +0000 (13:51 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 11 Jan 2023 20:02:58 +0000 (20:02 +0000)
server/sonar-web/src/main/js/components/controls/Modal.css
server/sonar-web/src/main/js/components/controls/ValidationInput.tsx
server/sonar-web/src/main/js/components/controls/__tests__/__snapshots__/ValidationInput-test.tsx.snap

index e42b029ac0a8fb5fb0ebc2c4c63bcfdb37506601..5d322e040898cb499ff440130db4c5d56cfdc665 100644 (file)
   margin-top: 2px;
 }
 
+.modal-field input[type='text'].invalid {
+  border-color: var(--red);
+}
+
 .modal-foot {
   padding: var(--pagePadding) calc(4 * var(--gridSize));
   border-top: 1px solid var(--barBorderColor);
index 507470f88ce9a1c59f53080d6639026c5bf1414c..a853ef3fbeffb9d58b97b7d1fc99bb918e24e687 100644 (file)
@@ -36,6 +36,7 @@ export interface ValidationInputProps {
   isValid: boolean;
   label?: React.ReactNode;
   required?: boolean;
+  showValidIcon?: boolean;
 }
 
 export enum ValidationInputErrorPlacement {
@@ -56,15 +57,18 @@ export default function ValidationInput(props: ValidationInputProps) {
     isValid,
     label,
     required,
+    showValidIcon = true,
   } = props;
+
   const hasError = isInvalid && error !== undefined;
 
   let childrenWithStatus: React.ReactNode;
+
   if (errorPlacement === ValidationInputErrorPlacement.Right) {
     childrenWithStatus = (
       <>
         {children}
-        {isValid && (
+        {showValidIcon && isValid && (
           <AlertSuccessIcon
             ariaLabel={translate('valid_input')}
             className="spacer-left text-middle"
@@ -78,13 +82,13 @@ export default function ValidationInput(props: ValidationInputProps) {
     childrenWithStatus = (
       <>
         {children}
-        {isValid && (
+        {showValidIcon && isValid && (
           <AlertSuccessIcon
             ariaLabel={translate('valid_input')}
             className="spacer-left text-middle"
           />
         )}
-        <div className="spacer-top">
+        <div className="spacer-top" style={{ display: 'flex' }}>
           {isInvalid && <AlertErrorIcon className="text-middle" />}
           {hasError && <span className="little-spacer-left text-danger text-middle">{error}</span>}
         </div>
index b6494ce70b2f9e7100588f987296648ff9d96bac..2233f79b19fabc2f4105560c7c84ca8232b1c2cc 100644 (file)
@@ -51,6 +51,11 @@ exports[`should render correctly: error under the input 1`] = `
     <div />
     <div
       className="spacer-top"
+      style={
+        {
+          "display": "flex",
+        }
+      }
     >
       <AlertErrorIcon
         className="text-middle"