]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15033 Adding compilation info box
authorMathieu Suen <mathieu.suen@sonarsource.com>
Wed, 16 Jun 2021 09:01:13 +0000 (11:01 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 22 Jun 2021 20:03:13 +0000 (20:03 +0000)
server/sonar-web/src/main/js/components/tutorials/components/CompilationInfo.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/components/__tests__/CompilationInfo-test.tsx [new file with mode: 0644]
server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/CompilationInfo-test.tsx.snap [new file with mode: 0644]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

diff --git a/server/sonar-web/src/main/js/components/tutorials/components/CompilationInfo.tsx b/server/sonar-web/src/main/js/components/tutorials/components/CompilationInfo.tsx
new file mode 100644 (file)
index 0000000..f86872e
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+import * as React from 'react';
+import { FormattedMessage } from 'react-intl';
+import { Alert } from 'sonar-ui-common/components/ui/Alert';
+import { translate } from 'sonar-ui-common/helpers/l10n';
+
+export interface CompilationInfoProps {
+  className?: string;
+}
+
+export function CompilationInfo({ className = 'spacer-top spacer-bottom' }: CompilationInfoProps) {
+  return (
+    <Alert className={className} variant="info">
+      <p className="spacer-bottom">
+        <FormattedMessage
+          id="onboarding.tutorial.cfamilly.compilation_database_info"
+          defaultMessage={translate('onboarding.tutorial.cfamilly.compilation_database_info')}
+          values={{
+            link: (
+              <a
+                href="/documentation/analysis/languages/cfamily/"
+                rel="noopener noreferrer"
+                target="_blank">
+                {translate('onboarding.tutorial.cfamilly.compilation_database_info.link')}
+              </a>
+            )
+          }}
+        />
+      </p>
+      <p>
+        <FormattedMessage
+          id="onboarding.tutorial.cfamilly.speed_caching"
+          defaultMessage={translate('onboarding.tutorial.cfamilly.speed_caching')}
+          values={{
+            link: (
+              <a
+                href="/documentation/analysis/languages/cfamily/#analysis-cache"
+                rel="noopener noreferrer"
+                target="_blank">
+                {translate('onboarding.tutorial.cfamilly.speed_caching.link')}
+              </a>
+            )
+          }}
+        />
+      </p>
+    </Alert>
+  );
+}
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/CompilationInfo-test.tsx b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/CompilationInfo-test.tsx
new file mode 100644 (file)
index 0000000..c54f530
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2021 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+import { shallow } from 'enzyme';
+import * as React from 'react';
+import { CompilationInfo } from '../CompilationInfo';
+
+it('should render correctly', () => {
+  expect(shallowRender()).toMatchSnapshot();
+});
+
+function shallowRender() {
+  return shallow(<CompilationInfo />);
+}
diff --git a/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/CompilationInfo-test.tsx.snap b/server/sonar-web/src/main/js/components/tutorials/components/__tests__/__snapshots__/CompilationInfo-test.tsx.snap
new file mode 100644 (file)
index 0000000..93595e2
--- /dev/null
@@ -0,0 +1,45 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render correctly 1`] = `
+<Alert
+  className="spacer-top spacer-bottom"
+  variant="info"
+>
+  <p
+    className="spacer-bottom"
+  >
+    <FormattedMessage
+      defaultMessage="onboarding.tutorial.cfamilly.compilation_database_info"
+      id="onboarding.tutorial.cfamilly.compilation_database_info"
+      values={
+        Object {
+          "link": <a
+            href="/documentation/analysis/languages/cfamily/"
+            rel="noopener noreferrer"
+            target="_blank"
+          >
+            onboarding.tutorial.cfamilly.compilation_database_info.link
+          </a>,
+        }
+      }
+    />
+  </p>
+  <p>
+    <FormattedMessage
+      defaultMessage="onboarding.tutorial.cfamilly.speed_caching"
+      id="onboarding.tutorial.cfamilly.speed_caching"
+      values={
+        Object {
+          "link": <a
+            href="/documentation/analysis/languages/cfamily/#analysis-cache"
+            rel="noopener noreferrer"
+            target="_blank"
+          >
+            onboarding.tutorial.cfamilly.speed_caching.link
+          </a>,
+        }
+      }
+    />
+  </p>
+</Alert>
+`;
index da5e28c576d2803e94532deedc46e00bde55da7f..563db53dad6664ad4052a555ef11004a9f5e3075 100644 (file)
@@ -3466,6 +3466,10 @@ onboarding.tutorial.ci_outro.commit.why.no_branches=Each new push you make on yo
 onboarding.tutorial.ci_outro.refresh=This page will then refresh with your analysis results.
 onboarding.tutorial.ci_outro.refresh.why=If the page doesn't refresh after a while, please double-check the analysis configuration.
 onboarding.tutorial.other.project_key.sentence=Create a {file} file in your repository and paste the following code:
+onboarding.tutorial.cfamilly.compilation_database_info=If you have trouble using the build wrapper, you can try using a {link}
+onboarding.tutorial.cfamilly.compilation_database_info.link=compilation database
+onboarding.tutorial.cfamilly.speed_caching=You can also speed up your analysis by enabling {link}.
+onboarding.tutorial.cfamilly.speed_caching.link=multi-threading and caching
 
 onboarding.tutorial.choose_method=How do you want to analyze your repository?
 onboarding.tutorial.choose_method.manual=Locally