From 2e1b1e9000f19743c0e3870fb58c751025b5bead Mon Sep 17 00:00:00 2001 From: João M. M. da Silva Date: Thu, 22 Mar 2012 00:09:09 +0400 Subject: [PATCH] [Mezuro] Added "choose metric" window on "add metric" procedure --- plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb | 10 ++++++++++ plugins/mezuro/views/content_viewer/show_configuration.rhtml | 1 - plugins/mezuro/views/mezuro_plugin_profile/add_metric.html.erb | 10 ++++++++++ plugins/mezuro/views/mezuro_plugin_profile/choose_base_tool.html.erb | 4 ++-- plugins/mezuro/views/mezuro_plugin_profile/choose_metric.html.erb | 18 ++++++++++++++++++ 5 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 plugins/mezuro/views/mezuro_plugin_profile/add_metric.html.erb create mode 100644 plugins/mezuro/views/mezuro_plugin_profile/choose_metric.html.erb diff --git a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb index 99bf875..7243b18 100644 --- a/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb +++ b/plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb @@ -32,7 +32,17 @@ class MezuroPluginProfileController < ProfileController @tool_names = Kalibro::Client::BaseToolClient.new end + def choose_metric + @configuration_name = params[:configuration_name] + @collector_name = params[:collector_name] + collector_client = Kalibro::Client::BaseToolClient.new + @collector = collector_client.base_tool(@collector_name) + end + def add_metric + @metric_name = params[:metric_name] + @configuration_name = params[:configuration_name] + @collector_name = params[:collector_name] end end diff --git a/plugins/mezuro/views/content_viewer/show_configuration.rhtml b/plugins/mezuro/views/content_viewer/show_configuration.rhtml index 5d17ef9..5c3a611 100644 --- a/plugins/mezuro/views/content_viewer/show_configuration.rhtml +++ b/plugins/mezuro/views/content_viewer/show_configuration.rhtml @@ -34,4 +34,3 @@ <% #link_to "Teste", "/profile/#{profile.identifier}/plugins/mezuro/teste" %> -<% #link_to "Teste", :controller => "mezuro_plugin_profile", :action => "teste", :params => {:configuration_name => @configuration.name} %> diff --git a/plugins/mezuro/views/mezuro_plugin_profile/add_metric.html.erb b/plugins/mezuro/views/mezuro_plugin_profile/add_metric.html.erb new file mode 100644 index 0000000..8181308 --- /dev/null +++ b/plugins/mezuro/views/mezuro_plugin_profile/add_metric.html.erb @@ -0,0 +1,10 @@ +

<%= @configuration_name%> Configuration

+ + + +
Metric Collector <%= @collector_name %>
+ + +
Metric choosed <%= @metric_name %>
+ +
diff --git a/plugins/mezuro/views/mezuro_plugin_profile/choose_base_tool.html.erb b/plugins/mezuro/views/mezuro_plugin_profile/choose_base_tool.html.erb index ea91293..e50e01c 100644 --- a/plugins/mezuro/views/mezuro_plugin_profile/choose_base_tool.html.erb +++ b/plugins/mezuro/views/mezuro_plugin_profile/choose_base_tool.html.erb @@ -5,8 +5,8 @@ <% @tool_names.base_tool_names.each do |collector_name| %> - <%= link_to collector_name, :controller => "mezuro_plugin_profile", :action => "add_metric", :params => - {:configuration_name => @configuration_name} %> + <%= link_to collector_name, :controller => "mezuro_plugin_profile", :action => "choose_metric", :params => + {:configuration_name => @configuration_name, :collector_name => collector_name} %> <% end %> diff --git a/plugins/mezuro/views/mezuro_plugin_profile/choose_metric.html.erb b/plugins/mezuro/views/mezuro_plugin_profile/choose_metric.html.erb new file mode 100644 index 0000000..b4ca6bf --- /dev/null +++ b/plugins/mezuro/views/mezuro_plugin_profile/choose_metric.html.erb @@ -0,0 +1,18 @@ +

<%= @configuration_name %> Configuration

+ + + +
Metric Collector: <%= @collector_name %>
+ + +
Choose a metric to add:
+ + <% @collector.supported_metrics.each do |metric| %> + + + + <% end %> +
+ <%= link_to metric.name, :controller => "mezuro_plugin_profile", :action => "add_metric", :params => {:metric_name => metric.name, + :collector_name => @collector_name, :configuration_name => @configuration_name} %> +
-- libgit2 0.21.2