From 6350007e9d2874feead1b63425a30330a9a1b687 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 21 Nov 2013 12:22:45 +0100 Subject: [PATCH] SONAR-4851 feed HTML with names of selected projects --- .../main/webapp/WEB-INF/app/models/project.rb | 7 +++++++ .../WEB-INF/app/views/issues/search.html.erb | 16 ++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb index 4b87f86ae0d..bb9e464f125 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project.rb @@ -44,6 +44,13 @@ class Project < ActiveRecord::Base end end + # return an array with exactly the same size than keys. If an item is not found, then it's nil. + def self.by_keys(keys) + keys.map do |key| + by_key(key) + end + end + def self.delete_resource_tree(project) java_facade = Java::OrgSonarServerUi::JRubyFacade.getInstance() if project && java_facade.getResourceTypeBooleanProperty(project.qualifier, 'deletable') diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb index 0de521d3191..8f7ad8c8330 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb @@ -128,14 +128,14 @@ }); var queryParams = [ - { key: 'componentRoots', value: <%= @issues_query.componentRoots.to_json %> }, - { key: 'severities[]', value: <%= @issues_query.severities.to_json %> }, - { key: 'statuses[]', value: <%= @issues_query.statuses.to_json %> }, - { key: 'resolutions[]', value: <%= @issues_query.resolutions.to_json %> }, - { key: 'assignees', value: <%= @issues_query.assignees.to_json %> }, - { key: 'reporters', value: <%= @issues_query.reporters.to_json %> }, - { key: 'createdAfter', value: '<%= Api::Utils.format_date(@issues_query.createdAfter) %>' }, - { key: 'createdBefore', value: '<%= Api::Utils.format_date(@issues_query.createdBefore) %>' } + { key: 'componentRoots', value: <%= @issues_query.componentRoots.to_json -%>, text: <%= Project.by_keys(@issues_query.componentRoots).map{|c| c ? c.name : nil}.to_json -%> }, + { key: 'severities[]', value: <%= @issues_query.severities.to_json -%> }, + { key: 'statuses[]', value: <%= @issues_query.statuses.to_json -%> }, + { key: 'resolutions[]', value: <%= @issues_query.resolutions.to_json -%> }, + { key: 'assignees', value: <%= @issues_query.assignees.to_json -%> }, + { key: 'reporters', value: <%= @issues_query.reporters.to_json -%> }, + { key: 'createdAfter', value: '<%= Api::Utils.format_date(@issues_query.createdAfter) -%>' }, + { key: 'createdBefore', value: '<%= Api::Utils.format_date(@issues_query.createdBefore) -%>' } ]; window.SS.NavigatorApp.start(); -- 2.39.5