Commit 370a40f70bf2b85c4ed67b8e899865ab303c0507
Committed by
Paulo Meireles
Exists in
master
and in
29 other branches
[Mezuro] Merge branch 'mezuro' into date_tests
Showing
30 changed files
with
490 additions
and
467 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb
0 → 100644
@@ -0,0 +1,141 @@ | @@ -0,0 +1,141 @@ | ||
1 | +class MezuroPluginMyprofileController < ProfileController | ||
2 | + | ||
3 | + append_view_path File.join(File.dirname(__FILE__) + '/../views') | ||
4 | + | ||
5 | + | ||
6 | + def choose_base_tool | ||
7 | + @configuration_name = params[:configuration_name] | ||
8 | + @tool_names = Kalibro::Client::BaseToolClient.new | ||
9 | + end | ||
10 | + | ||
11 | + def choose_metric | ||
12 | + @configuration_name = params[:configuration_name] | ||
13 | + @collector_name = params[:collector_name] | ||
14 | + @collector = Kalibro::Client::BaseToolClient.new.base_tool(@collector_name) | ||
15 | + end | ||
16 | + def new_metric_configuration | ||
17 | + metric_name = params[:metric_name] | ||
18 | + collector_name = params[:collector_name] | ||
19 | + collector = Kalibro::Client::BaseToolClient.new.base_tool(collector_name) | ||
20 | + @metric = collector.supported_metrics.find {|metric| metric.name == metric_name} | ||
21 | + @configuration_name = params[:configuration_name] | ||
22 | + end | ||
23 | + def edit_metric_configuration | ||
24 | + metric_name = params[:metric_name] | ||
25 | + @configuration_name = params[:configuration_name] | ||
26 | + @metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | ||
27 | + @metric = @metric_configuration.metric | ||
28 | + end | ||
29 | + def create_metric_configuration | ||
30 | + @configuration_name = params[:configuration_name] | ||
31 | + metric_configuration = new_metric_configuration_instance | ||
32 | + Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) | ||
33 | + redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | ||
34 | + end | ||
35 | + | ||
36 | + def update_metric_configuration | ||
37 | + @configuration_name = params[:configuration_name] | ||
38 | + metric_name = params[:metric][:name] | ||
39 | + metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | ||
40 | + assign_metric_configuration_instance (metric_configuration) | ||
41 | + Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) | ||
42 | + redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | ||
43 | + end | ||
44 | + | ||
45 | + def new_range | ||
46 | + @metric_name = params[:metric_name] | ||
47 | + @configuration_name = params[:configuration_name] | ||
48 | + end | ||
49 | + | ||
50 | + def edit_range | ||
51 | + @metric_name = params[:metric_name] | ||
52 | + @configuration_name = params[:configuration_name] | ||
53 | + @beginning_id = params[:beginning_id] | ||
54 | + | ||
55 | + metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | ||
56 | + metric_configuration = metric_configuration_client.metric_configuration(@configuration_name, @metric_name) | ||
57 | + @range = metric_configuration.ranges.find{ |range| range.beginning == @beginning_id.to_f } | ||
58 | + end | ||
59 | + | ||
60 | + def create_range | ||
61 | + @range = new_range_instance | ||
62 | + configuration_name = params[:configuration_name] | ||
63 | + metric_name = params[:metric_name] | ||
64 | + beginning_id = params[:beginning_id] | ||
65 | + metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | ||
66 | + metric_configuration = metric_configuration_client.metric_configuration(configuration_name, metric_name) | ||
67 | + metric_configuration.add_range(@range) | ||
68 | + metric_configuration_client.save(metric_configuration, configuration_name) | ||
69 | + end | ||
70 | + | ||
71 | + def update_range | ||
72 | + metric_name = params[:metric_name] | ||
73 | + configuration_name = params[:configuration_name] | ||
74 | + beginning_id = params[:beginning_id] | ||
75 | + metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | ||
76 | + metric_configuration = metric_configuration_client.metric_configuration(configuration_name, metric_name) | ||
77 | + index = metric_configuration.ranges.index{ |range| range.beginning == beginning_id.to_f } | ||
78 | + metric_configuration.ranges[index] = new_range_instance | ||
79 | + Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, configuration_name) | ||
80 | + end | ||
81 | + | ||
82 | + def remove_range | ||
83 | + configuration_name = params[:configuration_name] | ||
84 | + metric_name = params[:metric_name] | ||
85 | + beginning_id = params[:range_beginning] | ||
86 | + metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | ||
87 | + metric_configuration = metric_configuration_client.metric_configuration(configuration_name, metric_name) | ||
88 | + metric_configuration.ranges.delete_if { |range| range.beginning == beginning_id.to_f }.inspect | ||
89 | + Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, configuration_name) | ||
90 | + formatted_configuration_name = configuration_name.gsub(/\s/, '+') | ||
91 | + formatted_metric_name = metric_name.gsub(/\s/, '+') | ||
92 | + redirect_to "/myprofile/#{profile.identifier}/plugins/mezuro/edit_metric_configuration?configuration_name=#{formatted_configuration_name}&metric_name=#{formatted_metric_name}" | ||
93 | + end | ||
94 | + | ||
95 | + def remove_metric_configuration | ||
96 | + configuration_name = params[:configuration_name] | ||
97 | + metric_name = params[:metric_name] | ||
98 | + Kalibro::Client::MetricConfigurationClient.new.remove(configuration_name, metric_name) | ||
99 | + redirect_to "/#{profile.identifier}/#{configuration_name.downcase.gsub(/\s/, '-')}" | ||
100 | + end | ||
101 | + | ||
102 | + def module_metrics_history | ||
103 | + metric_name = params[:metric_name] | ||
104 | + content = profile.articles.find(params[:id]) | ||
105 | + module_history = content.result_history(params[:module_name]) | ||
106 | + date_history = module_history.collect { |x| x.date } | ||
107 | + metric_history = module_history.collect { |x| (x.metric_results.select { |y| y.metric.name.delete("() ") == metric_name })[0] } | ||
108 | + render :partial => 'content_viewer/metric_history', :locals => {:metric_history => metric_history, :date_history => date_history } | ||
109 | + end | ||
110 | + private | ||
111 | + | ||
112 | + def new_metric_configuration_instance | ||
113 | + metric_configuration = Kalibro::Entities::MetricConfiguration.new | ||
114 | + metric_configuration.metric = Kalibro::Entities::NativeMetric.new | ||
115 | + assign_metric_configuration_instance (metric_configuration) | ||
116 | + end | ||
117 | + | ||
118 | + def assign_metric_configuration_instance (metric_configuration) | ||
119 | + metric_configuration.metric.name = params[:metric][:name] | ||
120 | + metric_configuration.metric.description = params[:description] | ||
121 | + metric_configuration.metric.origin = params[:metric][:origin] | ||
122 | + metric_configuration.metric.scope = params[:scope] | ||
123 | + metric_configuration.metric.language = params[:language] | ||
124 | + metric_configuration.code = params[:metric_configuration][:code] | ||
125 | + metric_configuration.weight = params[:metric_configuration][:weight] | ||
126 | + metric_configuration.aggregation_form = params[:metric_configuration][:aggregation_form] | ||
127 | + metric_configuration | ||
128 | + end | ||
129 | + | ||
130 | + def new_range_instance | ||
131 | + range = Kalibro::Entities::Range.new | ||
132 | + range.beginning = params[:range][:beginning] | ||
133 | + range.end = params[:range][:end] | ||
134 | + range.label = params[:range][:label] | ||
135 | + range.grade = params[:range][:grade] | ||
136 | + range.color = params[:range][:color] | ||
137 | + range.comments = params[:range][:comments] | ||
138 | + range | ||
139 | + end | ||
140 | + | ||
141 | +end |
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
@@ -39,139 +39,5 @@ class MezuroPluginProfileController < ProfileController | @@ -39,139 +39,5 @@ class MezuroPluginProfileController < ProfileController | ||
39 | source_tree = project_result.node_of(params[:module_name]) | 39 | source_tree = project_result.node_of(params[:module_name]) |
40 | render :partial =>'content_viewer/source_tree', :locals => { :source_tree => source_tree, :project_name => content.project.name} | 40 | render :partial =>'content_viewer/source_tree', :locals => { :source_tree => source_tree, :project_name => content.project.name} |
41 | end | 41 | end |
42 | - def choose_base_tool | ||
43 | - @configuration_name = params[:configuration_name] | ||
44 | - @tool_names = Kalibro::Client::BaseToolClient.new | ||
45 | - end | ||
46 | - | ||
47 | - def choose_metric | ||
48 | - @configuration_name = params[:configuration_name] | ||
49 | - @collector_name = params[:collector_name] | ||
50 | - @collector = Kalibro::Client::BaseToolClient.new.base_tool(@collector_name) | ||
51 | - end | ||
52 | - def new_metric_configuration | ||
53 | - metric_name = params[:metric_name] | ||
54 | - collector_name = params[:collector_name] | ||
55 | - collector = Kalibro::Client::BaseToolClient.new.base_tool(collector_name) | ||
56 | - @metric = collector.supported_metrics.find {|metric| metric.name == metric_name} | ||
57 | - @configuration_name = params[:configuration_name] | ||
58 | - end | ||
59 | - def edit_metric_configuration | ||
60 | - metric_name = params[:metric_name] | ||
61 | - @configuration_name = params[:configuration_name] | ||
62 | - @metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | ||
63 | - @metric = @metric_configuration.metric | ||
64 | - end | ||
65 | - def create_metric_configuration | ||
66 | - @configuration_name = params[:configuration_name] | ||
67 | - metric_configuration = new_metric_configuration_instance | ||
68 | - Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) | ||
69 | - redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | ||
70 | - end | ||
71 | - | ||
72 | - def update_metric_configuration | ||
73 | - @configuration_name = params[:configuration_name] | ||
74 | - metric_name = params[:metric][:name] | ||
75 | - metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | ||
76 | - assign_metric_configuration_instance (metric_configuration) | ||
77 | - Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) | ||
78 | - redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | ||
79 | - end | ||
80 | 42 | ||
81 | - def new_range | ||
82 | - @metric_name = params[:metric_name] | ||
83 | - @configuration_name = params[:configuration_name] | ||
84 | - end | ||
85 | - | ||
86 | - def edit_range | ||
87 | - @metric_name = params[:metric_name] | ||
88 | - @configuration_name = params[:configuration_name] | ||
89 | - @beginning_id = params[:beginning_id] | ||
90 | - | ||
91 | - metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | ||
92 | - metric_configuration = metric_configuration_client.metric_configuration(@configuration_name, @metric_name) | ||
93 | - @range = metric_configuration.ranges.find{ |range| range.beginning == @beginning_id.to_f } | ||
94 | - end | ||
95 | - | ||
96 | - def create_range | ||
97 | - @range = new_range_instance | ||
98 | - configuration_name = params[:configuration_name] | ||
99 | - metric_name = params[:metric_name] | ||
100 | - beginning_id = params[:beginning_id] | ||
101 | - metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | ||
102 | - metric_configuration = metric_configuration_client.metric_configuration(configuration_name, metric_name) | ||
103 | - metric_configuration.add_range(@range) | ||
104 | - metric_configuration_client.save(metric_configuration, configuration_name) | ||
105 | - end | ||
106 | - | ||
107 | - def update_range | ||
108 | - metric_name = params[:metric_name] | ||
109 | - configuration_name = params[:configuration_name] | ||
110 | - beginning_id = params[:beginning_id] | ||
111 | - metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | ||
112 | - metric_configuration = metric_configuration_client.metric_configuration(configuration_name, metric_name) | ||
113 | - index = metric_configuration.ranges.index{ |range| range.beginning == beginning_id.to_f } | ||
114 | - metric_configuration.ranges[index] = new_range_instance | ||
115 | - Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, configuration_name) | ||
116 | - end | ||
117 | - | ||
118 | - def remove_range | ||
119 | - configuration_name = params[:configuration_name] | ||
120 | - metric_name = params[:metric_name] | ||
121 | - beginning_id = params[:range_beginning] | ||
122 | - metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | ||
123 | - metric_configuration = metric_configuration_client.metric_configuration(configuration_name, metric_name) | ||
124 | - metric_configuration.ranges.delete_if { |range| range.beginning == beginning_id.to_f }.inspect | ||
125 | - Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, configuration_name) | ||
126 | - formatted_configuration_name = configuration_name.gsub(/\s/, '+') | ||
127 | - formatted_metric_name = metric_name.gsub(/\s/, '+') | ||
128 | - redirect_to "/profile/#{profile.identifier}/plugins/mezuro/edit_metric_configuration?configuration_name=#{formatted_configuration_name}&metric_name=#{formatted_metric_name}" | ||
129 | - end | ||
130 | - | ||
131 | - def remove_metric_configuration | ||
132 | - configuration_name = params[:configuration_name] | ||
133 | - metric_name = params[:metric_name] | ||
134 | - Kalibro::Client::MetricConfigurationClient.new.remove(configuration_name, metric_name) | ||
135 | - redirect_to "/#{profile.identifier}/#{configuration_name.downcase.gsub(/\s/, '-')}" | ||
136 | - end | ||
137 | - | ||
138 | - def module_metrics_history | ||
139 | - metric_name = params[:metric_name] | ||
140 | - content = profile.articles.find(params[:id]) | ||
141 | - module_history = content.result_history(params[:module_name]) | ||
142 | - date_history = module_history.collect { |x| x.date } | ||
143 | - metric_history = module_history.collect { |x| (x.metric_results.select { |y| y.metric.name.delete("() ") == metric_name })[0] } | ||
144 | - render :partial => 'content_viewer/metric_history', :locals => {:metric_history => metric_history, :date_history => date_history } | ||
145 | - end | ||
146 | - private | ||
147 | - | ||
148 | - def new_metric_configuration_instance | ||
149 | - metric_configuration = Kalibro::Entities::MetricConfiguration.new | ||
150 | - metric_configuration.metric = Kalibro::Entities::NativeMetric.new | ||
151 | - assign_metric_configuration_instance (metric_configuration) | ||
152 | - end | ||
153 | - | ||
154 | - def assign_metric_configuration_instance (metric_configuration) | ||
155 | - metric_configuration.metric.name = params[:metric][:name] | ||
156 | - metric_configuration.metric.description = params[:description] | ||
157 | - metric_configuration.metric.origin = params[:metric][:origin] | ||
158 | - metric_configuration.metric.scope = params[:scope] | ||
159 | - metric_configuration.metric.language = params[:language] | ||
160 | - metric_configuration.code = params[:metric_configuration][:code] | ||
161 | - metric_configuration.weight = params[:metric_configuration][:weight] | ||
162 | - metric_configuration.aggregation_form = params[:metric_configuration][:aggregation_form] | ||
163 | - metric_configuration | ||
164 | - end | ||
165 | - | ||
166 | - def new_range_instance | ||
167 | - range = Kalibro::Entities::Range.new | ||
168 | - range.beginning = params[:range][:beginning] | ||
169 | - range.end = params[:range][:end] | ||
170 | - range.label = params[:range][:label] | ||
171 | - range.grade = params[:range][:grade] | ||
172 | - range.color = params[:range][:color] | ||
173 | - range.comments = params[:range][:comments] | ||
174 | - range | ||
175 | - end | ||
176 | - | ||
177 | end | 43 | end |
plugins/mezuro/test/functional/mezuro_plugin_myprofile_controller_test.rb
0 → 100644
@@ -0,0 +1,108 @@ | @@ -0,0 +1,108 @@ | ||
1 | +require 'test_helper' | ||
2 | + | ||
3 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/error_fixtures" | ||
4 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/base_tool_fixtures" | ||
5 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/native_metric_fixtures" | ||
6 | +require "#{RAILS_ROOT}/plugins/mezuro/test/fixtures/metric_configuration_fixtures" | ||
7 | + | ||
8 | +class MezuroPluginMyprofileControllerTest < ActionController::TestCase | ||
9 | + | ||
10 | + def setup | ||
11 | + @controller = MezuroPluginMyprofileController.new | ||
12 | + @request = ActionController::TestRequest.new | ||
13 | + @response = ActionController::TestResponse.new | ||
14 | + @profile = fast_create(Community) | ||
15 | + | ||
16 | + @collector = BaseToolFixtures.analizo | ||
17 | + @base_tool_client = Kalibro::Client::BaseToolClient.new | ||
18 | + @metric = NativeMetricFixtures.amloc | ||
19 | + @metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | ||
20 | + @metric_configuration = MetricConfigurationFixtures.amloc_configuration | ||
21 | + end | ||
22 | + | ||
23 | + should 'assign configuration name in choose_base_tool' do | ||
24 | + get :choose_base_tool, :profile => @profile.identifier, :configuration_name => "test name" | ||
25 | + assert_equal assigns(:configuration_name), "test name" | ||
26 | + end | ||
27 | + | ||
28 | + should 'create base tool client' do | ||
29 | + get :choose_base_tool, :profile => @profile.identifier, :configuration_name => "test name" | ||
30 | + assert assigns(:tool_names).instance_of?(Kalibro::Client::BaseToolClient) | ||
31 | + end | ||
32 | + | ||
33 | + should 'assign configuration and collector name in choose_metric' do | ||
34 | + Kalibro::Client::BaseToolClient.expects(:new).returns(@base_tool_client) | ||
35 | + @base_tool_client.expects(:base_tool).with(@collector.name).returns(@collector) | ||
36 | + get :choose_metric, :profile => @profile.identifier, :configuration_name => "test name", :collector_name => "Analizo" | ||
37 | + assert_equal assigns(:configuration_name), "test name" | ||
38 | + assert_equal assigns(:collector_name), "Analizo" | ||
39 | + end | ||
40 | + | ||
41 | + should 'get collector by name' do | ||
42 | + Kalibro::Client::BaseToolClient.expects(:new).returns(@base_tool_client) | ||
43 | + @base_tool_client.expects(:base_tool).with(@collector.name).returns(@collector) | ||
44 | + get :choose_metric, :profile => @profile.identifier, :configuration_name => "test name", :collector_name => "Analizo" | ||
45 | + assert_equal assigns(:collector), @collector | ||
46 | + end | ||
47 | + | ||
48 | + should 'get choosed native metric and configuration name' do | ||
49 | + Kalibro::Client::BaseToolClient.expects(:new).returns(@base_tool_client) | ||
50 | + @base_tool_client.expects(:base_tool).with(@collector.name).returns(@collector) | ||
51 | + get :new_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :collector_name => "Analizo", :metric_name => @metric.name | ||
52 | + assert_equal assigns(:configuration_name), "test name" | ||
53 | + assert_equal assigns(:metric), @metric | ||
54 | + end | ||
55 | + | ||
56 | + should 'assign configuration name and get metric_configuration' do | ||
57 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | ||
58 | + @metric_configuration_client.expects(:metric_configuration).with("test name", @metric.name).returns(@metric_configuration) | ||
59 | + get :edit_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => @metric.name | ||
60 | + assert_equal assigns(:configuration_name), "test name" | ||
61 | + assert_equal assigns(:metric_configuration), @metric_configuration | ||
62 | + assert_equal assigns(:metric), @metric_configuration.metric | ||
63 | + end | ||
64 | + | ||
65 | + should 'test metric creation' do | ||
66 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | ||
67 | + @metric_configuration_client.expects(:save) | ||
68 | + get :create_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :description => @metric.description, | ||
69 | + :scope => @metric.scope, :language => @metric.language, :metric => { :name => @metric.name, :origin => @metric.origin}, | ||
70 | + :metric_configuration => { :code => @metric_configuration.code, :weight => @metric_configuration.code, :aggregation => @metric_configuration.aggregation_form } | ||
71 | + assert_equal assigns(:configuration_name), "test name" | ||
72 | + assert_response 302 | ||
73 | + end | ||
74 | + | ||
75 | + should 'test metric edition' do | ||
76 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | ||
77 | + @metric_configuration_client.expects(:save) | ||
78 | + get :create_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :description => @metric.description, | ||
79 | + :scope => @metric.scope, :language => @metric.language, :metric => { :name => @metric.name, :origin => @metric.origin}, | ||
80 | + :metric_configuration => { :code => @metric_configuration.code, :weight => @metric_configuration.code, :aggregation => @metric_configuration.aggregation_form } | ||
81 | + assert_equal assigns(:configuration_name), "test name" | ||
82 | + assert_response 302 | ||
83 | + end | ||
84 | + | ||
85 | + should 'assign configuration name and metric name to new range' do | ||
86 | + get :new_range, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => @metric.name | ||
87 | + assert_equal assigns(:configuration_name), "test name" | ||
88 | + assert_equal assigns(:metric_name), @metric.name | ||
89 | + end | ||
90 | + | ||
91 | + should 'create instance range' do | ||
92 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | ||
93 | + @metric_configuration_client.expects(:metric_configuration).with("test name", @metric.name).returns(@metric_configuration) | ||
94 | + @metric_configuration_client.expects(:save) | ||
95 | + range = @metric_configuration.ranges[0] | ||
96 | + get :create_range, :profile => @profile.identifier, :range => { :beginning => range.beginning, :end => range.end, :label => range.label, | ||
97 | + :grade => range.grade, :color => range.color, :comments => range.comments }, :configuration_name => "test name", :metric_name => @metric.name | ||
98 | + assert assigns(:range).instance_of?(Kalibro::Entities::Range) | ||
99 | + end | ||
100 | + | ||
101 | + should 'redirect from remove metric configuration' do | ||
102 | + Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | ||
103 | + @metric_configuration_client.expects(:remove) | ||
104 | + get :remove_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => @metric.name | ||
105 | + assert_response 302 | ||
106 | + end | ||
107 | + | ||
108 | +end |
plugins/mezuro/test/functional/mezuro_plugin_profile_controller_test.rb
@@ -20,13 +20,7 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -20,13 +20,7 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
20 | @project = @project_result.project | 20 | @project = @project_result.project |
21 | @name = @project.name | 21 | @name = @project.name |
22 | 22 | ||
23 | - @collector = BaseToolFixtures.analizo | ||
24 | - @base_tool_client = Kalibro::Client::BaseToolClient.new | ||
25 | - @metric = NativeMetricFixtures.amloc | ||
26 | - @metric_configuration_client = Kalibro::Client::MetricConfigurationClient.new | ||
27 | - @metric_configuration = MetricConfigurationFixtures.amloc_configuration | ||
28 | - | ||
29 | - @date = "2012-04-13T20:39:41+04:00" | 23 | + @date = "2012-04-13T20:39:41+04:00" |
30 | end | 24 | end |
31 | 25 | ||
32 | should 'not find module result for inexistent project content' do | 26 | should 'not find module result for inexistent project content' do |
@@ -89,91 +83,6 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | @@ -89,91 +83,6 @@ class MezuroPluginProfileControllerTest < ActionController::TestCase | ||
89 | assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') | 83 | assert_select('h5', 'Metric results for: Qt-Calculator (APPLICATION)') |
90 | end | 84 | end |
91 | 85 | ||
92 | - should 'assign configuration name in choose_base_tool' do | ||
93 | - get :choose_base_tool, :profile => @profile.identifier, :configuration_name => "test name" | ||
94 | - assert_equal assigns(:configuration_name), "test name" | ||
95 | - end | ||
96 | - | ||
97 | - should 'create base tool client' do | ||
98 | - get :choose_base_tool, :profile => @profile.identifier, :configuration_name => "test name" | ||
99 | - assert assigns(:tool_names).instance_of?(Kalibro::Client::BaseToolClient) | ||
100 | - end | ||
101 | - | ||
102 | - should 'assign configuration and collector name in choose_metric' do | ||
103 | - Kalibro::Client::BaseToolClient.expects(:new).returns(@base_tool_client) | ||
104 | - @base_tool_client.expects(:base_tool).with(@collector.name).returns(@collector) | ||
105 | - get :choose_metric, :profile => @profile.identifier, :configuration_name => "test name", :collector_name => "Analizo" | ||
106 | - assert_equal assigns(:configuration_name), "test name" | ||
107 | - assert_equal assigns(:collector_name), "Analizo" | ||
108 | - end | ||
109 | - | ||
110 | - should 'get collector by name' do | ||
111 | - Kalibro::Client::BaseToolClient.expects(:new).returns(@base_tool_client) | ||
112 | - @base_tool_client.expects(:base_tool).with(@collector.name).returns(@collector) | ||
113 | - get :choose_metric, :profile => @profile.identifier, :configuration_name => "test name", :collector_name => "Analizo" | ||
114 | - assert_equal assigns(:collector), @collector | ||
115 | - end | ||
116 | - | ||
117 | - should 'get choosed native metric and configuration name' do | ||
118 | - Kalibro::Client::BaseToolClient.expects(:new).returns(@base_tool_client) | ||
119 | - @base_tool_client.expects(:base_tool).with(@collector.name).returns(@collector) | ||
120 | - get :new_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :collector_name => "Analizo", :metric_name => @metric.name | ||
121 | - assert_equal assigns(:configuration_name), "test name" | ||
122 | - assert_equal assigns(:metric), @metric | ||
123 | - end | ||
124 | - | ||
125 | - should 'assign configuration name and get metric_configuration' do | ||
126 | - Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | ||
127 | - @metric_configuration_client.expects(:metric_configuration).with("test name", @metric.name).returns(@metric_configuration) | ||
128 | - get :edit_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => @metric.name | ||
129 | - assert_equal assigns(:configuration_name), "test name" | ||
130 | - assert_equal assigns(:metric_configuration), @metric_configuration | ||
131 | - assert_equal assigns(:metric), @metric_configuration.metric | ||
132 | - end | ||
133 | - | ||
134 | - should 'test metric creation' do | ||
135 | - Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | ||
136 | - @metric_configuration_client.expects(:save) | ||
137 | - get :create_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :description => @metric.description, | ||
138 | - :scope => @metric.scope, :language => @metric.language, :metric => { :name => @metric.name, :origin => @metric.origin}, | ||
139 | - :metric_configuration => { :code => @metric_configuration.code, :weight => @metric_configuration.code, :aggregation => @metric_configuration.aggregation_form } | ||
140 | - assert_equal assigns(:configuration_name), "test name" | ||
141 | - assert_response 302 | ||
142 | - end | ||
143 | - | ||
144 | - should 'test metric edition' do | ||
145 | - Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | ||
146 | - @metric_configuration_client.expects(:save) | ||
147 | - get :create_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :description => @metric.description, | ||
148 | - :scope => @metric.scope, :language => @metric.language, :metric => { :name => @metric.name, :origin => @metric.origin}, | ||
149 | - :metric_configuration => { :code => @metric_configuration.code, :weight => @metric_configuration.code, :aggregation => @metric_configuration.aggregation_form } | ||
150 | - assert_equal assigns(:configuration_name), "test name" | ||
151 | - assert_response 302 | ||
152 | - end | ||
153 | - | ||
154 | - should 'assign configuration name and metric name to new range' do | ||
155 | - get :new_range, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => @metric.name | ||
156 | - assert_equal assigns(:configuration_name), "test name" | ||
157 | - assert_equal assigns(:metric_name), @metric.name | ||
158 | - end | ||
159 | - | ||
160 | - should 'create instance range' do | ||
161 | - Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | ||
162 | - @metric_configuration_client.expects(:metric_configuration).with("test name", @metric.name).returns(@metric_configuration) | ||
163 | - @metric_configuration_client.expects(:save) | ||
164 | - range = @metric_configuration.ranges[0] | ||
165 | - get :create_range, :profile => @profile.identifier, :range => { :beginning => range.beginning, :end => range.end, :label => range.label, | ||
166 | - :grade => range.grade, :color => range.color, :comments => range.comments }, :configuration_name => "test name", :metric_name => @metric.name | ||
167 | - assert assigns(:range).instance_of?(Kalibro::Entities::Range) | ||
168 | - end | ||
169 | - | ||
170 | - should 'redirect from remove metric configuration' do | ||
171 | - Kalibro::Client::MetricConfigurationClient.expects(:new).returns(@metric_configuration_client) | ||
172 | - @metric_configuration_client.expects(:remove) | ||
173 | - get :remove_metric_configuration, :profile => @profile.identifier, :configuration_name => "test name", :metric_name => @metric.name | ||
174 | - assert_response 302 | ||
175 | - end | ||
176 | - | ||
177 | private | 86 | private |
178 | 87 | ||
179 | def create_project_content | 88 | def create_project_content |
plugins/mezuro/views/content_viewer/show_configuration.rhtml
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | 14 | ||
15 | <br/> | 15 | <br/> |
16 | 16 | ||
17 | -<%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_profile", | 17 | +<%= link_to "#{image_tag ('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_myprofile", |
18 | :action => "choose_base_tool", :params => {:configuration_name => @configuration.name} %><br/> | 18 | :action => "choose_base_tool", :params => {:configuration_name => @configuration.name} %><br/> |
19 | 19 | ||
20 | <table> | 20 | <table> |
@@ -28,9 +28,9 @@ | @@ -28,9 +28,9 @@ | ||
28 | <td><%= metric_configuration.metric.name %></td> | 28 | <td><%= metric_configuration.metric.name %></td> |
29 | <td><%= metric_configuration.metric.origin %></td> | 29 | <td><%= metric_configuration.metric.origin %></td> |
30 | <td><%= metric_configuration.code %></td> | 30 | <td><%= metric_configuration.code %></td> |
31 | - <td><%= link_to "Edit", :controller => "mezuro_plugin_profile", :action => "edit_metric_configuration", :params => | 31 | + <td><%= link_to "Edit", :controller => "mezuro_plugin_myprofile", :action => "edit_metric_configuration", :params => |
32 | {:configuration_name => @configuration.name, :metric_name => metric_configuration.metric.name} %></td> | 32 | {:configuration_name => @configuration.name, :metric_name => metric_configuration.metric.name} %></td> |
33 | - <td><%= link_to "Remove", :controller => "mezuro_plugin_profile", :action => "remove_metric_configuration", :params => | 33 | + <td><%= link_to "Remove", :controller => "mezuro_plugin_myprofile", :action => "remove_metric_configuration", :params => |
34 | {:configuration_name => @configuration.name, :metric_name => metric_configuration.metric.name} %></td> | 34 | {:configuration_name => @configuration.name, :metric_name => metric_configuration.metric.name} %></td> |
35 | </tr> | 35 | </tr> |
36 | <% end %> | 36 | <% end %> |
plugins/mezuro/views/mezuro_plugin_myprofile/_edit_range.html.erb
0 → 100644
@@ -0,0 +1,4 @@ | @@ -0,0 +1,4 @@ | ||
1 | +<% remote_form_for :range, :url => {:action =>"update_range", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | ||
2 | + <%= hidden_field_tag :beginning_id, beginning_id %> | ||
3 | + <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :configuration_name => configuration_name, :beginning_id => beginning_id, :range => range } %> | ||
4 | +<% end %> |
plugins/mezuro/views/mezuro_plugin_myprofile/_new_range.html.erb
0 → 100644
@@ -0,0 +1,3 @@ | @@ -0,0 +1,3 @@ | ||
1 | +<% remote_form_for :range, :url => {:action =>"create_range", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | ||
2 | + <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :configuration_name => configuration_name } %> | ||
3 | +<% end %> |
plugins/mezuro/views/mezuro_plugin_myprofile/_range.html.erb
0 → 100644
@@ -0,0 +1,17 @@ | @@ -0,0 +1,17 @@ | ||
1 | +<tr> | ||
2 | + <td> | ||
3 | + <%=range.label%> | ||
4 | + </td> | ||
5 | + <td> | ||
6 | + <%=range.beginning%> | ||
7 | + </td> | ||
8 | + <td> | ||
9 | + <%=range.end%> | ||
10 | + </td> | ||
11 | + <td> | ||
12 | + <%=range.grade%> | ||
13 | + </td> | ||
14 | + <td bgcolor="#<%= range.color[2..-1] %>"></td> | ||
15 | + <td><%= link_to_remote "Edit", :url => {:action =>"edit_range", :controller => "mezuro_plugin_myprofile", :configuration_name => params[:configuration_name], :metric_name => params[:metric_name], :beginning_id => range.beginning} %></td> | ||
16 | + <td><%= link_to "Remove", :action =>"remove_range", :controller => "mezuro_plugin_myprofile", :configuration_name => params[:configuration_name], :metric_name => params[:metric_name], :range_beginning => range.beginning %></td> | ||
17 | +</tr> |
plugins/mezuro/views/mezuro_plugin_myprofile/_range_form.html.erb
0 → 100644
@@ -0,0 +1,53 @@ | @@ -0,0 +1,53 @@ | ||
1 | +<%= hidden_field_tag :configuration_name, configuration_name %> | ||
2 | +<%= hidden_field_tag :metric_name, metric_name %> | ||
3 | +<table> | ||
4 | + <tr> | ||
5 | + <td> | ||
6 | + <%= f.label :label, "Label:" %> | ||
7 | + </td> | ||
8 | + <td> | ||
9 | + <%= f.text_field :label %> | ||
10 | + </td> | ||
11 | + </tr> | ||
12 | + <tr> | ||
13 | + <td> | ||
14 | + <%= f.label :beginning, "Beginning:" %> | ||
15 | + </td> | ||
16 | + <td> | ||
17 | + <%= f.text_field :beginning %> | ||
18 | + </td> | ||
19 | + </tr> | ||
20 | + <tr> | ||
21 | + <td> | ||
22 | + <%= f.label :end, "End:" %> | ||
23 | + </td> | ||
24 | + <td> | ||
25 | + <%= f.text_field :end %> | ||
26 | + </td> | ||
27 | + </tr> | ||
28 | + <tr> | ||
29 | + <td> | ||
30 | + <%= f.label :grade, "Grade:" %> | ||
31 | + </td> | ||
32 | + <td> | ||
33 | + <%= f.text_field :grade %> | ||
34 | + </td> | ||
35 | + </tr> | ||
36 | + <tr> | ||
37 | + <td> | ||
38 | + <%= f.label :color, "Color:" %> | ||
39 | + </td> | ||
40 | + <td> | ||
41 | + <%= f.text_field :color %> | ||
42 | + </td> | ||
43 | + </tr> | ||
44 | + <tr> | ||
45 | + <td> | ||
46 | + <%= f.label :comments, "Comments:" %> | ||
47 | + </td> | ||
48 | + <td> | ||
49 | + <%= f.text_field :comments %> | ||
50 | + </td> | ||
51 | + </tr> | ||
52 | +</table> | ||
53 | +<%= f.submit "Save Range" %> |
plugins/mezuro/views/mezuro_plugin_myprofile/choose_base_tool.html.erb
0 → 100644
@@ -0,0 +1,13 @@ | @@ -0,0 +1,13 @@ | ||
1 | +<h2><%= @configuration_name%> Configuration</h2> | ||
2 | + | ||
3 | +<h5>Base Tools:</h5> | ||
4 | +<table id="project_info"> | ||
5 | + <% @tool_names.base_tool_names.each do |collector_name| %> | ||
6 | + <tr> | ||
7 | + <td> | ||
8 | + <%= link_to collector_name, :controller => "mezuro_plugin_myprofile", :action => "choose_metric", :params => | ||
9 | + {:configuration_name => @configuration_name, :collector_name => collector_name} %> | ||
10 | + </td> | ||
11 | + </tr> | ||
12 | + <% end %> | ||
13 | +</table> |
plugins/mezuro/views/mezuro_plugin_myprofile/choose_metric.html.erb
0 → 100644
@@ -0,0 +1,18 @@ | @@ -0,0 +1,18 @@ | ||
1 | +<h2><%= @configuration_name %> Configuration</h2> | ||
2 | + | ||
3 | +<table id="project_info"> | ||
4 | + <tr> | ||
5 | + <h5>Metric Collector: <%= @collector_name %></h5> | ||
6 | + </tr> | ||
7 | + <tr> | ||
8 | + <h5>Choose a metric to add:</h5> | ||
9 | + </tr> | ||
10 | + <% @collector.supported_metrics.each do |metric| %> | ||
11 | + <tr class="metric" title="<%= metric.name %>"> | ||
12 | + <td> | ||
13 | + <%= link_to metric.name, :controller => "mezuro_plugin_myprofile", :action => "new_metric_configuration", :params => {:metric_name => metric.name, | ||
14 | + :collector_name => @collector_name, :configuration_name => @configuration_name} %> | ||
15 | + </td> | ||
16 | + </tr> | ||
17 | + <% end %> | ||
18 | +</table> |
plugins/mezuro/views/mezuro_plugin_myprofile/create_range.rjs
0 → 100644
plugins/mezuro/views/mezuro_plugin_myprofile/edit_metric_configuration.html.erb
0 → 100644
@@ -0,0 +1,78 @@ | @@ -0,0 +1,78 @@ | ||
1 | +<h2><%= @configuration_name %> Configuration</h2> | ||
2 | + | ||
3 | +<% form_for :metric_configuration, :url => {:action =>"update_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | ||
4 | + <%= hidden_field_tag :configuration_name, @configuration_name %> | ||
5 | + <%= hidden_field_tag :scope, @metric.scope %> | ||
6 | + | ||
7 | + <% @metric.language.each do |language| %> | ||
8 | + <%= hidden_field_tag "language[]", language %> | ||
9 | + <% end %> | ||
10 | + | ||
11 | + <p> | ||
12 | + <%= f.label :origin, "Collector Name:" %> | ||
13 | + <%= @metric.origin %> | ||
14 | + <%= hidden_field_tag "metric[origin]", @metric.origin %> | ||
15 | + </p> | ||
16 | + <p> | ||
17 | + <%= f.label :metric_name, "Metric Name:" %> | ||
18 | + <%= @metric.name %> | ||
19 | + <%= hidden_field_tag "metric[name]", @metric.name %> | ||
20 | + </p> | ||
21 | + <p> | ||
22 | + <%= f.label :description, "Description:" %> | ||
23 | + <%= @metric.description %> | ||
24 | + <%= text_field_tag "metric[description]", @metric.description %> | ||
25 | + </p> | ||
26 | + <p> | ||
27 | + <%= f.label :code, "Code:" %> | ||
28 | + <%= @metric_configuration.code %> | ||
29 | + <%= f.hidden_field :code, :value => @metric_configuration.code %> | ||
30 | + </p> | ||
31 | + <p> | ||
32 | + <%= f.label :aggregation_form, "Aggregation Form:" %> | ||
33 | + <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
34 | + ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | ||
35 | + </p> | ||
36 | + <p> | ||
37 | + <%= f.label :weight, "Weight:" %> | ||
38 | + <%= f.text_field :weight %> | ||
39 | + </p> | ||
40 | + | ||
41 | + <p> | ||
42 | + <%= f.submit "Save" %> | ||
43 | + </p> | ||
44 | +<% end %> | ||
45 | + | ||
46 | + | ||
47 | +<h5> Ranges </h5><br/> | ||
48 | + | ||
49 | +<table id="ranges"> | ||
50 | + <tr> | ||
51 | + <td> | ||
52 | + Label | ||
53 | + </td> | ||
54 | + <td> | ||
55 | + Beginning | ||
56 | + </td> | ||
57 | + <td> | ||
58 | + End | ||
59 | + </td> | ||
60 | + <td> | ||
61 | + Grade | ||
62 | + </td> | ||
63 | + <td> | ||
64 | + Color | ||
65 | + </td> | ||
66 | + </tr> | ||
67 | + <% if (@metric_configuration.ranges!=nil) | ||
68 | + @metric_configuration.ranges.each do |range| %> | ||
69 | + <%= render :partial => "range", :locals => {:range => range, :configuration_name => @configuration_name, | ||
70 | + :metric_name => @metric_configuration.metric.name} %> | ||
71 | + <% end | ||
72 | + end %> | ||
73 | +</table> | ||
74 | + | ||
75 | +<br/> | ||
76 | +<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_myprofile", :configuration_name => @configuration_name, :metric_name => @metric.name} %> | ||
77 | +<div id="range_form" style="display:none"></div> | ||
78 | + |
plugins/mezuro/views/mezuro_plugin_myprofile/edit_range.rjs
0 → 100644
plugins/mezuro/views/mezuro_plugin_myprofile/new_metric_configuration.html.erb
0 → 100644
@@ -0,0 +1,44 @@ | @@ -0,0 +1,44 @@ | ||
1 | +<h2><%= @configuration_name %> Configuration</h2> | ||
2 | + | ||
3 | +<% form_for :metric_configuration, :url => {:action =>"create_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | ||
4 | + <%= hidden_field_tag :configuration_name, @configuration_name %> | ||
5 | + <%= hidden_field_tag :scope, @metric.scope %> | ||
6 | + | ||
7 | + <% @metric.language.each do |language| %> | ||
8 | + <%= hidden_field_tag "language[]", language %> | ||
9 | + <% end %> | ||
10 | + | ||
11 | + <p> | ||
12 | + <%= f.label :origin, "Collector Name:" %> | ||
13 | + <%= @metric.origin %> | ||
14 | + <%= hidden_field_tag "metric[origin]", @metric.origin %> | ||
15 | + </p> | ||
16 | + <p> | ||
17 | + <%= f.label :metric_name, "Metric Name:" %> | ||
18 | + <%= @metric.name %> | ||
19 | + <%= hidden_field_tag "metric[name]", @metric.name %> | ||
20 | + </p> | ||
21 | + <p> | ||
22 | + <%= f.label :description, "Description:" %> | ||
23 | + <%= @metric.description %> | ||
24 | + <%= text_field_tag :description %> | ||
25 | + </p> | ||
26 | + <p> | ||
27 | + <%= f.label :code, "Code:" %> | ||
28 | + <%= f.text_field :code %> | ||
29 | + </p> | ||
30 | + <p> | ||
31 | + <%= f.label :aggregation_form, "Aggregation:" %> | ||
32 | + <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
33 | + ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | ||
34 | + </p> | ||
35 | + <p> | ||
36 | + <%= f.label :weight, "Weight:" %> | ||
37 | + <%= f.text_field :weight %> | ||
38 | + </p> | ||
39 | + | ||
40 | + <p> | ||
41 | + <%= f.submit "Add" %> | ||
42 | + </p> | ||
43 | + | ||
44 | +<% end %> |
plugins/mezuro/views/mezuro_plugin_myprofile/new_range.rjs
0 → 100644
plugins/mezuro/views/mezuro_plugin_myprofile/update_range.rjs
0 → 100644
@@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
1 | +page.reload() |
plugins/mezuro/views/mezuro_plugin_profile/_edit_range.html.erb
@@ -1,4 +0,0 @@ | @@ -1,4 +0,0 @@ | ||
1 | -<% remote_form_for :range, :url => {:action =>"update_range", :controller => "mezuro_plugin_profile"}, :method => :get do |f| %> | ||
2 | - <%= hidden_field_tag :beginning_id, beginning_id %> | ||
3 | - <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :configuration_name => configuration_name, :beginning_id => beginning_id, :range => range } %> | ||
4 | -<% end %> |
plugins/mezuro/views/mezuro_plugin_profile/_new_range.html.erb
@@ -1,3 +0,0 @@ | @@ -1,3 +0,0 @@ | ||
1 | -<% remote_form_for :range, :url => {:action =>"create_range", :controller => "mezuro_plugin_profile"}, :method => :get do |f| %> | ||
2 | - <%= render :partial => "range_form", :locals => {:f => f, :metric_name => metric_name, :configuration_name => configuration_name } %> | ||
3 | -<% end %> |
plugins/mezuro/views/mezuro_plugin_profile/_range.html.erb
@@ -1,17 +0,0 @@ | @@ -1,17 +0,0 @@ | ||
1 | -<tr> | ||
2 | - <td> | ||
3 | - <%=range.label%> | ||
4 | - </td> | ||
5 | - <td> | ||
6 | - <%=range.beginning%> | ||
7 | - </td> | ||
8 | - <td> | ||
9 | - <%=range.end%> | ||
10 | - </td> | ||
11 | - <td> | ||
12 | - <%=range.grade%> | ||
13 | - </td> | ||
14 | - <td bgcolor="#<%= range.color[2..-1] %>"></td> | ||
15 | - <td><%= link_to_remote "Edit", :url => {:action =>"edit_range", :controller => "mezuro_plugin_profile", :configuration_name => params[:configuration_name], :metric_name => params[:metric_name], :beginning_id => range.beginning} %></td> | ||
16 | - <td><%= link_to "Remove", :action =>"remove_range", :controller => "mezuro_plugin_profile", :configuration_name => params[:configuration_name], :metric_name => params[:metric_name], :range_beginning => range.beginning %></td> | ||
17 | -</tr> |
plugins/mezuro/views/mezuro_plugin_profile/_range_form.html.erb
@@ -1,53 +0,0 @@ | @@ -1,53 +0,0 @@ | ||
1 | -<%= hidden_field_tag :configuration_name, configuration_name %> | ||
2 | -<%= hidden_field_tag :metric_name, metric_name %> | ||
3 | -<table> | ||
4 | - <tr> | ||
5 | - <td> | ||
6 | - <%= f.label :label, "Label:" %> | ||
7 | - </td> | ||
8 | - <td> | ||
9 | - <%= f.text_field :label %> | ||
10 | - </td> | ||
11 | - </tr> | ||
12 | - <tr> | ||
13 | - <td> | ||
14 | - <%= f.label :beginning, "Beginning:" %> | ||
15 | - </td> | ||
16 | - <td> | ||
17 | - <%= f.text_field :beginning %> | ||
18 | - </td> | ||
19 | - </tr> | ||
20 | - <tr> | ||
21 | - <td> | ||
22 | - <%= f.label :end, "End:" %> | ||
23 | - </td> | ||
24 | - <td> | ||
25 | - <%= f.text_field :end %> | ||
26 | - </td> | ||
27 | - </tr> | ||
28 | - <tr> | ||
29 | - <td> | ||
30 | - <%= f.label :grade, "Grade:" %> | ||
31 | - </td> | ||
32 | - <td> | ||
33 | - <%= f.text_field :grade %> | ||
34 | - </td> | ||
35 | - </tr> | ||
36 | - <tr> | ||
37 | - <td> | ||
38 | - <%= f.label :color, "Color:" %> | ||
39 | - </td> | ||
40 | - <td> | ||
41 | - <%= f.text_field :color %> | ||
42 | - </td> | ||
43 | - </tr> | ||
44 | - <tr> | ||
45 | - <td> | ||
46 | - <%= f.label :comments, "Comments:" %> | ||
47 | - </td> | ||
48 | - <td> | ||
49 | - <%= f.text_field :comments %> | ||
50 | - </td> | ||
51 | - </tr> | ||
52 | -</table> | ||
53 | -<%= f.submit "Save Range" %> |
plugins/mezuro/views/mezuro_plugin_profile/choose_base_tool.html.erb
@@ -1,13 +0,0 @@ | @@ -1,13 +0,0 @@ | ||
1 | -<h2><%= @configuration_name%> Configuration</h2> | ||
2 | - | ||
3 | -<h5>Base Tools:</h5> | ||
4 | -<table id="project_info"> | ||
5 | - <% @tool_names.base_tool_names.each do |collector_name| %> | ||
6 | - <tr> | ||
7 | - <td> | ||
8 | - <%= link_to collector_name, :controller => "mezuro_plugin_profile", :action => "choose_metric", :params => | ||
9 | - {:configuration_name => @configuration_name, :collector_name => collector_name} %> | ||
10 | - </td> | ||
11 | - </tr> | ||
12 | - <% end %> | ||
13 | -</table> |
plugins/mezuro/views/mezuro_plugin_profile/choose_metric.html.erb
@@ -1,18 +0,0 @@ | @@ -1,18 +0,0 @@ | ||
1 | -<h2><%= @configuration_name %> Configuration</h2> | ||
2 | - | ||
3 | -<table id="project_info"> | ||
4 | - <tr> | ||
5 | - <h5>Metric Collector: <%= @collector_name %></h5> | ||
6 | - </tr> | ||
7 | - <tr> | ||
8 | - <h5>Choose a metric to add:</h5> | ||
9 | - </tr> | ||
10 | - <% @collector.supported_metrics.each do |metric| %> | ||
11 | - <tr class="metric" title="<%= metric.name %>"> | ||
12 | - <td> | ||
13 | - <%= link_to metric.name, :controller => "mezuro_plugin_profile", :action => "new_metric_configuration", :params => {:metric_name => metric.name, | ||
14 | - :collector_name => @collector_name, :configuration_name => @configuration_name} %> | ||
15 | - </td> | ||
16 | - </tr> | ||
17 | - <% end %> | ||
18 | -</table> |
plugins/mezuro/views/mezuro_plugin_profile/create_range.rjs
plugins/mezuro/views/mezuro_plugin_profile/edit_metric_configuration.html.erb
@@ -1,78 +0,0 @@ | @@ -1,78 +0,0 @@ | ||
1 | -<h2><%= @configuration_name %> Configuration</h2> | ||
2 | - | ||
3 | -<% form_for :metric_configuration, :url => {:action =>"update_metric_configuration", :controller => "mezuro_plugin_profile"}, :method => :get do |f| %> | ||
4 | - <%= hidden_field_tag :configuration_name, @configuration_name %> | ||
5 | - <%= hidden_field_tag :scope, @metric.scope %> | ||
6 | - | ||
7 | - <% @metric.language.each do |language| %> | ||
8 | - <%= hidden_field_tag "language[]", language %> | ||
9 | - <% end %> | ||
10 | - | ||
11 | - <p> | ||
12 | - <%= f.label :origin, "Collector Name:" %> | ||
13 | - <%= @metric.origin %> | ||
14 | - <%= hidden_field_tag "metric[origin]", @metric.origin %> | ||
15 | - </p> | ||
16 | - <p> | ||
17 | - <%= f.label :metric_name, "Metric Name:" %> | ||
18 | - <%= @metric.name %> | ||
19 | - <%= hidden_field_tag "metric[name]", @metric.name %> | ||
20 | - </p> | ||
21 | - <p> | ||
22 | - <%= f.label :description, "Description:" %> | ||
23 | - <%= @metric.description %> | ||
24 | - <%= text_field_tag "metric[description]", @metric.description %> | ||
25 | - </p> | ||
26 | - <p> | ||
27 | - <%= f.label :code, "Code:" %> | ||
28 | - <%= @metric_configuration.code %> | ||
29 | - <%= f.hidden_field :code, :value => @metric_configuration.code %> | ||
30 | - </p> | ||
31 | - <p> | ||
32 | - <%= f.label :aggregation_form, "Aggregation Form:" %> | ||
33 | - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
34 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | ||
35 | - </p> | ||
36 | - <p> | ||
37 | - <%= f.label :weight, "Weight:" %> | ||
38 | - <%= f.text_field :weight %> | ||
39 | - </p> | ||
40 | - | ||
41 | - <p> | ||
42 | - <%= f.submit "Save" %> | ||
43 | - </p> | ||
44 | -<% end %> | ||
45 | - | ||
46 | - | ||
47 | -<h5> Ranges </h5><br/> | ||
48 | - | ||
49 | -<table id="ranges"> | ||
50 | - <tr> | ||
51 | - <td> | ||
52 | - Label | ||
53 | - </td> | ||
54 | - <td> | ||
55 | - Beginning | ||
56 | - </td> | ||
57 | - <td> | ||
58 | - End | ||
59 | - </td> | ||
60 | - <td> | ||
61 | - Grade | ||
62 | - </td> | ||
63 | - <td> | ||
64 | - Color | ||
65 | - </td> | ||
66 | - </tr> | ||
67 | - <% if (@metric_configuration.ranges!=nil) | ||
68 | - @metric_configuration.ranges.each do |range| %> | ||
69 | - <%= render :partial => "range", :locals => {:range => range, :configuration_name => @configuration_name, | ||
70 | - :metric_name => @metric_configuration.metric.name} %> | ||
71 | - <% end | ||
72 | - end %> | ||
73 | -</table> | ||
74 | - | ||
75 | -<br/> | ||
76 | -<%= link_to_remote "New Range", :url => {:action =>"new_range", :controller => "mezuro_plugin_profile", :configuration_name => @configuration_name, :metric_name => @metric.name} %> | ||
77 | -<div id="range_form" style="display:none"></div> | ||
78 | - |
plugins/mezuro/views/mezuro_plugin_profile/edit_range.rjs
plugins/mezuro/views/mezuro_plugin_profile/new_metric_configuration.html.erb
@@ -1,44 +0,0 @@ | @@ -1,44 +0,0 @@ | ||
1 | -<h2><%= @configuration_name %> Configuration</h2> | ||
2 | - | ||
3 | -<% form_for :metric_configuration, :url => {:action =>"create_metric_configuration", :controller => "mezuro_plugin_profile"}, :method => :get do |f| %> | ||
4 | - <%= hidden_field_tag :configuration_name, @configuration_name %> | ||
5 | - <%= hidden_field_tag :scope, @metric.scope %> | ||
6 | - | ||
7 | - <% @metric.language.each do |language| %> | ||
8 | - <%= hidden_field_tag "language[]", language %> | ||
9 | - <% end %> | ||
10 | - | ||
11 | - <p> | ||
12 | - <%= f.label :origin, "Collector Name:" %> | ||
13 | - <%= @metric.origin %> | ||
14 | - <%= hidden_field_tag "metric[origin]", @metric.origin %> | ||
15 | - </p> | ||
16 | - <p> | ||
17 | - <%= f.label :metric_name, "Metric Name:" %> | ||
18 | - <%= @metric.name %> | ||
19 | - <%= hidden_field_tag "metric[name]", @metric.name %> | ||
20 | - </p> | ||
21 | - <p> | ||
22 | - <%= f.label :description, "Description:" %> | ||
23 | - <%= @metric.description %> | ||
24 | - <%= text_field_tag :description %> | ||
25 | - </p> | ||
26 | - <p> | ||
27 | - <%= f.label :code, "Code:" %> | ||
28 | - <%= f.text_field :code %> | ||
29 | - </p> | ||
30 | - <p> | ||
31 | - <%= f.label :aggregation_form, "Aggregation:" %> | ||
32 | - <%= f.select :aggregation_form, [["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"], | ||
33 | - ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]] %> | ||
34 | - </p> | ||
35 | - <p> | ||
36 | - <%= f.label :weight, "Weight:" %> | ||
37 | - <%= f.text_field :weight %> | ||
38 | - </p> | ||
39 | - | ||
40 | - <p> | ||
41 | - <%= f.submit "Add" %> | ||
42 | - </p> | ||
43 | - | ||
44 | -<% end %> |
plugins/mezuro/views/mezuro_plugin_profile/new_range.rjs
plugins/mezuro/views/mezuro_plugin_profile/teste.html.erb
@@ -1 +0,0 @@ | @@ -1 +0,0 @@ | ||
1 | -<h3><%= @configuration_name %></h3> |
plugins/mezuro/views/mezuro_plugin_profile/update_range.rjs
@@ -1 +0,0 @@ | @@ -1 +0,0 @@ | ||
1 | -page.reload() |