Commit c37c77c3436ff378ee4c51eedc7c26520c699f6b
Committed by
Rafael Manzo
1 parent
f262e221
Exists in
master
and in
29 other branches
[Mezuro] Started to edit compound_metrics, but not working yet
Showing
3 changed files
with
36 additions
and
39 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_myprofile_controller.rb
... | ... | @@ -28,6 +28,13 @@ class MezuroPluginMyprofileController < ProfileController |
28 | 28 | @metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) |
29 | 29 | @metric = @metric_configuration.metric |
30 | 30 | end |
31 | + | |
32 | + def edit_compound_metric_configuration | |
33 | + metric_name = params[:metric_name] | |
34 | + @configuration_name = params[:configuration_name] | |
35 | + @metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | |
36 | + @metric = @metric_configuration.metric | |
37 | + end | |
31 | 38 | |
32 | 39 | def create_metric_configuration |
33 | 40 | @configuration_name = params[:configuration_name] |
... | ... | @@ -35,6 +42,18 @@ class MezuroPluginMyprofileController < ProfileController |
35 | 42 | Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) |
36 | 43 | redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" |
37 | 44 | end |
45 | + | |
46 | + def new_compound_metric | |
47 | + @configuration_name = params[:configuration_name] | |
48 | + @metric_configurations = Kalibro::Client::ConfigurationClient.new.configuration(@configuration_name).metric_configurations | |
49 | + end | |
50 | + | |
51 | + def create_compound_metric_configuration | |
52 | + @configuration_name = params[:configuration_name] | |
53 | + compound_metric_configuration = new_compound_metric_configuration_instance | |
54 | + Kalibro::Client::MetricConfigurationClient.new.save(compound_metric_configuration, @configuration_name) | |
55 | + redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | |
56 | + end | |
38 | 57 | |
39 | 58 | def update_metric_configuration |
40 | 59 | @configuration_name = params[:configuration_name] |
... | ... | @@ -44,6 +63,15 @@ class MezuroPluginMyprofileController < ProfileController |
44 | 63 | Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) |
45 | 64 | redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" |
46 | 65 | end |
66 | + | |
67 | + def update_compound_metric_configuration | |
68 | + @configuration_name = params[:configuration_name] | |
69 | + metric_name = params[:metric][:name] | |
70 | + metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | |
71 | + assign_compound_metric_configuration_instance (metric_configuration) | |
72 | + Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) | |
73 | + redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | |
74 | + end | |
47 | 75 | |
48 | 76 | def new_range |
49 | 77 | @metric_name = params[:metric_name] |
... | ... | @@ -103,33 +131,6 @@ class MezuroPluginMyprofileController < ProfileController |
103 | 131 | end |
104 | 132 | |
105 | 133 | |
106 | - def new_compound_metric | |
107 | - @configuration_name = params[:configuration_name] | |
108 | - @metric_configurations = Kalibro::Client::ConfigurationClient.new.configuration(@configuration_name).metric_configurations | |
109 | - end | |
110 | - | |
111 | - def create_compound_metric_configuration | |
112 | - @configuration_name = params[:configuration_name] | |
113 | - compound_metric_configuration = new_compound_metric_configuration_instance | |
114 | - Kalibro::Client::MetricConfigurationClient.new.save(compound_metric_configuration, @configuration_name) | |
115 | - redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | |
116 | - end | |
117 | - | |
118 | - def edit_compound_metric_configuration | |
119 | - metric_name = params[:metric_name] | |
120 | - @configuration_name = params[:configuration_name] | |
121 | - @metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | |
122 | - @metric = @metric_configuration.metric | |
123 | - end | |
124 | - | |
125 | - def update_compound_metric_configuration | |
126 | - @configuration_name = params[:configuration_name] | |
127 | - metric_name = params[:metric][:name] | |
128 | - metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | |
129 | - assign_compound_metric_configuration_instance (metric_configuration) | |
130 | - Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) | |
131 | - redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | |
132 | - end | |
133 | 134 | |
134 | 135 | private |
135 | 136 | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/edit_compound_metric_configuration.html.erb
... | ... | @@ -2,7 +2,8 @@ |
2 | 2 | |
3 | 3 | <% form_for :metric_configuration, :url => {:action =>"update_compound_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> |
4 | 4 | <%= hidden_field_tag :configuration_name, @configuration_name %> |
5 | - | |
5 | + <%= hidden_field_tag :scope, @metric.scope %> | |
6 | + | |
6 | 7 | <p> |
7 | 8 | <%= f.label :metric_name, "Metric Name:" %> |
8 | 9 | <%= @metric.name %> |
... | ... | @@ -10,17 +11,15 @@ |
10 | 11 | </p> |
11 | 12 | <p> |
12 | 13 | <%= f.label :description, "Description:" %> |
13 | - <%= @metric.description %> | |
14 | 14 | <%= text_field_tag "metric[description]", @metric.description %> |
15 | 15 | </p> |
16 | 16 | <p> |
17 | - <%= f.label :code, "Code:" %> | |
18 | - <%= f.text_field :code %> | |
17 | + <%= f.label :scope, "Scope:" %> | |
18 | + <%= f.select :scope, [["Class", "CLASS"]], :selected => @metric.scope %> | |
19 | 19 | </p> |
20 | 20 | <p> |
21 | - <%= f.label :scope, "Scope:" %> | |
22 | - <%= @metric.scope %> | |
23 | - <%= text_field_tag "metric[scope]", @metric.scope %> | |
21 | + <%= f.label :code, "Code:" %> | |
22 | + <%= text_field_tag "metric[code]", @metric_configuration.code %> | |
24 | 23 | </p> |
25 | 24 | <p> |
26 | 25 | <%= f.label :aggregation_form, "Aggregation Form:" %> |
... | ... | @@ -31,10 +30,7 @@ |
31 | 30 | <%= f.label :weight, "Weight:" %> |
32 | 31 | <%= f.text_field :weight %> |
33 | 32 | </p> |
34 | - <p> | |
35 | - <%= f.label :script, "script:" %> | |
36 | - <%= f.text_area :script %> | |
37 | - </p> | |
33 | + | |
38 | 34 | <p> |
39 | 35 | <%= f.submit "Save" %> |
40 | 36 | </p> | ... | ... |
plugins/mezuro/views/mezuro_plugin_myprofile/new_compound_metric.html.erb