]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11092 Add a banner on Security Reports (#582)
authorPascal Mugnier <pascal.mugnier@sonarsource.com>
Thu, 2 Aug 2018 10:19:45 +0000 (12:19 +0200)
committerSonarTech <sonartech@sonarsource.com>
Thu, 2 Aug 2018 18:21:33 +0000 (20:21 +0200)
server/sonar-web/src/main/js/app/styles/components/alerts.css
server/sonar-web/src/main/js/apps/securityReports/components/App.tsx
server/sonar-web/src/main/js/apps/securityReports/components/__tests__/__snapshots__/App-test.tsx.snap
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 0695abad28ff9282683a5e522e78ea10df95798b..ce827c16d036ff02dab4fb0b854d6da287d5cf04 100644 (file)
   padding: 10px 16px;
 }
 
+.page-header .alert {
+  clear: left;
+  float: left;
+}
+
 .page-notifs .alert {
   padding: 8px 10px;
 }
index 653f0ae26ffe35a9ecc123769e72761fcc42c171..fa966581a944119e9541cd49394c209f4c073447 100755 (executable)
@@ -21,6 +21,7 @@ import * as React from 'react';
 import * as PropTypes from 'prop-types';
 import Helmet from 'react-helmet';
 import { Link } from 'react-router';
+import { FormattedMessage } from 'react-intl';
 import VulnerabilityList from './VulnerabilityList';
 import Suggestions from '../../../app/components/embed-docs-modal/Suggestions';
 import { translate } from '../../../helpers/l10n';
@@ -29,10 +30,12 @@ import DeferredSpinner from '../../../components/common/DeferredSpinner';
 import Checkbox from '../../../components/controls/Checkbox';
 import { RawQuery } from '../../../helpers/query';
 import NotFound from '../../../app/components/NotFound';
-import '../style.css';
 import { getSecurityHotspots } from '../../../api/security-reports';
 import { isLongLivingBranch } from '../../../helpers/branches';
 import DocTooltip from '../../../components/docs/DocTooltip';
