aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2018-07-20 09:32:27 +0200
committerSonarTech <sonartech@sonarsource.com>2018-07-25 20:21:21 +0200
commitc76da4346704fdc8a2ce5ecedb1e0461186ba222 (patch)
treecdd18b35419178d63d42af43f113cff5eee0255b /server
parente391ded6cd9f35429d6f385fbaef3b7471dda3ab (diff)
downloadsonarqube-c76da4346704fdc8a2ce5ecedb1e0461186ba222.tar.gz
sonarqube-c76da4346704fdc8a2ce5ecedb1e0461186ba222.zip
SONAR-11058 open documentation and suggestions in a new tab (#535)
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx4
-rw-r--r--server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx2
-rw-r--r--server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx6
-rw-r--r--server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap6
4 files changed, 13 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx b/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx
index 5cb06388326..5d9cacc42e1 100644
--- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx
+++ b/server/sonar-web/src/main/js/app/components/embed-docs-modal/EmbedDocsPopup.tsx
@@ -58,7 +58,7 @@ export default class EmbedDocsPopup extends React.PureComponent<Props> {
{this.renderTitle(translate('embed_docs.suggestion'))}
{this.props.suggestions.map((suggestion, index) => (
<li key={index}>
- <Link onClick={this.props.onClose} to={suggestion.link}>
+ <Link onClick={this.props.onClose} target="_blank" to={suggestion.link}>
{suggestion.text}
</Link>
</li>
@@ -160,7 +160,7 @@ export default class EmbedDocsPopup extends React.PureComponent<Props> {
<ul className="menu abs-width-240">
{this.renderSuggestions()}
<li>
- <Link onClick={this.props.onClose} to="/documentation">
+ <Link onClick={this.props.onClose} target="_blank" to="/documentation">
{translate('embed_docs.documentation')}
</Link>
</li>
diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx b/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx
index 909c6a5d1d4..21cf0bd5bed 100644
--- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx
+++ b/server/sonar-web/src/main/js/app/components/embed-docs-modal/SuggestionsProvider.tsx
@@ -20,7 +20,7 @@
import * as React from 'react';
import * as PropTypes from 'prop-types';
// eslint-disable-next-line import/no-extraneous-dependencies
-import * as suggestionsJson from 'Docs/EmbedDocsSuggestions.json';
+import suggestionsJson from 'Docs/EmbedDocsSuggestions.json';
import { SuggestionsContext } from './SuggestionsContext';
import { isSonarCloud } from '../../../helpers/system';
diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx b/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx
index 2092c80a14d..c7ca9442a89 100644
--- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/SuggestionsProvider-test.tsx
@@ -25,8 +25,10 @@ import { isSonarCloud } from '../../../../helpers/system';
jest.mock(
'Docs/EmbedDocsSuggestions.json',
() => ({
- pageA: [{ link: '/foo', text: 'Foo' }, { link: '/bar', text: 'Bar', scope: 'sonarcloud' }],
- pageB: [{ link: '/qux', text: 'Qux' }]
+ default: {
+ pageA: [{ link: '/foo', text: 'Foo' }, { link: '/bar', text: 'Bar', scope: 'sonarcloud' }],
+ pageB: [{ link: '/qux', text: 'Qux' }]
+ }
}),
{ virtual: true }
);
diff --git a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap b/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap
index c324ca11c23..abb6a2f122c 100644
--- a/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap
+++ b/server/sonar-web/src/main/js/app/components/embed-docs-modal/__tests__/__snapshots__/EmbedDocsPopup-test.tsx.snap
@@ -18,6 +18,7 @@ exports[`should display correct links for SonarCloud 1`] = `
onClick={[MockFunction]}
onlyActiveOnIndex={false}
style={Object {}}
+ target="_blank"
to="#"
>
foo
@@ -30,6 +31,7 @@ exports[`should display correct links for SonarCloud 1`] = `
onClick={[MockFunction]}
onlyActiveOnIndex={false}
style={Object {}}
+ target="_blank"
to="#"
>
bar
@@ -44,6 +46,7 @@ exports[`should display correct links for SonarCloud 1`] = `
onClick={[MockFunction]}
onlyActiveOnIndex={false}
style={Object {}}
+ target="_blank"
to="/documentation"
>
embed_docs.documentation
@@ -140,6 +143,7 @@ exports[`should display suggestion links 1`] = `
onClick={[MockFunction]}
onlyActiveOnIndex={false}
style={Object {}}
+ target="_blank"
to="#"
>
foo
@@ -152,6 +156,7 @@ exports[`should display suggestion links 1`] = `
onClick={[MockFunction]}
onlyActiveOnIndex={false}
style={Object {}}
+ target="_blank"
to="#"
>
bar
@@ -166,6 +171,7 @@ exports[`should display suggestion links 1`] = `
onClick={[MockFunction]}
onlyActiveOnIndex={false}
style={Object {}}
+ target="_blank"
to="/documentation"
>
embed_docs.documentation