Commit 5a427787c196c202193ffe8bba03db9f76664281

Authored by Carlos Morais + Paulo Meirelles
Committed by Carlos Morais
1 parent 64f6a393

[Mezuro] Removing metric_ids and list metrics from BaseTool

plugins/mezuro/lib/kalibro/client/base_tool_client.rb
... ... @@ -11,7 +11,6 @@ class Kalibro::Client::BaseToolClient
11 11 def base_tool(name)
12 12 hash = @port.request(:get_base_tool, {:base_tool_name => name})[:base_tool]
13 13 Kalibro::Entities::BaseTool.from_hash(hash)
14   - #FIXME dando erro
15 14 end
16 15  
17 16 end
... ...
plugins/mezuro/lib/kalibro/client/metrics_client.rb
... ... @@ -1,8 +0,0 @@
1   -class Kalibro::Client::MetricsClient
2   -
3   - def self.all_metrics
4   - [Kalibro::Entities::Metric.new("LOC", "class", "Lines of code", 1),
5   - Kalibro::Entities::Metric.new("LCOM", "class", "Lack of cohesion", 2)]
6   - end
7   -
8   -end
plugins/mezuro/lib/mezuro_plugin/configuration_content.rb
1 1 class MezuroPlugin::ConfigurationContent < Article
2 2  
3   - attr_accessor :metric_ids
4   -
5 3 def self.short_description
6 4 'Kalibro configuration'
7 5 end
... ...
plugins/mezuro/test/unit/mezuro_plugin/configuration_content_test.rb
... ... @@ -23,11 +23,6 @@ class ConfigurationContentTest &lt; ActiveSupport::TestCase
23 23 assert_equal 'Sets of thresholds to interpret metrics', MezuroPlugin::ConfigurationContent.description
24 24 end
25 25  
26   - should 'accept metric_ids' do
27   - @content.metric_ids = [1,5]
28   - assert_equal @content.metric_ids, [1,5]
29   - end
30   -
31 26 should 'have an html view' do
32 27 assert_not_nil @content.to_html
33 28 end
... ...
plugins/mezuro/views/cms/mezuro_plugin/_configuration_content.html.erb
1 1 <h1> <%= _(MezuroPlugin::ConfigurationContent.short_description) %> </h1>
2 2  
3 3 <%
4   - begin
5   - @configuration = @article.title.nil? ? nil : Kalibro::Client::ConfigurationClient.new.configuration(@article.title)
6   - rescue
7   - @configuration = nil
8   - end
9   - %>
  4 +begin
  5 + @configuration = @article.title.nil? ? nil : Kalibro::Client::ConfigurationClient.new.configuration(@article.title)
  6 +rescue
  7 + @configuration = nil
  8 +end
  9 +%>
10 10  
11 11 <%= error_messages_for 'kalibro_configuration' %>
12 12  
... ... @@ -20,13 +20,19 @@
20 20 <%= f.text_field :description %><br/>
21 21  
22 22 <h3> Metrics </h3>
23   -<% @tool_names = Kalibro::Client::BaseToolClient.new
24   -@tool_names.base_tool_names.each do |collector_name|
25   - @collector = @tool_names.base_tool(collector_name)
26   - #FIXME dando erro
27   - @collector.supported_metrics.each do |metric| %>
28   - <div class="metric">
29   - <%= label_tag "#{metric.name}" %>
30   - </div>
31   - <% end
32   -end %>
  23 +<table>
  24 + <% @tool_names = Kalibro::Client::BaseToolClient.new
  25 + @tool_names.base_tool_names.each do |collector_name|
  26 + @collector = @tool_names.base_tool(collector_name)
  27 + @collector.supported_metrics.each do |metric| %>
  28 +
  29 + <tr class="metric" title="<%= metric.description %>">
  30 + <td>
  31 + <%= check_box_tag metric.name, metric.name, true %>
  32 + <%= label_tag metric.name %>
  33 + </td>
  34 + </tr>
  35 +
  36 + <% end %>
  37 + </table>
  38 +<% end %>
... ...