]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20500 Rules list validation
authorKevin Silva <kevin.silva@sonarsource.com>
Thu, 5 Oct 2023 08:36:19 +0000 (10:36 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 5 Oct 2023 20:02:48 +0000 (20:02 +0000)
server/sonar-web/design-system/src/theme/light.ts
server/sonar-web/src/main/js/apps/coding-rules/components/CodingRulesApp.tsx
server/sonar-web/src/main/js/apps/coding-rules/components/RuleDetailsMeta.tsx
server/sonar-web/src/main/js/apps/coding-rules/components/RuleListItem.tsx

index 115d90eaaaa68e5ca04134fbb4d5bab77ac4bc80..5a88e12959b6d229e8493dd9239f8f7c17ecaaf8 100644 (file)
@@ -814,6 +814,7 @@ export const lightTheme = {
     active: ['4px', 'solid', ...primary.light],
     xsActive: ['3px', 'solid', ...primary.light],
     focus: ['4px', 'solid', ...secondary.default, OPACITY_20_PERCENT],
+    heavy: ['2px', 'solid', ...COLORS.grey[50]],
   },
 
   avatar: {
index c787c6dddbbb91dcc76bbae80f4e1cd95d8ad86d..b7108e1fbe9065ed5cd85a5500081b07ec7fe579 100644 (file)
@@ -348,6 +348,10 @@ export class CodingRulesApp extends React.PureComponent<Props, State> {
     }
   };
 
+  handleSelectRule = (key: string) => {
+    this.routeSelectedRulePath(key);
+  };
+
   selectPreviousRule = () => {
     const { rules } = this.state;
     const selectedIndex = this.getSelectedIndex();
@@ -684,6 +688,7 @@ export class CodingRulesApp extends React.PureComponent<Props, State> {
                             onOpen={this.handleRuleOpen}
                             rule={rule}
                             selected={rule.key === selected}
+                            selectRule={this.handleSelectRule}
                             selectedProfile={this.getSelectedProfile()}
                           />
                         ))}
index fcfd7c355c7510e9ea471b3e1901e6f25978d48b..cedf9b1e5bd4e0ba057b5116c30883f28f377f5f 100644 (file)
@@ -248,7 +248,11 @@ export default class RuleDetailsMeta extends React.PureComponent<Props> {
     const displayedKey = ruleDetails.key.startsWith(EXTERNAL_PREFIX)
       ? ruleDetails.key.substring(EXTERNAL_PREFIX.length)
       : ruleDetails.key;
-    return <Note className="sw-overflow-hidden sw-text-ellipsis">{displayedKey}</Note>;
+    return (
+      <Note className="sw-overflow-hidden sw-text-ellipsis" title={displayedKey}>
+        {displayedKey}
+      </Note>
+    );
   }
 
   render() {
index c38cf54d036786949755f2ed4d7c1f8b55373365..f00c8d36352cbdc53138fe3cf639569ff09e85bc 100644 (file)
@@ -50,6 +50,7 @@ interface Props {
   onOpen: (ruleKey: string) => void;
   rule: Rule;
   selected: boolean;
+  selectRule: (key: string) => void;
   selectedProfile?: Profile;
 }
 
@@ -86,6 +87,7 @@ export default class RuleListItem extends React.PureComponent<Props> {
     }
 
     event.preventDefault();
+    event.stopPropagation();
     this.props.onOpen(this.props.rule.key);
   };
 
@@ -204,6 +206,7 @@ export default class RuleListItem extends React.PureComponent<Props> {
         className="it__coding-rule sw-p-3 sw-mb-4 sw-rounded-1 sw-bg-white"
         aria-current={selected}
         data-rule={rule.key}
+        onClick={() => this.props.selectRule(rule.key)}
       >
         <div className="sw-flex sw-flex-col">
           <div className="sw-mb-4">
@@ -263,8 +266,7 @@ export default class RuleListItem extends React.PureComponent<Props> {
 }
 
 const ListItemStyled = styled.li<{ selected: boolean }>`
-  border: ${(props) =>
-    props.selected ? themeBorder('default', 'primary') : themeBorder('default', 'almCardBorder')};
-
-  border-width: ${(props) => (props.selected ? '2px' : '1px')};
+  outline: ${(props) =>
+    props.selected ? themeBorder('heavy', 'primary') : themeBorder('default', 'almCardBorder')};
+  outline-offset: ${(props) => (props.selected ? '-2px' : '-1px')};
 `;