aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2017-05-02 15:36:24 +0200
committerStas Vilchik <vilchiks@gmail.com>2017-05-02 15:38:18 +0200
commit7b2958e443c4c629f3e35aba7182d7cb524b250b (patch)
tree6929337914d917d39fb7ead2747c16523a28a92a /server
parentf3ce395155ba116eb7bdc9e40efb12c499e028d9 (diff)
downloadsonarqube-7b2958e443c4c629f3e35aba7182d7cb524b250b.tar.gz
sonarqube-7b2958e443c4c629f3e35aba7182d7cb524b250b.zip
open file permalinks in new tab
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js18
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.js13
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/popups/line-actions-popup.js14
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-line-options-popup.hbs2
4 files changed, 11 insertions, 36 deletions
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js
index 085c889bbb5..28ba8f032d9 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js
@@ -413,18 +413,6 @@ export default class SourceViewerBase extends React.PureComponent {
});
};
- openNewWindow = () => {
- const { component } = this.state;
- if (component != null) {
- let query = 'id=' + encodeURIComponent(component.key);
- const windowParams = 'resizable=1,scrollbars=1,status=1';
- if (this.state.highlightedLine) {
- query = query + '&line=' + this.state.highlightedLine;
- }
- window.open(window.baseUrl + '/component/index?' + query, component.name, windowParams);
- }
- };
-
showMeasures = () => {
const measuresOverlay = new MeasuresOverlay({ component: this.state.component, large: true });
measuresOverlay.render();
@@ -606,11 +594,7 @@ export default class SourceViewerBase extends React.PureComponent {
return (
<div className={className} ref={node => (this.node = node)}>
- <SourceViewerHeader
- component={this.state.component}
- openNewWindow={this.openNewWindow}
- showMeasures={this.showMeasures}
- />
+ <SourceViewerHeader component={this.state.component} showMeasures={this.showMeasures} />
{this.state.notAccessible &&
<div className="alert alert-warning spacer-top">
{translate('code_viewer.no_source_code_displayed_due_to_security')}
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.js b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.js
index d44df72f472..2e9922b91b1 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.js
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerHeader.js
@@ -47,7 +47,6 @@ export default class SourceViewerHeader extends React.PureComponent {
subProjectName?: string,
uuid: string
},
- openNewWindow: () => void,
showMeasures: () => void
};
@@ -56,11 +55,6 @@ export default class SourceViewerHeader extends React.PureComponent {
this.props.showMeasures();
};
- openNewWindow = (e: SyntheticInputEvent) => {
- e.preventDefault();
- this.props.openNewWindow();
- };
-
openInWorkspace = (e: SyntheticInputEvent) => {
e.preventDefault();
const { key } = this.props.component;
@@ -129,9 +123,12 @@ export default class SourceViewerHeader extends React.PureComponent {
</a>
</li>
<li>
- <a className="js-new-window" href="#" onClick={this.openNewWindow}>
+ <Link
+ className="js-new-window"
+ target="_blank"
+ to={{ pathname: '/component', query: { id: this.props.component.key } }}>
{translate('component_viewer.new_window')}
- </a>
+ </Link>
</li>
{!workspace &&
<li>
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/popups/line-actions-popup.js b/server/sonar-web/src/main/js/components/SourceViewer/popups/line-actions-popup.js
index 31b02a53419..1f3cc3edeb2 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/popups/line-actions-popup.js
+++ b/server/sonar-web/src/main/js/components/SourceViewer/popups/line-actions-popup.js
@@ -23,16 +23,10 @@ import Template from './templates/source-viewer-line-options-popup.hbs';
export default Popup.extend({
template: Template,
- events: {
- 'click .js-get-permalink': 'getPermalink'
- },
-
- getPermalink(e) {
- e.preventDefault();
+ serializeData() {
const { component, line } = this.options;
- const url =
- window.baseUrl + `/component/index?id=${encodeURIComponent(component.key)}&line=${line}`;
- const windowParams = 'resizable=1,scrollbars=1,status=1';
- window.open(url, component.name, windowParams);
+ return {
+ permalink: window.baseUrl + `/component?id=${encodeURIComponent(component.key)}&line=${line}`
+ };
}
});
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-line-options-popup.hbs b/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-line-options-popup.hbs
index c6b9b418866..cefd31210bb 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-line-options-popup.hbs
+++ b/server/sonar-web/src/main/js/components/SourceViewer/popups/templates/source-viewer-line-options-popup.hbs
@@ -1,6 +1,6 @@
<div class="bubble-popup-container">
<div class="bubble-popup-section">
- <a href="#" class="js-get-permalink link-action">{{t 'component_viewer.get_permalink'}}</a>
+ <a href={{permalink}} target="_blank" class="js-get-permalink link-action">{{t 'component_viewer.get_permalink'}}</a>
</div>
</div>