]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5209 File dashboard integration
authorStas Vilchik <vilchiks@gmail.com>
Tue, 17 Jun 2014 12:33:19 +0000 (18:33 +0600)
committerStas Vilchik <vilchiks@gmail.com>
Tue, 17 Jun 2014 12:33:27 +0000 (18:33 +0600)
sonar-server/Gruntfile.coffee
sonar-server/src/main/coffee/dashboard/file-app.coffee [new file with mode: 0644]
sonar-server/src/main/coffee/drilldown/app.coffee
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb

index e4705a5ad93cdf4219ee81f0aa7f04f8ef784974..637192424e14bfde8bb0c7f824ae44fdcc02be82 100644 (file)
@@ -183,6 +183,10 @@ module.exports = (grunt) ->
         name: 'drilldown/app'
         out: '<%= pkg.assets %>build/js/drilldown/app.js'
 
+      dashboardFile: options:
+        name: 'dashboard/file-app'
+        out: '<%= pkg.assets %>build/js/dashboard/file-app.js'
+
 
     handlebars:
       options:
diff --git a/sonar-server/src/main/coffee/dashboard/file-app.coffee b/sonar-server/src/main/coffee/dashboard/file-app.coffee
new file mode 100644 (file)
index 0000000..e7354cc
--- /dev/null
@@ -0,0 +1,55 @@
+requirejs.config
+  baseUrl: "#{baseUrl}/js"
+
+  paths:
+    'backbone': 'third-party/backbone'
+    'backbone.marionette': 'third-party/backbone.marionette'
+    'handlebars': 'third-party/handlebars'
+    'jquery.mockjax': 'third-party/jquery.mockjax'
+
+  shim:
+    'backbone.marionette':
+      deps: ['backbone']
+      exports: 'Marionette'
+    'backbone':
+      exports: 'Backbone'
+    'handlebars':
+      exports: 'Handlebars'
+
+
+requirejs [
+  'backbone.marionette'
+  'component-viewer/main'
+], (
+  Marionette
+  ComponentViewer
+) ->
+
+  $ = jQuery
+  App = new Marionette.Application()
+
+
+  App.addRegions
+    viewerRegion: '#accordion-panel'
+
+
+  App.requestComponentViewer = ->
+    unless App.componentViewer?
+      App.componentViewer = new ComponentViewer()
+      App.viewerRegion.show App.componentViewer
+    App.componentViewer
+
+
+
+  App.addInitializer ->
+    viewer = App.requestComponentViewer()
+    viewer.open(window.fileKey).done -> viewer.showAllLines()
+
+
+  # Message bundles
+  l10nXHR = window.requestMessages()
+
+
+  $.when(l10nXHR).done ->
+    # Start the application
+    App.start()
index 189886cc6689b0b5ad5fd59336cb3b649b568bcc..77f163f96cbb251d85337445de2886482a436a60 100644 (file)
@@ -81,8 +81,5 @@ requirejs [
 
 
   $.when(l10nXHR).done ->
-    # Remove the initial spinner
-    $('#coding-rules-page-loader').remove()
-
     # Start the application
     App.start()
index 57fedba78a24b4124b6ac9218a6c38df288c6fa8..c588a50d1e0b97d6b19a61f1c39ba0408869d546 100644 (file)
@@ -1,6 +1,11 @@
+<% content_for :script do %>
+  <script data-main="<%= ApplicationController.root_context -%>/js/dashboard/file-app" src="<%= ApplicationController.root_context -%>/js/require.js"></script>
+<% end %>
+
 <%= render :partial => 'gwt/base', :locals => {:resource => nil, :popup => false, :metric => nil} -%>
 <%= render :partial => 'gwt/resource_viewers' -%>
 
+<div class="marginbottom10"></div>
 <div id="accordion-panel"></div>
 
 <script type="text/javascript">
     anchor = stripped_url[1];
   }
 
-  openAccordionItem('<%= url_for(params.merge({:controller => 'resource', :action => :index, :id => @file.id, :display_title => 'false', :popup => 'false'})) -%>', this, false)
-      .done(function () {
-        if (anchor != null) {
-          window.location.hash = anchor;
-        }
-      });
+  window.fileKey = '<%= @file.key -%>';
 
   // refresh page after issues bulk change
   function onBulkIssues(){