show_configuration.rhtml
2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<% @configuration_content = @page
@kalibro_configuration = @page.kalibro_configuration %>
<!-- #TODO check owner verification to remove or edit metric configuration -->
<% owner = (not user.nil?) && user.id == @profile.id %>
<% unless @page.errors[:base].nil? %>
<% if @page.errors[:base] =~ /Kalibro::Errors::RecordNotFound/ %>
<h3>Warning:</h3>
<p>This Configuration doesn't exist on the Web Service.</p>
<% if owner %>
<p> Do you want to <%= link_to 'delete', :action => 'destroy', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %> or <%= link_to 'save it again', :action => 'edit', :controller => 'cms', :profile => @page.profile.identifier, :id => @page.id %>?</p>
<% end %>
<% else %>
<%= @page.errors[:base] %>
<% end %>
<% else %>
<table id="project_info">
<tr>
<td><%= _('Name') %></td>
<td><%= @kalibro_configuration.name %></td>
</tr>
<tr>
<td><%= _('Description') %></td>
<td><%= @kalibro_configuration.description %></td>
</tr>
</table>
<br/>
<% if owner %>
<%= link_to "#{image_tag('/plugins/mezuro/images/plus.png')}Add Metric", :controller => "mezuro_plugin_metric_configuration",
:profile => @page.profile.identifier,
:action => "choose_metric",
:id => @configuration_content.id %><br/>
<% end %>
<table>
<tr class="titles">
<td><h5>Metric Name</h5></td>
<td><h5>Collector Name</h5></td>
<td><h5>Metric Code</h5></td>
<td><h5>Weight</h5></td>
<td><h5>Aggregation Form</h5></td>
<td/>
</tr>
<% @configuration_content.metric_configurations.each do |metric_configuration| %>
<tr class="metric">
<% if metric_configuration.metric.compound
edit_action = "edit_compound"
else
edit_action = "edit_native"
end
%>
<td><%= link_to metric_configuration.metric.name, :controller => "mezuro_plugin_metric_configuration", :action => edit_action,
:metric_configuration_id => metric_configuration.id, :id => @configuration_content.id,
:profile => @page.profile.identifier %></td>
<% if metric_configuration.metric.compound %>
<td>
Compound Metric
</td>
<% else %>
<td>
<%= metric_configuration.base_tool_name %>
</td>
<% end %>
<td><%= metric_configuration.code %></td>
<td><%= metric_configuration.weight %></td>
<td><%= metric_configuration.aggregation_form %></td>
<% if owner %>
<td><%= link_to "Remove", :controller => "mezuro_plugin_metric_configuration", :action => "remove",
:metric_configuration_id => metric_configuration.id, :id => @configuration_content.id,
:profile => @page.profile.identifier %></td>
<% end %>
</tr>
<% end %>
</table>
<% end %>