Commit 80e5af82fa803d687c8da5d96684ec0cffc21270
Committed by
Guilherme Rojas
1 parent
560c305f
Exists in
colab
and in
4 other branches
Routes are in REST pattern.
Also, fixed acceptance test for graphic show Signed-off By: Guilherme Rojas V. de Lima <guilhermehrojas@gmail.com> Signed-off By: Diego Araújo <diegoamc90@gmail.com> Signed-off By: Fellipe Souto Sampaio <fllsouto@gmail.com>
Showing
6 changed files
with
8 additions
and
9 deletions
Show diff stats
app/assets/javascripts/module/graphic.js.coffee
... | ... | @@ -9,9 +9,8 @@ class Module.Graphic |
9 | 9 | container = @container |
10 | 10 | display = this.display |
11 | 11 | |
12 | - $.get '/modules/metric_history', | |
12 | + $.get '/modules/' + @module_id + '/metric_history', | |
13 | 13 | metric_name: @metric_name |
14 | - module_id: @module_id | |
15 | 14 | (data) -> |
16 | 15 | display(data,container) |
17 | 16 | ... | ... |
app/controllers/modules_controller.rb
1 | 1 | class ModulesController < ApplicationController |
2 | 2 | |
3 | - # GET /modules/metric_history | |
3 | + # GET /modules/1/metric_history | |
4 | 4 | def metric_history |
5 | - module_result = ModuleResult.new({ id: params[:module_id] }) | |
5 | + module_result = ModuleResult.new({ id: params[:id] }) | |
6 | 6 | metric_history = module_result.metric_history(params[:metric_name]) # pending: sort this hash. |
7 | 7 | dates = Array.new |
8 | 8 | values = Array.new | ... | ... |
app/views/modules/_metric_result.html.erb
... | ... | @@ -4,7 +4,7 @@ |
4 | 4 | metric_name = metric_configuration_snapshot.metric.name |
5 | 5 | %> |
6 | 6 | <tr> |
7 | - <td><%= link_to metric_name, "#metric_#{module_result.id}", | |
7 | + <td><%= link_to metric_name, "", | |
8 | 8 | onclick: "new Module.Graphic('container#{metric_result.id}', '#{metric_name}', '#{module_result.id}')", |
9 | 9 | id: "metric_#{module_result.id}", |
10 | 10 | remote: true %> | ... | ... |
config/routes.rb
... | ... | @@ -11,7 +11,7 @@ Mezuro::Application.routes.draw do |
11 | 11 | end |
12 | 12 | |
13 | 13 | #resources :modules |
14 | - get '/modules/metric_history' => 'modules#metric_history' | |
14 | + get '/modules/:id/metric_history' => 'modules#metric_history' | |
15 | 15 | post '/modules/:id/tree' => 'modules#load_module_tree' |
16 | 16 | |
17 | 17 | root "home#index" | ... | ... |
features/step_definitions/repository_steps.rb
... | ... | @@ -97,5 +97,5 @@ Then(/^I should see a loaded graphic for the sample metric$/) do |
97 | 97 | while (page.driver.network_traffic.last.response_parts.empty?) do |
98 | 98 | sleep(10) |
99 | 99 | end |
100 | - page.all("img#container" + @metric_results.first.id.to_s).first.should_not be_nil | |
100 | + page.all("img#container" + @metric_results.first.id.to_s)[0].should_not be_nil | |
101 | 101 | end |
102 | 102 | \ No newline at end of file | ... | ... |
spec/routing/modules_routing_spec.rb
... | ... | @@ -4,7 +4,7 @@ describe ModulesController do |
4 | 4 | describe "routing" do |
5 | 5 | it { should route(:post, '/modules/1/tree'). |
6 | 6 | to(controller: :modules, action: :load_module_tree, id: 1) } |
7 | - it { should route(:get, '/modules/metric_history'). | |
8 | - to(controller: :modules, action: :metric_history) } | |
7 | + it { should route(:get, '/modules/1/metric_history'). | |
8 | + to(controller: :modules, action: :metric_history, id: 1) } | |
9 | 9 | end |
10 | 10 | end |
11 | 11 | \ No newline at end of file | ... | ... |