Commit 80d599e0d1d3ca44aac508d8a2b0c5ef39874916
Committed by
João M. M. da Silva
1 parent
1e0f1d79
Exists in
master
and in
29 other branches
[Mezuro] draft to module result controller, missing tests and views
Showing
15 changed files
with
238 additions
and
269 deletions
Show diff stats
plugins/mezuro/controllers/profile/mezuro_plugin_module_controller.rb
... | ... | @@ -1,59 +0,0 @@ |
1 | -#TODO refatorar todo o controller e seus testes funcionais | |
2 | -class MezuroPluginModuleController < MezuroPluginProfileController | |
3 | - | |
4 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
5 | - | |
6 | - def module_result | |
7 | - project_content = profile.articles.find(params[:id]) | |
8 | - repositories = project_content.repositories | |
9 | - @module_result = project_content.module_result(repositories.first.id) | |
10 | - @metric_results = Kalibro::MetricResult.metric_results_of(@module_result.id) | |
11 | - if project_content_has_errors? | |
12 | - redirect_to_error_page(@content.errors[:base]) | |
13 | - else | |
14 | - render :partial => 'module_result' | |
15 | - end | |
16 | - end | |
17 | - | |
18 | - def module_metrics_history | |
19 | - module_result_id = params[:module_result_id] | |
20 | - @content = profile.articles.find(params[:id]) | |
21 | - module_history = @content.result_history(params[:module_result_id]) | |
22 | - if project_content_has_errors? | |
23 | - redirect_to_error_page(@content.errors[:base]) | |
24 | - else | |
25 | - @score_history = filtering_metric_history(metric_name, module_history) | |
26 | - render :partial => 'score_history' | |
27 | - end | |
28 | - end | |
29 | - | |
30 | - def module_grade_history | |
31 | - @content = profile.articles.find(params[:id]) | |
32 | - modules_results = @content.result_history(params[:module_result_id]) | |
33 | - if project_content_has_errors? | |
34 | - redirect_to_error_page(@content.errors[:base]) | |
35 | - else | |
36 | - @score_history = modules_results.map do |module_result| | |
37 | - [module_result.grade, format_date_to_simple_form(module_result.date)] | |
38 | - end | |
39 | - render :partial => 'score_history' | |
40 | - end | |
41 | - end | |
42 | - | |
43 | - private | |
44 | - | |
45 | - def filtering_metric_history(metric_name, module_history) | |
46 | - metrics_history = module_history.select do |m| | |
47 | - m.metric_result.configuration.metric.name.delete("() ") == metric_name | |
48 | - end | |
49 | - | |
50 | - metric_history = metrics_history.map do |m| | |
51 | - [m.metric_result.value, format_date_to_simple_form(m.date)] | |
52 | - end | |
53 | - end | |
54 | - | |
55 | - def format_date_to_simple_form date | |
56 | - date.to_s[0..9] | |
57 | - end | |
58 | - | |
59 | -end |
plugins/mezuro/controllers/profile/mezuro_plugin_module_result_controller.rb
0 → 100644
... | ... | @@ -0,0 +1,26 @@ |
1 | +#TODO refatorar todo o controller e seus testes funcionais | |
2 | +class MezuroPluginModuleResultController < MezuroPluginProfileController | |
3 | + | |
4 | + append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
5 | + | |
6 | + def module_result | |
7 | + @module_result = Kalibro::ModuleResult.find(params[:module_result_id].to_i) | |
8 | + render :partial => 'module_result' | |
9 | + end | |
10 | + | |
11 | + def metric_results | |
12 | + @metric_results = Kalibro::MetricResult.metric_results_of(params[:module_result_id].to_i) | |
13 | + render :partial => 'metric_results' | |
14 | + end | |
15 | + | |
16 | + def metric_result_history | |
17 | + @history = Kalibro::MetricResult.history_of(params[:metric_name], params[:module_result_id].to_i) | |
18 | + render :partial => 'score_history' | |
19 | + end | |
20 | + | |
21 | + def module_result_history | |
22 | + @history = Kalibro::ModuleResult.history_of(params[:module_result_id].to_i) | |
23 | + render :partial => 'score_history' | |
24 | + end | |
25 | + | |
26 | +end | ... | ... |
plugins/mezuro/controllers/profile/mezuro_plugin_processing_controller.rb
... | ... | @@ -20,37 +20,4 @@ class MezuroPluginProcessingController < MezuroPluginProfileController |
20 | 20 | end |
21 | 21 | end |
22 | 22 | |
23 | - def project_tree | |
24 | - @content = profile.articles.find(params[:id]) | |
25 | - date = params[:date] | |
26 | - project_result = date.nil? ? @content.project_result : @content.project_result_with_date(date) | |
27 | - @project_name = @content.project.name if not @content.project.nil? | |
28 | - if project_content_has_errors? | |
29 | - redirect_to_error_page(@content.errors[:base]) | |
30 | - else | |
31 | - @source_tree = project_result.node(params[:module_name]) | |
32 | - render :partial =>'source_tree' | |
33 | - end | |
34 | - end | |
35 | - | |
36 | - private | |
37 | - | |
38 | - def module_result(repository_id, date = nil) | |
39 | - @processing ||= date.nil? ? processing(repository_id) : processing_with_date(repository_id, date) | |
40 | - begin | |
41 | - @module_result ||= Kalibro::ModuleResult.find(@processing.results_root_id) | |
42 | - rescue Exception => error | |
43 | - errors.add_to_base(error.message) | |
44 | - end | |
45 | - @module_result | |
46 | - end | |
47 | - | |
48 | - def result_history(module_result_id) | |
49 | - begin | |
50 | - @result_history ||= Kalibro::MetricResult.history_of(module_result_id) | |
51 | - rescue Exception => error | |
52 | - errors.add_to_base(error.message) | |
53 | - end | |
54 | - end | |
55 | - | |
56 | 23 | end | ... | ... |
plugins/mezuro/lib/kalibro/metric_result.rb
... | ... | @@ -26,8 +26,8 @@ class Kalibro::MetricResult < Kalibro::Model |
26 | 26 | request(:metric_results_of, {:module_result_id => module_result_id})[:metric_result].to_a.map {|metric_result| new metric_result} |
27 | 27 | end |
28 | 28 | |
29 | - def history_of(module_result_id) | |
30 | - self.class.request(:history_of, {:metric_name => self.configuration.metric.name, :module_result_id => module_result_id})[:date_metric_result].to_a.map {|date_metric_result| Kalibro::DateMetricResult.new date_metric_result} | |
29 | + def self.history_of(metric_name, module_result_id) | |
30 | + self.request(:history_of, {:metric_name => metric_name, :module_result_id => module_result_id})[:date_metric_result].to_a.map {|date_metric_result| Kalibro::DateMetricResult.new date_metric_result} | |
31 | 31 | end |
32 | 32 | |
33 | 33 | end | ... | ... |
plugins/mezuro/test/functional/profile/mezuro_plugin_module_controller_test.rb
... | ... | @@ -1,78 +0,0 @@ |
1 | -require 'test_helper' | |
2 | - | |
3 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" | |
4 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" | |
5 | -require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_fixtures" | |
6 | - | |
7 | -#TODO refatorar todos os testes | |
8 | -class MezuroPluginModuleControllerTest < ActionController::TestCase | |
9 | - | |
10 | - def setup | |
11 | - @controller = MezuroPluginModuleController.new | |
12 | - @request = ActionController::TestRequest.new | |
13 | - @response = ActionController::TestResponse.new | |
14 | - @profile = fast_create(Community) | |
15 | - | |
16 | - #@project_result = ProjectResultFixtures.project_result | |
17 | - @module_result = ModuleResultFixtures.module_result | |
18 | - @repository_url = RepositoryFixtures.repository.address | |
19 | - @project = ProjectFixtures.project | |
20 | - @date = "2012-04-13T20:39:41+04:00" | |
21 | - | |
22 | - #Kalibro::Project.expects(:all_names).returns([]) | |
23 | - @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :project_id => @project.id) | |
24 | - @content.expects(:send_project_to_service).returns(nil) | |
25 | - @content.save | |
26 | - | |
27 | - end | |
28 | - | |
29 | - should 'get module result' do | |
30 | - end | |
31 | - | |
32 | -=begin | |
33 | - should 'get module result without date' do | |
34 | - date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) | |
35 | - Kalibro::ProjectResult.expects(:request). | |
36 | - with("ProjectResult", :get_last_result_of, {:project_name => @project.name}). | |
37 | - returns({:project_result => @project_result.to_hash}) | |
38 | - Kalibro::ModuleResult.expects(:request). | |
39 | - with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}). | |
40 | - returns({:module_result => @module_result.to_hash}) | |
41 | - get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil | |
42 | - assert_equal @content, assigns(:content) | |
43 | - assert_equal @module_result.grade, assigns(:module_result).grade | |
44 | - assert_response 200 | |
45 | - assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | |
46 | - end | |
47 | - | |
48 | - should 'get module result with a specific date' do | |
49 | - date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) | |
50 | - request_body = {:project_name => @project.name, :date => @project_result.date} | |
51 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) | |
52 | - Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | |
53 | - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}).returns({:module_result => @module_result.to_hash}) | |
54 | - get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date | |
55 | - assert_equal @content, assigns(:content) | |
56 | - assert_equal @module_result.grade, assigns(:module_result).grade | |
57 | - assert_response 200 | |
58 | - assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | |
59 | - end | |
60 | - | |
61 | - should 'test module metrics history' do | |
62 | - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) | |
63 | - get :module_metrics_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, | |
64 | - :metric_name => @module_result.metric_result.first.metric.name.delete("() ") | |
65 | - assert_equal @content, assigns(:content) | |
66 | - assert_equal [[@module_result.metric_result[0].value, @module_result.date.to_s[0..9]]], assigns(:score_history) | |
67 | - assert_response 200 | |
68 | - end | |
69 | - | |
70 | - should 'test grade history' do | |
71 | - Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) | |
72 | - get :module_grade_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name | |
73 | - assert_equal @content, assigns(:content) | |
74 | - assert_equal [[@module_result.grade, @module_result.date.to_s[0..9]]], assigns(:score_history) | |
75 | - assert_response 200 | |
76 | - end | |
77 | -=end | |
78 | -end |
plugins/mezuro/test/functional/profile/mezuro_plugin_module_result_controller_test.rb
0 → 100644
... | ... | @@ -0,0 +1,102 @@ |
1 | +require 'test_helper' | |
2 | + | |
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/module_result_fixtures" | |
4 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/repository_fixtures" | |
5 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/project_fixtures" | |
6 | + | |
7 | +#TODO refatorar todos os testes | |
8 | +class MezuroPluginModuleResultControllerTest < ActionController::TestCase | |
9 | + | |
10 | + def setup | |
11 | + @controller = MezuroPluginModuleResultController.new | |
12 | + @request = ActionController::TestRequest.new | |
13 | + @response = ActionController::TestResponse.new | |
14 | + @profile = fast_create(Community) | |
15 | + | |
16 | +=begin | |
17 | + #@project_result = ProjectResultFixtures.project_result | |
18 | + @module_result = ModuleResultFixtures.module_result | |
19 | + @repository_url = RepositoryFixtures.repository.address | |
20 | + @project = ProjectFixtures.project | |
21 | + @date = "2012-04-13T20:39:41+04:00" | |
22 | + | |
23 | + #Kalibro::Project.expects(:all_names).returns([]) | |
24 | + @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :project_id => @project.id) | |
25 | + @content.expects(:send_project_to_service).returns(nil) | |
26 | + @content.save | |
27 | +=end | |
28 | + end | |
29 | + | |
30 | + should 'get module result' do | |
31 | + end | |
32 | + | |
33 | +=begin | |
34 | + should 'get module result without date' do | |
35 | + date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) | |
36 | + Kalibro::ProjectResult.expects(:request). | |
37 | + with("ProjectResult", :get_last_result_of, {:project_name => @project.name}). | |
38 | + returns({:project_result => @project_result.to_hash}) | |
39 | + Kalibro::ModuleResult.expects(:request). | |
40 | + with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}). | |
41 | + returns({:module_result => @module_result.to_hash}) | |
42 | + get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil | |
43 | + assert_equal @content, assigns(:content) | |
44 | + assert_equal @module_result.grade, assigns(:module_result).grade | |
45 | + assert_response 200 | |
46 | + assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | |
47 | + end | |
48 | + | |
49 | + should 'get module result with a specific date' do | |
50 | + date_with_milliseconds = Kalibro::ProjectResult.date_with_milliseconds(@project_result.date) | |
51 | + request_body = {:project_name => @project.name, :date => @project_result.date} | |
52 | + Kalibro::ProjectResult.expects(:request).with("ProjectResult", :has_results_before, request_body).returns({:has_results => true}) | |
53 | + Kalibro::ProjectResult.expects(:request).with("ProjectResult", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | |
54 | + Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_module_result, {:project_name => @project.name, :module_name => @project.name, :date => date_with_milliseconds}).returns({:module_result => @module_result.to_hash}) | |
55 | + get :module_result, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date | |
56 | + assert_equal @content, assigns(:content) | |
57 | + assert_equal @module_result.grade, assigns(:module_result).grade | |
58 | + assert_response 200 | |
59 | + assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | |
60 | + end | |
61 | + | |
62 | + should 'test module metrics history' do | |
63 | + Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) | |
64 | + get :module_metrics_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, | |
65 | + :metric_name => @module_result.metric_result.first.metric.name.delete("() ") | |
66 | + assert_equal @content, assigns(:content) | |
67 | + assert_equal [[@module_result.metric_result[0].value, @module_result.date.to_s[0..9]]], assigns(:score_history) | |
68 | + assert_response 200 | |
69 | + end | |
70 | + | |
71 | + should 'test grade history' do | |
72 | + Kalibro::ModuleResult.expects(:request).with("ModuleResult", :get_result_history, {:project_name => @project.name, :module_name => @project.name}).returns({:module_result => @module_result}) | |
73 | + get :module_grade_history, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name | |
74 | + assert_equal @content, assigns(:content) | |
75 | + assert_equal [[@module_result.grade, @module_result.date.to_s[0..9]]], assigns(:score_history) | |
76 | + assert_response 200 | |
77 | + end | |
78 | + | |
79 | + should 'test project tree without date' do | |
80 | + Kalibro::Processing.expects(:request).with("Processing", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash}) | |
81 | + Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | |
82 | + get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil | |
83 | + assert_equal @content, assigns(:content) | |
84 | + assert_equal @project.name, assigns(:project_name) | |
85 | + assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name | |
86 | + assert_response 200 | |
87 | + assert_select('h2', /Qt-Calculator/) | |
88 | + end | |
89 | + | |
90 | + should 'test project tree with a specific date' do | |
91 | + request_body = {:project_name => @project.name, :date => @project_result.date} | |
92 | + Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | |
93 | + Kalibro::Processing.expects(:request).with("Processing", :has_results_before, request_body).returns({:has_results => true}) | |
94 | + Kalibro::Processing.expects(:request).with("Processing", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | |
95 | + get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date | |
96 | + assert_equal @content, assigns(:content) | |
97 | + assert_equal @project.name, assigns(:project_name) | |
98 | + assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name | |
99 | + assert_response 200 | |
100 | + end | |
101 | +=end | |
102 | +end | ... | ... |
plugins/mezuro/test/functional/profile/mezuro_plugin_processing_controller_test.rb
... | ... | @@ -16,14 +16,6 @@ class MezuroPluginProcessingControllerTest < ActionController::TestCase |
16 | 16 | @processing = ProcessingFixtures.processing |
17 | 17 | @processing_hash = ProcessingFixtures.processing_hash |
18 | 18 | @processing_with_error_hash = ProcessingFixtures.processing_with_error_hash |
19 | -=begin | |
20 | - @content = MezuroPlugin::ProjectContent.new(:profile => @profile, :name => @project.name, :repository_url => @repository_url) | |
21 | - @content.expects(:send_project_to_service).returns(nil) | |
22 | - @content.save | |
23 | - @project_result = ProcessingFixtures.project_result | |
24 | - | |
25 | - Kalibro::Project.expects(:all_names).returns([]) | |
26 | -=end | |
27 | 19 | end |
28 | 20 | |
29 | 21 | should 'render last processing state' do |
... | ... | @@ -33,7 +25,6 @@ class MezuroPluginProcessingControllerTest < ActionController::TestCase |
33 | 25 | assert_equal @processing.state, @response.body |
34 | 26 | end |
35 | 27 | |
36 | - | |
37 | 28 | should 'render processing with error' do |
38 | 29 | Kalibro::Processing.expects(:request).with(:has_ready_processing, {:repository_id => @repository_id}).returns({:exists => false}) |
39 | 30 | Kalibro::Processing.expects(:request).with(:last_processing, :repository_id => @repository_id).returns({:processing => @processing_with_error_hash}) |
... | ... | @@ -59,29 +50,4 @@ class MezuroPluginProcessingControllerTest < ActionController::TestCase |
59 | 50 | assert_select('h4', 'Last Result') |
60 | 51 | end |
61 | 52 | |
62 | -#TODO refatorar todos os testes | |
63 | -=begin | |
64 | - should 'test project tree without date' do | |
65 | - Kalibro::Processing.expects(:request).with("Processing", :get_last_result_of, {:project_name => @project.name}).returns({:project_result => @project_result.to_hash}) | |
66 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | |
67 | - get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => nil | |
68 | - assert_equal @content, assigns(:content) | |
69 | - assert_equal @project.name, assigns(:project_name) | |
70 | - assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name | |
71 | - assert_response 200 | |
72 | - assert_select('h2', /Qt-Calculator/) | |
73 | - end | |
74 | - | |
75 | - should 'test project tree with a specific date' do | |
76 | - request_body = {:project_name => @project.name, :date => @project_result.date} | |
77 | - Kalibro::Project.expects(:request).with("Project", :get_project, :project_name => @project.name).returns({:project => @project.to_hash}) | |
78 | - Kalibro::Processing.expects(:request).with("Processing", :has_results_before, request_body).returns({:has_results => true}) | |
79 | - Kalibro::Processing.expects(:request).with("Processing", :get_last_result_before, request_body).returns({:project_result => @project_result.to_hash}) | |
80 | - get :project_tree, :profile => @profile.identifier, :id => @content.id, :module_name => @project.name, :date => @project_result.date | |
81 | - assert_equal @content, assigns(:content) | |
82 | - assert_equal @project.name, assigns(:project_name) | |
83 | - assert_equal @project_result.source_tree.module.name, assigns(:source_tree).module.name | |
84 | - assert_response 200 | |
85 | - end | |
86 | -=end | |
87 | 53 | end | ... | ... |
plugins/mezuro/test/unit/kalibro/metric_result_test.rb
... | ... | @@ -34,7 +34,7 @@ class MetricResultTest < ActiveSupport::TestCase |
34 | 34 | should 'return history of a metric with a module result id' do |
35 | 35 | module_id = 31 |
36 | 36 | Kalibro::MetricResult.expects(:request).with(:history_of, {:metric_name => @result.configuration.metric.name, :module_result_id => module_id}).returns({:date_metric_result => [DateMetricResultFixtures.date_metric_result_hash]}) |
37 | - assert_equal DateMetricResultFixtures.date_metric_result_hash[:metric_result][:id], @result.history_of(module_id).first.metric_result.id | |
37 | + assert_equal DateMetricResultFixtures.date_metric_result_hash[:metric_result][:id], Kalibro::MetricResult.history_of(@result.configuration.metric.name, module_result_id).first.metric_result.id | |
38 | 38 | end |
39 | 39 | |
40 | 40 | end | ... | ... |
plugins/mezuro/views/mezuro_plugin_module/_error_page.html.erb
plugins/mezuro/views/mezuro_plugin_module/_module_result.rhtml
... | ... | @@ -1,59 +0,0 @@ |
1 | -<% module_name = @module_result.module.name | |
2 | -<h5><%= _('Metric results for: #{module_name} (#{@module_result.module.granularity}) ') %> </h5> | |
3 | - | |
4 | -<hr/> | |
5 | -<div class="zoomable-image"> | |
6 | -<table style="width: 100%"> | |
7 | - <thead> | |
8 | - <tr> | |
9 | - <th style="width: 74%">Metric</th> | |
10 | - <th>Value</th> | |
11 | - <th>Weight</th> | |
12 | - <th>Threshold</th> | |
13 | - </tr> | |
14 | - </thead> | |
15 | - <tbody> | |
16 | - <% @metric_results.each do |metric_result| %> | |
17 | - <% metric_configuration_snapshot = metric_result.metric_configuration_snapshot%> | |
18 | - <% range_snapshot = metric_configuration_snapshot.range_snapshot %> | |
19 | - <% formatted_name = MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_configuration_snapshot) %> | |
20 | - <% if !range_snapshot.nil? %> | |
21 | - <tr> | |
22 | - <td style="width: 74%"><a href="#" show-metric-history="<%= formatted_name %>" data-module-name="<%= module_name %>"><%= metric_configuration_snapshot.metric.name %></a></td> | |
23 | - <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %></td> | |
24 | - <td><%= metric_configuration_snapshot.weight %></td> | |
25 | - <td style="background-color: #<%= range_snapshot.color %>"> | |
26 | - <span title="<%= range_snapshot.comments %>" > | |
27 | - <%= range_snapshot.label %> | |
28 | - </span> | |
29 | - </td> | |
30 | - </tr> | |
31 | - <tr class="<%= formatted_name %>" style="display: none;"> | |
32 | - <td colspan="3"> | |
33 | - <div id='historical-<%= formatted_name %>'> | |
34 | - </div> | |
35 | - </td> | |
36 | - <td align="right"> | |
37 | - <%= range_snapshot.comments.nil? ? '' : range_snapshot.comments %> | |
38 | - </td> | |
39 | - </tr> | |
40 | - <% end %> | |
41 | - <% end %> | |
42 | - </tbody> | |
43 | - <tfoot> | |
44 | - <tr> | |
45 | - <td colspan = "3"> | |
46 | - <div id='historical-grade' style="display: none;"></div> | |
47 | - </td> | |
48 | - <td align = "right"> | |
49 | - <a href="#" show-grade-history="<%= module_name %>" data-module-name="<%= module_name%>" > | |
50 | - <strong> | |
51 | - <%= _('Grade:') %> | |
52 | - <%= "%.02f" % @module_result.grade %> | |
53 | - </strong> | |
54 | - </a> | |
55 | - </td> | |
56 | - </tr> | |
57 | - </tfoot> | |
58 | -</table> | |
59 | -</div> |
plugins/mezuro/views/mezuro_plugin_module/_score_history.rhtml
... | ... | @@ -1 +0,0 @@ |
1 | -<%= image_tag(MezuroPlugin::Helpers::ContentViewerHelper.generate_chart(@score_history)) %> |
plugins/mezuro/views/mezuro_plugin_module_result/_error_page.html.erb
0 → 100644
plugins/mezuro/views/mezuro_plugin_module_result/_module_result.rhtml
0 → 100644
... | ... | @@ -0,0 +1,59 @@ |
1 | +<% module_name = @module_result.module.name | |
2 | +<h5><%= _('Metric results for: #{module_name} (#{@module_result.module.granularity}) ') %> </h5> | |
3 | + | |
4 | +<hr/> | |
5 | +<div class="zoomable-image"> | |
6 | +<table style="width: 100%"> | |
7 | + <thead> | |
8 | + <tr> | |
9 | + <th style="width: 74%">Metric</th> | |
10 | + <th>Value</th> | |
11 | + <th>Weight</th> | |
12 | + <th>Threshold</th> | |
13 | + </tr> | |
14 | + </thead> | |
15 | + <tbody> | |
16 | + <% @metric_results.each do |metric_result| %> | |
17 | + <% metric_configuration_snapshot = metric_result.metric_configuration_snapshot%> | |
18 | + <% range_snapshot = metric_configuration_snapshot.range_snapshot %> | |
19 | + <% formatted_name = MezuroPlugin::Helpers::ContentViewerHelper.format_name(metric_configuration_snapshot) %> | |
20 | + <% if !range_snapshot.nil? %> | |
21 | + <tr> | |
22 | + <td style="width: 74%"><a href="#" show-metric-history="<%= formatted_name %>" data-module-name="<%= module_name %>"><%= metric_configuration_snapshot.metric.name %></a></td> | |
23 | + <td><%= MezuroPlugin::Helpers::ContentViewerHelper.format_grade(metric_result.value) %></td> | |
24 | + <td><%= metric_configuration_snapshot.weight %></td> | |
25 | + <td style="background-color: #<%= range_snapshot.color %>"> | |
26 | + <span title="<%= range_snapshot.comments %>" > | |
27 | + <%= range_snapshot.label %> | |
28 | + </span> | |
29 | + </td> | |
30 | + </tr> | |
31 | + <tr class="<%= formatted_name %>" style="display: none;"> | |
32 | + <td colspan="3"> | |
33 | + <div id='historical-<%= formatted_name %>'> | |
34 | + </div> | |
35 | + </td> | |
36 | + <td align="right"> | |
37 | + <%= range_snapshot.comments.nil? ? '' : range_snapshot.comments %> | |
38 | + </td> | |
39 | + </tr> | |
40 | + <% end %> | |
41 | + <% end %> | |
42 | + </tbody> | |
43 | + <tfoot> | |
44 | + <tr> | |
45 | + <td colspan = "3"> | |
46 | + <div id='historical-grade' style="display: none;"></div> | |
47 | + </td> | |
48 | + <td align = "right"> | |
49 | + <a href="#" show-grade-history="<%= module_name %>" data-module-name="<%= module_name%>" > | |
50 | + <strong> | |
51 | + <%= _('Grade:') %> | |
52 | + <%= "%.02f" % @module_result.grade %> | |
53 | + </strong> | |
54 | + </a> | |
55 | + </td> | |
56 | + </tr> | |
57 | + </tfoot> | |
58 | +</table> | |
59 | +</div> | ... | ... |
plugins/mezuro/views/mezuro_plugin_module_result/_score_history.rhtml
0 → 100644
... | ... | @@ -0,0 +1 @@ |
1 | +<%= image_tag(MezuroPlugin::Helpers::ContentViewerHelper.generate_chart(@score_history)) %> | ... | ... |
plugins/mezuro/views/mezuro_plugin_module_result/_source_tree.rhtml
0 → 100644
... | ... | @@ -0,0 +1,45 @@ |
1 | +<% unless @content.errors[:base].nil? %> | |
2 | + <%= @content.errors[:base] %> | |
3 | +<% else %> | |
4 | + <h4><%= _('Source tree') %></h4> | |
5 | + <% module_name = @source_tree.module.name %> | |
6 | + <% module_label = "#{module_name} (#{@source_tree.module.granularity})" %> | |
7 | + | |
8 | + <p><h2 class="path"> | |
9 | + <% if module_name != @project_name %> | |
10 | + <a href="#" class="source-tree-link" data-module-name="<%= @project_name %>"> | |
11 | + <%= @project_name %> | |
12 | + </a> | |
13 | + <% end %> | |
14 | + | |
15 | + | |
16 | + <% split_link = @source_tree.module.ancestor_names %> | |
17 | + <% split_link.each do |link| %> | |
18 | + /<a href="#" class="source-tree-link" data-module-name="<%= link %>"> | |
19 | + <%= link.split(".").last %> | |
20 | + </a> | |
21 | + <% end %> | |
22 | + </h2></p> | |
23 | + | |
24 | + <% if @source_tree.children %> | |
25 | + <table border="0" class="source-tree"> | |
26 | + <% @source_tree.children.each do |child| %> | |
27 | + <% if child.module.granularity=='PACKAGE' %> | |
28 | + <tr> | |
29 | + <td class="icon"><%= image_tag('/plugins/mezuro/images/folder.png')%></td> | |
30 | + <td class="source-tree-text"><a href='#' class="source-tree-link" data-module-name="<%= child.module.name %>"><%= child.module.name %></a></td> | |
31 | + </tr> | |
32 | + <% else %> | |
33 | + <tr> | |
34 | + <td class="icon"><%= image_tag('/plugins/mezuro/images/file.png') %></td> | |
35 | + <td class="source-tree-text"> | |
36 | + <a href='#' class="source-tree-link" data-module-name="<%= child.module.name %>"> | |
37 | + <%= child.module.name %> | |
38 | + </a> | |
39 | + </td> | |
40 | + </tr> | |
41 | + <% end %> | |
42 | + <% end %> | |
43 | + </table> | |
44 | + <% end %> | |
45 | +<% end %> | ... | ... |