aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-server
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-06-17 18:33:19 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-06-17 18:33:27 +0600
commit455aa1cd1fa6ae9077b54b4e46fd35352877c55f (patch)
tree9fa0dbe3ce8cabdea324593b3ac632d86f99c775 /sonar-server
parent7e3b9ca7aeada4e763d69a7f82d11ca426e4757d (diff)
downloadsonarqube-455aa1cd1fa6ae9077b54b4e46fd35352877c55f.tar.gz
sonarqube-455aa1cd1fa6ae9077b54b4e46fd35352877c55f.zip
SONAR-5209 File dashboard integration
Diffstat (limited to 'sonar-server')
-rw-r--r--sonar-server/Gruntfile.coffee4
-rw-r--r--sonar-server/src/main/coffee/dashboard/file-app.coffee55
-rw-r--r--sonar-server/src/main/coffee/drilldown/app.coffee3
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb12
4 files changed, 65 insertions, 9 deletions
diff --git a/sonar-server/Gruntfile.coffee b/sonar-server/Gruntfile.coffee
index e4705a5ad93..637192424e1 100644
--- a/sonar-server/Gruntfile.coffee
+++ b/sonar-server/Gruntfile.coffee
@@ -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
index 00000000000..e7354ccbaef
--- /dev/null
+++ b/sonar-server/src/main/coffee/dashboard/file-app.coffee
@@ -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()
diff --git a/sonar-server/src/main/coffee/drilldown/app.coffee b/sonar-server/src/main/coffee/drilldown/app.coffee
index 189886cc668..77f163f96cb 100644
--- a/sonar-server/src/main/coffee/drilldown/app.coffee
+++ b/sonar-server/src/main/coffee/drilldown/app.coffee
@@ -81,8 +81,5 @@ requirejs [
$.when(l10nXHR).done ->
- # Remove the initial spinner
- $('#coding-rules-page-loader').remove()
-
# Start the application
App.start()
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
index 57fedba78a2..c588a50d1e0 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/no_dashboard.html.erb
@@ -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">
@@ -12,12 +17,7 @@
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(){