Commit bc2113ca33e353e2f391f2ae40aaedf5086ec861
1 parent
d819ba58
Exists in
colab
and in
4 other branches
Fixed metric selection on MetricConfiguration creation
Signed off by: Daniel Paulino Alves <danpaulalves@gmail.com>
Showing
4 changed files
with
16 additions
and
12 deletions
Show diff stats
Gemfile.lock
1 | 1 | GIT |
2 | 2 | remote: https://github.com/mezuro/kalibro_client |
3 | - revision: 212353618d1bc315b26dfd77793654be205397fc | |
3 | + revision: f602fbb76c2dd5e1b8ad9c28934647c33f85c991 | |
4 | 4 | specs: |
5 | 5 | kalibro_client (0.0.1) |
6 | 6 | activeresource (~> 4.0.0) |
... | ... | @@ -157,7 +157,7 @@ GEM |
157 | 157 | metaclass (0.0.4) |
158 | 158 | mime-types (2.4.3) |
159 | 159 | mini_portile (0.6.1) |
160 | - minitest (5.4.3) | |
160 | + minitest (5.5.0) | |
161 | 161 | mocha (1.1.0) |
162 | 162 | metaclass (~> 0.0.1) |
163 | 163 | multi_json (1.10.1) | ... | ... |
app/controllers/metric_configurations_controller.rb
1 | 1 | class MetricConfigurationsController < BaseMetricConfigurationsController |
2 | 2 | def choose_metric |
3 | - @kalibro_configuration_id = params[:kalibro_configuration_id].to_i | |
3 | + @kalibro_configuration = KalibroConfiguration.find(params[:kalibro_configuration_id].to_i) | |
4 | 4 | @metric_configuration_id = params[:metric_configuration_id].to_i |
5 | - @metric_collectors = KalibroClient::Processor::MetricCollector.all | |
5 | + @metric_collectors_names = KalibroClient::Processor::MetricCollector.all_names | |
6 | 6 | end |
7 | 7 | |
8 | 8 | def new | ... | ... |
app/helpers/metric_configurations_helper.rb
... | ... | @@ -13,4 +13,8 @@ module MetricConfigurationsHelper |
13 | 13 | [ metric_configuration.code, metric_configuration.metric.name ] |
14 | 14 | end |
15 | 15 | end |
16 | + | |
17 | + def supported_metrics_of(metric_collector_name) | |
18 | + KalibroClient::Processor::MetricCollector.find(metric_collector_name).supported_metrics | |
19 | + end | |
16 | 20 | end | ... | ... |
app/views/metric_configurations/choose_metric.html.erb
... | ... | @@ -2,24 +2,24 @@ |
2 | 2 | <h1>Choose a metric from a Base Tool:</h1> |
3 | 3 | </div> |
4 | 4 | |
5 | -<%= form_tag kalibro_configuration_new_metric_configuration_path(@kalibro_configuration_id) do %> | |
5 | +<%= form_tag kalibro_configuration_new_metric_configuration_path(@kalibro_configuration.id) do %> | |
6 | 6 | <%= hidden_field_tag(:metric_collector_name,) %> |
7 | 7 | <%= hidden_field_tag(:metric_name) %> |
8 | 8 | <% end %> |
9 | 9 | |
10 | 10 | <div id="base-tool-accordion"> |
11 | - <% @metric_collectors.each do |metric_collector| %> | |
12 | - <h3 class="jquery-ui-accordion"><%= metric_collector.name %></h3> | |
11 | + <% @metric_collectors_names.each do |metric_collector_name| %> | |
12 | + <h3 class="jquery-ui-accordion"><%= metric_collector_name %></h3> | |
13 | 13 | <div> |
14 | - <% metric_collector.supported_metrics.each do |code, metric| %> | |
15 | - <%= link_to metric.name, '#', onclick: "MetricCollector.choose_metric(\"#{metric.name}\", \"#{metric_collector.name}\");", remote: true %><br> | |
14 | + <% supported_metrics_of(metric_collector_name).each do |metric| %> | |
15 | + <%= link_to metric.name, '#', onclick: "MetricCollector.choose_metric(\"#{metric.name}\", \"#{metric_collector_name}\");", remote: true %><br> | |
16 | 16 | <% end %> |
17 | 17 | </div> |
18 | 18 | <% end %> |
19 | 19 | </div><br /> |
20 | 20 | |
21 | -<%= link_to 'Back', kalibro_configuration_path(@kalibro_configuration_id), class: 'btn btn-default' %> | |
22 | -<%= link_to 'Compound Metric', new_kalibro_configuration_compound_metric_configuration_path(@kalibro_configuration_id), class: 'btn btn-info', id: "link_to_compound" %> | |
21 | +<%= link_to 'Back', kalibro_configuration_path(@kalibro_configuration.id), class: 'btn btn-default' %> | |
22 | +<%= link_to 'Compound Metric', new_kalibro_configuration_compound_metric_configuration_path(@kalibro_configuration.id), class: 'btn btn-info', id: "link_to_compound" %> | |
23 | 23 | |
24 | 24 | |
25 | 25 | <script type="text/javascript"> |
... | ... | @@ -31,7 +31,7 @@ |
31 | 31 | }); |
32 | 32 | }); |
33 | 33 | |
34 | - <% if MetricConfiguration.metric_configurations_of(@kalibro_configuration_id).blank? %> | |
34 | + <% if @kalibro_configuration.metric_configurations.blank? %> | |
35 | 35 | $("#link_to_compound").css("display", "none"); |
36 | 36 | <% end %> |
37 | 37 | </script> | ... | ... |