]> source.dussan.org Git - sonarqube.git/commitdiff
fix displaying a source code of a file after search
authorStas Vilchik <vilchiks@gmail.com>
Wed, 30 Nov 2016 13:00:07 +0000 (14:00 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 30 Nov 2016 13:00:17 +0000 (14:00 +0100)
server/sonar-web/src/main/js/apps/overview/components/AppContainer.js
server/sonar-web/src/main/js/apps/source-viewer/app.js
server/sonar-web/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb

index 85d09db946d5892bd426c41e3d2e5a41c17fda0a..0e7bde7cdbd80f863e598a2dd6afbc4d9874b8ed 100644 (file)
@@ -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;
     }
index ef5443f25455c7a1c4c79a03181203cb86aa5cee..700def699b40e31a3b506bb4b2b0ea5c4e088d26 100644 (file)
@@ -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);
index 72416ed82eb84fbd1629caffa5d6a1522c968dce..6e88df08ff7c18cb266bf2e49f527ddd43f9a75a 100644 (file)
@@ -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 %>
-
-
-
-