aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-11-30 14:00:07 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-11-30 14:00:17 +0100
commit4ce3f48d8beb06e4a4862d16d3a6b8d0d0ebf5c0 (patch)
tree61558db1c8ae6deffae297a5251f016ec58c0632
parent3c646719ac84403fab2ed7060db25dedcf29eb33 (diff)
downloadsonarqube-4ce3f48d8beb06e4a4862d16d3a6b8d0d0ebf5c0.tar.gz
sonarqube-4ce3f48d8beb06e4a4862d16d3a6b8d0d0ebf5c0.zip
fix displaying a source code of a file after search
-rw-r--r--server/sonar-web/src/main/js/apps/overview/components/AppContainer.js5
-rw-r--r--server/sonar-web/src/main/js/apps/source-viewer/app.js2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb9
3 files changed, 6 insertions, 10 deletions
diff --git a/server/sonar-web/src/main/js/apps/overview/components/AppContainer.js b/server/sonar-web/src/main/js/apps/overview/components/AppContainer.js
index 85d09db946d..0e7bde7cdbd 100644
--- a/server/sonar-web/src/main/js/apps/overview/components/AppContainer.js
+++ b/server/sonar-web/src/main/js/apps/overview/components/AppContainer.js
@@ -30,6 +30,11 @@ export default class AppContainer extends React.Component {
}
render () {
+ // workaround for the case when a file is displayed
+ if (window.sonarqube.file) {
+ return null;
+ }
+
if (!this.state.component) {
return null;
}
diff --git a/server/sonar-web/src/main/js/apps/source-viewer/app.js b/server/sonar-web/src/main/js/apps/source-viewer/app.js
index ef5443f2545..700def699b4 100644
--- a/server/sonar-web/src/main/js/apps/source-viewer/app.js
+++ b/server/sonar-web/src/main/js/apps/source-viewer/app.js
@@ -24,7 +24,7 @@ const App = new Marionette.Application();
const init = function ({ el }) {
const options = window.sonarqube;
- this.addRegions({ mainRegion: el });
+ this.addRegions({ mainRegion: window.sonarqube.el || el });
const viewer = new SourceViewer();
this.mainRegion.show(viewer);
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
index 72416ed82eb..6e88df08ff7 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
@@ -1,13 +1,8 @@
-<div class="page">
- <div id="source-viewer"></div>
-</div>
-
<% content_for :extra_script do %>
<script>
(function () {
jQuery('.navbar-context').remove();
jQuery('.page-wrapper-context').addClass('page-wrapper-global').removeClass('page-wrapper-context');
- window.sonarqube.el = '#source-viewer';
window.sonarqube.file = {
uuid: '<%= @resource.uuid -%>',
key: '<%= @resource.key -%>'
@@ -16,7 +11,3 @@
</script>
<script src="<%= ApplicationController.root_context -%>/js/bundles/source-viewer.js?v=<%= sonar_version -%>"></script>
<% end %>
-
-
-
-