diff --git a/app/assets/javascripts/module/tree.js.coffee b/app/assets/javascripts/module/tree.js.coffee
index 7ece426..7654dcb 100644
--- a/app/assets/javascripts/module/tree.js.coffee
+++ b/app/assets/javascripts/module/tree.js.coffee
@@ -1,4 +1,5 @@
class Module.Tree
@load: (loading_html, module_id) ->
$('div#module_tree').html(loading_html)
+ $('div#metric_results').html(loading_html)
$.post '/modules/'+module_id+'/tree'
\ No newline at end of file
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index bb7bc98..7bc0488 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -13,7 +13,6 @@ class RepositoriesController < ApplicationController
def show
@configuration = KalibroEntities::Entities::Configuration.find(@repository.configuration_id) #FIXME: As soon as the Configuration model gets created refactor this!
@processing = @repository.last_processing
- set_root_module_result if @processing.ready?
end
# GET projects/1/repositories/new
@@ -64,15 +63,6 @@ class RepositoriesController < ApplicationController
end
private
- # Reducing show action cyclomatic complexity
- def set_root_module_result
- if params[:module_result_id].nil?
- @root_module_result = @processing.root_module_result
- else
- @root_module_result = ModuleResult.find(params[:module_result_id].to_i)
- end
- end
-
# Duplicated code on create and update actions extracted here
def failed_action(format, destiny_action)
@project_id = params[:project_id]
diff --git a/app/views/modules/_metric_result.html.erb b/app/views/modules/_metric_result.html.erb
new file mode 100644
index 0000000..0ccbc69
--- /dev/null
+++ b/app/views/modules/_metric_result.html.erb
@@ -0,0 +1,21 @@
+<% metric_configuration_snapshot = metric_result.metric_configuration_snapshot %>
+<% unless metric_configuration_snapshot.range_snapshot.nil? %>
+ <% range_snapshot = find_range_snapshot(metric_result)
+ metric_name = metric_configuration_snapshot.metric.name
+ %>
+
+ <%= link_to metric_name, "#metric_#{module_result.id}",
+ onclick: "new Module.Graphic('container#{metric_result.id}', '#{metric_name}', '#{module_result.id}')",
+ id: "metric_#{module_result.id}",
+ remote: true %>
+ |
+ <%= format_grade(metric_result.value) %> |
+ <%= metric_configuration_snapshot.weight %> |
+ <%= range_snapshot.label %> |
+
+
+
+ <%= image_tag 'loader.gif' %> Loading data. Please, wait.
+ |
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/modules/_metric_results.html.erb b/app/views/modules/_metric_results.html.erb
new file mode 100644
index 0000000..9f239c5
--- /dev/null
+++ b/app/views/modules/_metric_results.html.erb
@@ -0,0 +1,12 @@
+
+
+ Metric |
+ Value |
+ Weight |
+ Threshold |
+
+
+
+ <%= render partial: 'metric_result', collection: @root_module_result.metric_results, locals: {module_result: @root_module_result} %>
+
+
\ No newline at end of file
diff --git a/app/views/modules/load_module_tree.js.erb b/app/views/modules/load_module_tree.js.erb
index a77b633..599c810 100644
--- a/app/views/modules/load_module_tree.js.erb
+++ b/app/views/modules/load_module_tree.js.erb
@@ -1 +1,2 @@
$('div#module_tree').html('<%= escape_javascript(render partial: "module_tree") %>');
+$('div#metric_results').html('<%= escape_javascript(render partial: "metric_results") %>');
diff --git a/app/views/repositories/_metric_result.html.erb b/app/views/repositories/_metric_result.html.erb
deleted file mode 100644
index 0ccbc69..0000000
--- a/app/views/repositories/_metric_result.html.erb
+++ /dev/null
@@ -1,21 +0,0 @@
-<% metric_configuration_snapshot = metric_result.metric_configuration_snapshot %>
-<% unless metric_configuration_snapshot.range_snapshot.nil? %>
- <% range_snapshot = find_range_snapshot(metric_result)
- metric_name = metric_configuration_snapshot.metric.name
- %>
-
- <%= link_to metric_name, "#metric_#{module_result.id}",
- onclick: "new Module.Graphic('container#{metric_result.id}', '#{metric_name}', '#{module_result.id}')",
- id: "metric_#{module_result.id}",
- remote: true %>
- |
- <%= format_grade(metric_result.value) %> |
- <%= metric_configuration_snapshot.weight %> |
- <%= range_snapshot.label %> |
-
-
-
- <%= image_tag 'loader.gif' %> Loading data. Please, wait.
- |
-
-<% end %>
\ No newline at end of file
diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb
index a5e1095..18f27a4 100644
--- a/app/views/repositories/show.html.erb
+++ b/app/views/repositories/show.html.erb
@@ -36,38 +36,26 @@
<% end %>
-Modules Tree
-
-
-
<% if @processing.ready? %>
- Metric Results
-
-
- Metric |
- Value |
- Weight |
- Threshold |
-
+ Modules Tree
+
-
- <%= render partial: 'metric_result', collection: @root_module_result.metric_results, locals: {module_result: @root_module_result} %>
-
+
-
+ Metric Results
+
+
+
+
+
<% end %>
-
-
-
-
<%= link_to 'Back', project_path(@repository.project_id), class: 'btn btn-default' %>
<% if project_owner? @repository.project_id %>
<%= link_to 'Destroy', project_repository_path(@repository.project_id, @repository.id), method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' %>
<% end %>
-
diff --git a/features/repository/show.feature b/features/repository/show.feature
index ff2f13a..0380eaf 100644
--- a/features/repository/show.feature
+++ b/features/repository/show.feature
@@ -3,7 +3,7 @@ Feature: Show Repository
As a regular user
I should see it's informations
- @kalibro_restart
+ @kalibro_restart @javascript
Scenario: With a ready processing
Given I am a regular user
And I am signed in
@@ -26,7 +26,7 @@ Feature: Show Repository
And I should see "Weight"
And I should see "Threshold"
- @kalibro_restart
+ @kalibro_restart @javascript
Scenario: Just after start to process
Given I am a regular user
And I am signed in
@@ -45,7 +45,7 @@ Feature: Show Repository
And I should not see Weight
And I should not see Threshold
- @kalibro_restart
+ @kalibro_restart @javascript
Scenario: Should show modules directories root when the process has been finished
Given I am a regular user
And I am signed in
diff --git a/spec/controllers/repositories_controller_spec.rb b/spec/controllers/repositories_controller_spec.rb
index 6ffe88c..5fc567a 100644
--- a/spec/controllers/repositories_controller_spec.rb
+++ b/spec/controllers/repositories_controller_spec.rb
@@ -86,7 +86,6 @@ describe RepositoriesController do
before :each do
processing = FactoryGirl.build(:processing)
- processing.expects(:root_module_result).returns(FactoryGirl.build(:module_result))
repository.expects(:last_processing).returns(processing)
KalibroEntities::Entities::Configuration.expects(:find).with(repository.id).returns(FactoryGirl.build(:configuration))
Repository.expects(:find).with(repository.id).returns(repository)
@@ -101,14 +100,12 @@ describe RepositoriesController do
before :each do
processing = FactoryGirl.build(:processing)
- module_result = FactoryGirl.build(:module_result)
- ModuleResult.expects(:find).with(module_result.id)
repository.expects(:last_processing).returns(processing)
KalibroEntities::Entities::Configuration.expects(:find).with(repository.id).returns(FactoryGirl.build(:configuration))
Repository.expects(:find).with(repository.id).returns(repository)
- get :show, id: repository.id.to_s, project_id: project.id.to_s, module_result_id: module_result.id
+ get :show, id: repository.id.to_s, project_id: project.id.to_s
end
it { should render_template(:show) }
--
libgit2 0.21.2