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,6 +28,13 @@ class MezuroPluginMyprofileController < ProfileController | ||
28 | @metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) | 28 | @metric_configuration = Kalibro::Client::MetricConfigurationClient.new.metric_configuration(@configuration_name, metric_name) |
29 | @metric = @metric_configuration.metric | 29 | @metric = @metric_configuration.metric |
30 | end | 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 | def create_metric_configuration | 39 | def create_metric_configuration |
33 | @configuration_name = params[:configuration_name] | 40 | @configuration_name = params[:configuration_name] |
@@ -35,6 +42,18 @@ class MezuroPluginMyprofileController < ProfileController | @@ -35,6 +42,18 @@ class MezuroPluginMyprofileController < ProfileController | ||
35 | Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) | 42 | Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) |
36 | redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | 43 | redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" |
37 | end | 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 | def update_metric_configuration | 58 | def update_metric_configuration |
40 | @configuration_name = params[:configuration_name] | 59 | @configuration_name = params[:configuration_name] |
@@ -44,6 +63,15 @@ class MezuroPluginMyprofileController < ProfileController | @@ -44,6 +63,15 @@ class MezuroPluginMyprofileController < ProfileController | ||
44 | Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) | 63 | Kalibro::Client::MetricConfigurationClient.new.save(metric_configuration, @configuration_name) |
45 | redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" | 64 | redirect_to "/#{profile.identifier}/#{@configuration_name.downcase.gsub(/\s/, '-')}" |
46 | end | 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 | def new_range | 76 | def new_range |
49 | @metric_name = params[:metric_name] | 77 | @metric_name = params[:metric_name] |
@@ -103,33 +131,6 @@ class MezuroPluginMyprofileController < ProfileController | @@ -103,33 +131,6 @@ class MezuroPluginMyprofileController < ProfileController | ||
103 | end | 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 | private | 135 | private |
135 | 136 |
plugins/mezuro/views/mezuro_plugin_myprofile/edit_compound_metric_configuration.html.erb
@@ -2,7 +2,8 @@ | @@ -2,7 +2,8 @@ | ||
2 | 2 | ||
3 | <% form_for :metric_configuration, :url => {:action =>"update_compound_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> | 3 | <% form_for :metric_configuration, :url => {:action =>"update_compound_metric_configuration", :controller => "mezuro_plugin_myprofile"}, :method => :get do |f| %> |
4 | <%= hidden_field_tag :configuration_name, @configuration_name %> | 4 | <%= hidden_field_tag :configuration_name, @configuration_name %> |
5 | - | 5 | + <%= hidden_field_tag :scope, @metric.scope %> |
6 | + | ||
6 | <p> | 7 | <p> |
7 | <%= f.label :metric_name, "Metric Name:" %> | 8 | <%= f.label :metric_name, "Metric Name:" %> |
8 | <%= @metric.name %> | 9 | <%= @metric.name %> |
@@ -10,17 +11,15 @@ | @@ -10,17 +11,15 @@ | ||
10 | </p> | 11 | </p> |
11 | <p> | 12 | <p> |
12 | <%= f.label :description, "Description:" %> | 13 | <%= f.label :description, "Description:" %> |
13 | - <%= @metric.description %> | ||
14 | <%= text_field_tag "metric[description]", @metric.description %> | 14 | <%= text_field_tag "metric[description]", @metric.description %> |
15 | </p> | 15 | </p> |
16 | <p> | 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 | </p> | 19 | </p> |
20 | <p> | 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 | </p> | 23 | </p> |
25 | <p> | 24 | <p> |
26 | <%= f.label :aggregation_form, "Aggregation Form:" %> | 25 | <%= f.label :aggregation_form, "Aggregation Form:" %> |
@@ -31,10 +30,7 @@ | @@ -31,10 +30,7 @@ | ||
31 | <%= f.label :weight, "Weight:" %> | 30 | <%= f.label :weight, "Weight:" %> |
32 | <%= f.text_field :weight %> | 31 | <%= f.text_field :weight %> |
33 | </p> | 32 | </p> |
34 | - <p> | ||
35 | - <%= f.label :script, "script:" %> | ||
36 | - <%= f.text_area :script %> | ||
37 | - </p> | 33 | + |
38 | <p> | 34 | <p> |
39 | <%= f.submit "Save" %> | 35 | <%= f.submit "Save" %> |
40 | </p> | 36 | </p> |
plugins/mezuro/views/mezuro_plugin_myprofile/new_compound_metric.html.erb
@@ -13,7 +13,7 @@ | @@ -13,7 +13,7 @@ | ||
13 | <%= f.text_field :description %> | 13 | <%= f.text_field :description %> |
14 | </p> | 14 | </p> |
15 | <p> | 15 | <p> |
16 | - <%= f.label :scope, "scope" %> | 16 | + <%= f.label :scope, "Scope:" %> |
17 | <%= f.select :scope, [["Class", "CLASS"]] %> | 17 | <%= f.select :scope, [["Class", "CLASS"]] %> |
18 | </p> | 18 | </p> |
19 | <p> | 19 | <p> |