+import { getRulesUrl } from '../../../helpers/urls';
+import '../style.css';
+import { isSonarCloud } from '../../../helpers/system';
 
 interface Props {
   branchLike?: BranchLike;
@@ -143,6 +146,23 @@ export default class App extends React.PureComponent<Props, State> {
               {translate('learn_more')}
             </Link>
           </div>
+          <div className="alert alert-info spacer-top">
+            <FormattedMessage
+              defaultMessage={translate('security_reports.info')}
+              id="security_reports.info"
+              values={{
+                link: (
+                  <Link
+                    to={getRulesUrl(
+                      { types: 'SECURITY_HOTSPOT,VULNERABILITY' },
+                      isSonarCloud() ? component.organization : undefined
+                    )}>
+                    {translate('security_reports.info.link')}
+                  </Link>
+                )
+              }}
+            />
+          </div>
         </header>
         <div className="display-inline-flex-center">
           <Checkbox
index 7a82485d1b778655892c14f1db1d375f4b653044..b787a7c99a82d5780ab79734497bc36cbbca09c8 100644 (file)
@@ -39,6 +39,32 @@ exports[`handle checkbox for cwe display 1`] = `
         learn_more
       </Link>
     </div>
+    <div
+      className="alert alert-info spacer-top"
+    >
+      <FormattedMessage
+        defaultMessage="security_reports.info"
+        id="security_reports.info"
+        values={
+          Object {
+            "link": <Link
+              onlyActiveOnIndex={false}
+              style={Object {}}
+              to={
+                Object {
+                  "pathname": "/coding_rules",
+                  "query": Object {
+                    "types": "SECURITY_HOTSPOT,VULNERABILITY",
+                  },
+                }
+              }
+            >
+              security_reports.info.link
+            </Link>,
+          }
+        }
+      />
+    </div>
   </header>
   <div
     className="display-inline-flex-center"
@@ -122,6 +148,32 @@ exports[`handle checkbox for cwe display 2`] = `
         learn_more
       </Link>
     </div>
+    <div
+      className="alert alert-info spacer-top"
+    >
+      <FormattedMessage
+        defaultMessage="security_reports.info"
+        id="security_reports.info"
+        values={
+          Object {
+            "link": <Link
+              onlyActiveOnIndex={false}
+              style={Object {}}
+              to={
+                Object {
+                  "pathname": "/coding_rules",
+                  "query": Object {
+                    "types": "SECURITY_HOTSPOT,VULNERABILITY",
+                  },
+                }
+              }
+            >
+              security_reports.info.link
+            </Link>,
+          }
+        }
+      />
+    </div>
   </header>
   <div
     className="display-inline-flex-center"
@@ -248,6 +300,32 @@ exports[`renders owaspTop10 1`] = `
         learn_more
       </Link>
     </div>
+    <div
+      className="alert alert-info spacer-top"
+    >
+      <FormattedMessage
+        defaultMessage="security_reports.info"
+        id="security_reports.info"
+        values={
+          Object {
+            "link": <Link
+              onlyActiveOnIndex={false}
+              style={Object {}}
+              to={
+                Object {
+                  "pathname": "/coding_rules",
+                  "query": Object {
+                    "types": "SECURITY_HOTSPOT,VULNERABILITY",
+                  },
+                }
+              }
+            >
+              security_reports.info.link
+            </Link>,
+          }
+        }
+      />
+    </div>
   </header>
   <div
     className="display-inline-flex-center"
@@ -331,6 +409,32 @@ exports[`renders sansTop25 1`] = `
         learn_more
       </Link>
     </div>
+    <div
+      className="alert alert-info spacer-top"
+    >
+      <FormattedMessage
+        defaultMessage="security_reports.info"
+        id="security_reports.info"
+        values={
+          Object {
+            "link": <Link
+              onlyActiveOnIndex={false}
+              style={Object {}}
+              to={
+                Object {
+                  "pathname": "/coding_rules",
+                  "query": Object {
+                    "types": "SECURITY_HOTSPOT,VULNERABILITY",
+                  },
+                }
+              }
+            >
+              security_reports.info.link
+            </Link>,
+          }
+        }
+      />
+    </div>
   </header>
   <div
     className="display-inline-flex-center"
@@ -414,6 +518,32 @@ exports[`renders with cwe 1`] = `
         learn_more
       </Link>
     </div>
+    <div
+      className="alert alert-info spacer-top"
+    >
+      <FormattedMessage
+        defaultMessage="security_reports.info"
+        id="security_reports.info"
+        values={
+          Object {
+            "link": <Link
+              onlyActiveOnIndex={false}
+              style={Object {}}
+              to={
+                Object {
+                  "pathname": "/coding_rules",
+                  "query": Object {
+                    "types": "SECURITY_HOTSPOT,VULNERABILITY",
+                  },
+                }
+              }
+            >
+              security_reports.info.link
+            </Link>,
+          }
+        }
+      />
+    </div>
   </header>
   <div
     className="display-inline-flex-center"
index e5d4e15fc1a88e2627a4b67af64ebcd99cf0cf3d..593f82c48b3244786c7d62316753bb3909ca2a28 100644 (file)
@@ -2024,6 +2024,8 @@ organizations_permissions.provisioning.desc=Ability to initialize a project so i
 # SECURITY REPORTS PAGE
 #
 #------------------------------------------------------------------------------
+security_reports.info=Issues counts and ratings below consider only {link} enabled in Quality Profiles.
+security_reports.info.link=security rules
 security_reports.owaspTop10.page=OWASP Top 10
 security_reports.sansTop25.page=SANS Top 25
 security_reports.owaspTop10.description=Track Vulnerabilities and Security Hotspots conforming to OWASP Top 10 standard.