Commit 18bdf609c390f116a5b947ac2371d3e3983189a1
Committed by
Paulo Meireles
1 parent
69107bff
Exists in
master
and in
29 other branches
[Mezuro] Created new partial metric history and started to link controller with JavaScript.
Showing
3 changed files
with
24 additions
and
2 deletions
Show diff stats
plugins/mezuro/controllers/mezuro_plugin_profile_controller.rb
@@ -125,11 +125,16 @@ class MezuroPluginProfileController < ProfileController | @@ -125,11 +125,16 @@ class MezuroPluginProfileController < ProfileController | ||
125 | end | 125 | end |
126 | 126 | ||
127 | def module_metrics_history | 127 | def module_metrics_history |
128 | + | ||
128 | metric_name = params[:metric_name] | 129 | metric_name = params[:metric_name] |
130 | + for i in 1..50 do | ||
131 | + puts metric_name | ||
132 | + end | ||
129 | content = profile.articles.find(params[:id]) | 133 | content = profile.articles.find(params[:id]) |
130 | module_history = content.result_history(content.project.name, params[:module_name]) | 134 | module_history = content.result_history(content.project.name, params[:module_name]) |
135 | + metric_history = module_history.select { |x| x.metric_result.metric.name == metric_name} | ||
131 | #precisamos que uma variável receba um array com os valores da métrica passada a partir do result history | 136 | #precisamos que uma variável receba um array com os valores da métrica passada a partir do result history |
132 | - render :partial => 'content_viewer/show_history', :locals => {:module_history => module_history } | 137 | + render :partial => 'content_viewer/metric_history', :locals => {:metric_history => metric_history } |
133 | end | 138 | end |
134 | 139 | ||
135 | end | 140 | end |
plugins/mezuro/public/javascripts/project_content.js
@@ -2,6 +2,8 @@ var processingTree = false; | @@ -2,6 +2,8 @@ var processingTree = false; | ||
2 | jQuery(function (){ | 2 | jQuery(function (){ |
3 | jQuery('.source-tree-link').live("click", reloadModule); | 3 | jQuery('.source-tree-link').live("click", reloadModule); |
4 | jQuery('[data-show]').live("click", toggle_mezuro); | 4 | jQuery('[data-show]').live("click", toggle_mezuro); |
5 | + //alert('AAAASDFAGSGDRSAFGHADFGSDFGSD'); | ||
6 | + jQuery('[show-metric-history]').live("click", display_metric_history); | ||
5 | showLoadingProcess(true); | 7 | showLoadingProcess(true); |
6 | showProjectContent(); | 8 | showProjectContent(); |
7 | }); | 9 | }); |
@@ -10,6 +12,19 @@ function showProjectContent() { | @@ -10,6 +12,19 @@ function showProjectContent() { | ||
10 | callAction('project_state', {}, showProjectContentFor); | 12 | callAction('project_state', {}, showProjectContentFor); |
11 | } | 13 | } |
12 | 14 | ||
15 | +function display_metric_history() { | ||
16 | + var module_name = jQuery(this).attr('data-module-name'); | ||
17 | + var metric_name = jQuery(this).attr('data-metric-name'); | ||
18 | + alert (metric_name); | ||
19 | + callAction('module_metrics_history', {module_name: module_name, metric_name: metric_name}, show_metrics)//metric_name, module_name}, show_metrics); | ||
20 | +} | ||
21 | + | ||
22 | +function show_metrics(content) { | ||
23 | + alert('SSSSSSSSSSS'); | ||
24 | + jQuery('#historical').html(content); | ||
25 | + | ||
26 | +} | ||
27 | + | ||
13 | function toggle_mezuro(){ | 28 | function toggle_mezuro(){ |
14 | var element = jQuery(this).attr('data-show'); | 29 | var element = jQuery(this).attr('data-show'); |
15 | jQuery(element).toggle(); | 30 | jQuery(element).toggle(); |
plugins/mezuro/views/content_viewer/_module_result.rhtml
@@ -32,7 +32,9 @@ | @@ -32,7 +32,9 @@ | ||
32 | <%= range.nil? or range.comments.nil? ? 'comment empty' : range.comments %> | 32 | <%= range.nil? or range.comments.nil? ? 'comment empty' : range.comments %> |
33 | </td> | 33 | </td> |
34 | <td> | 34 | <td> |
35 | - <a> <p style="text-indent: 3em;"> Draw Historical Graphic </p> </a> | 35 | + <div id='historical'> |
36 | + <a href="#" show-metric-history="<%= metric_result.metric.name.delete("() ") %>" data-module-name="<%= the_module.name %>" data-metric-name="<%= metric_result.metric.name.delete("() ") %>"> <p style="text-indent: 3em;"> Draw Historical Graphic </p> </a> | ||
37 | + </div> | ||
36 | </td> | 38 | </td> |
37 | <td colspan="3" align="right"> | 39 | <td colspan="3" align="right"> |
38 | <%= range.comments.nil? ? '' : range.comments %> | 40 | <%= range.comments.nil? ? '' : range.comments %> |