]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12232 Add security review to portfolio projects list
authorJeremy Davis <jeremy.davis@sonarsource.com>
Tue, 25 Jun 2019 08:10:32 +0000 (10:10 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 28 Jun 2019 06:45:49 +0000 (08:45 +0200)
server/sonar-web/src/main/js/apps/code/code.css
server/sonar-web/src/main/js/apps/code/components/Component.tsx
server/sonar-web/src/main/js/apps/code/components/ComponentMeasure.tsx
server/sonar-web/src/main/js/apps/code/components/ComponentsHeader.tsx
server/sonar-web/src/main/js/apps/code/components/__tests__/__snapshots__/ComponentsHeader-test.tsx.snap
server/sonar-web/src/main/js/apps/code/utils.ts

index 709cea43cf6b28c9a5852e57d8a6d3786c66c269..bb08188fd70d4f3d6996f1966054d0067942b772 100644 (file)
   box-sizing: border-box;
 }
 
+.code-components-rating-cell {
+  width: 110px;
+}
+
 .code-name-cell {
   max-width: 0;
 }
 
 .code-components-header {
   position: sticky;
-  top: 95px;
+  top: 105px;
   background-color: rgba(255, 255, 255, 0.9);
+  z-index: 1;
+}
+
+table > thead > tr.code-components-header > th {
+  vertical-align: middle;
 }
index 52b01fc1436d4910d2bdde90d7a05862b5222c32..e57e3ab4de2652dae7fa8f70559e62997b0781c5 100644 (file)
@@ -82,8 +82,17 @@ export class Component extends React.PureComponent<Props> {
         </td>
 
         {metrics.map(metric => (
-          <td className="thin nowrap text-right" key={metric.key}>
-            <div className="code-components-cell">
+          <td
+            className={classNames('thin', {
+              'text-center': metric.type === 'RATING',
+              'nowrap text-right': metric.type !== 'RATING'
+            })}
+            key={metric.key}>
+            <div
+              className={classNames({
+                'code-components-rating-cell': metric.type === 'RATING',
+                'code-components-cell': metric.type !== 'RATING'
+              })}>
               <ComponentMeasure component={component} metric={metric} />
             </div>
           </td>
index 8269685b0d3cad4e3c6ddb892c7a3f7f7b65d513..51a0d681420c0dd19af5825148efa2c7a08d62ef 100644 (file)
@@ -41,7 +41,7 @@ export default class ComponentMeasure extends React.PureComponent<Props> {
       component.measures.find(measure => measure.metric === finalMetricKey);
 
     if (!measure) {
-      return <span />;
+      return measure === false ? <span /> : <span>—</span>;
     }
 
     const value = isDiffMetric(metric.key) ? getLeakValue(measure) : measure.value;
index ca8123fa5b8e2fdfd3b88f1c7297a3d06d7a0dc1..1d075872fa0471bd9e909cc492b169741ec8b6ab 100644 (file)
@@ -47,7 +47,8 @@ export default function ComponentsHeader({
     columns = [
       translate('metric_domain.Releasability'),
       translate('metric_domain.Reliability'),
-      translate('metric_domain.Security'),
+      translate('portfolio.metric_domain.vulnerabilities'),
+      translate('portfolio.metric_domain.security_hotspots'),
       translate('metric_domain.Maintainability'),
       translate('metric', 'ncloc', 'name')
     ];
@@ -65,8 +66,11 @@ export default function ComponentsHeader({
         {baseComponent &&
           columns.map((column, index) => (
             <th
-              className={classNames('thin', 'nowrap', 'text-right', {
-                'code-components-cell': index > 0
+              className={classNames('thin', {
+                'code-components-cell': !isPortfolio && index > 0,
+                nowrap: !isPortfolio,
+                'text-center': isPortfolio && index < columns.length - 1,
+                'text-right': !isPortfolio || index === columns.length - 1
               })}
               key={column}>
               {column}
index 69c4c1f0371c6c2c3e51549ccd4b46e3d5fdf8ea..07adc9a12e69436bc468175af2cb06bf043459c8 100644 (file)
@@ -26,31 +26,37 @@ exports[`renders correctly for portfolios 1`] = `
     />
     <th />
     <th
-      className="thin nowrap text-right"
+      className="thin text-center"
       key="metric_domain.Releasability"
     >
       metric_domain.Releasability
     </th>
     <th
-      className="thin nowrap text-right code-components-cell"
+      className="thin text-center"
       key="metric_domain.Reliability"
     >
       metric_domain.Reliability
     </th>
     <th
-      className="thin nowrap text-right code-components-cell"
-      key="metric_domain.Security"
+      className="thin text-center"
+      key="portfolio.metric_domain.vulnerabilities"
+    >
+      portfolio.metric_domain.vulnerabilities
+    </th>
+    <th
+      className="thin text-center"
+      key="portfolio.metric_domain.security_hotspots"
     >
-      metric_domain.Security
+      portfolio.metric_domain.security_hotspots
     </th>
     <th
-      className="thin nowrap text-right code-components-cell"
+      className="thin text-center"
       key="metric_domain.Maintainability"
     >
       metric_domain.Maintainability
     </th>
     <th
-      className="thin nowrap text-right code-components-cell"
+      className="thin text-right"
       key="metric.ncloc.name"
     >
       metric.ncloc.name
@@ -77,7 +83,7 @@ exports[`renders correctly for projects 1`] = `
       metric.foo.name
     </th>
     <th
-      className="thin nowrap text-right code-components-cell"
+      className="thin code-components-cell nowrap text-right"
       key="metric.bar.name"
     >
       metric.bar.name
index 863bb094892f74b9418bc78aedbb227a55e1d55b..63adf57bde7e809210c18c86094a96919bcb2a17 100644 (file)
@@ -44,6 +44,7 @@ const PORTFOLIO_METRICS = [
   'releasability_rating',
   'reliability_rating',
   'security_rating',
+  'security_review_rating',
   'sqale_rating',
   'ncloc'
 ];