Commit eca8fdfa4abe90e7790abb55149f250183a8ae67

Authored by Rafael Manzo
Committed by Diego Camarinha
1 parent 5c39634f

[Mezuro] Javascript for processing state and source tree

plugins/mezuro/controllers/profile/mezuro_plugin_repository_controller.rb
1 -#TODO terminar esse controler e seus testes funcionais  
2 class MezuroPluginRepositoryController < MezuroPluginProfileController 1 class MezuroPluginRepositoryController < MezuroPluginProfileController
3 2
4 append_view_path File.join(File.dirname(__FILE__) + '/../../views') 3 append_view_path File.join(File.dirname(__FILE__) + '/../../views')
plugins/mezuro/public/javascripts/processing.js
@@ -2,17 +2,18 @@ var processingTree = false; @@ -2,17 +2,18 @@ var processingTree = false;
2 var metricName; 2 var metricName;
3 jQuery(function (){ 3 jQuery(function (){
4 jQuery('.source-tree-link').live("click", reloadModule); 4 jQuery('.source-tree-link').live("click", reloadModule);
5 - jQuery('[show-metric-history]').live("click", display_metric_history);  
6 - jQuery('[show-grade-history]').live("click", display_grade_history);  
7 - jQuery('#project_date_submit').live("click", reloadProjectWithDate); 5 + jQuery('[show-metric-history]').live("click", display_metric_history); //TODO review for project history
  6 + jQuery('[show-grade-history]').live("click", display_grade_history); //TODO review for project history
  7 + jQuery('#project_date_submit').live("click", reloadProjectWithDate); //TODO review for project history
8 showLoadingProcess(true); 8 showLoadingProcess(true);
9 showProcessing(); 9 showProcessing();
10 }); 10 });
11 11
12 function showProcessing() { 12 function showProcessing() {
13 - callAction('processing', 'processing_state', {}, showProcessingFor); 13 + callAction('processing', 'processing', {}, showProcessingFor);
14 } 14 }
15 15
  16 +//TODO review for project history
16 function display_metric_history() { 17 function display_metric_history() {
17 var module_name = jQuery(this).attr('data-module-name'); 18 var module_name = jQuery(this).attr('data-module-name');
18 var metric_name = jQuery(this).attr('show-metric-history'); 19 var metric_name = jQuery(this).attr('show-metric-history');
@@ -22,6 +23,7 @@ function display_metric_history() { @@ -22,6 +23,7 @@ function display_metric_history() {
22 return false; 23 return false;
23 } 24 }
24 25
  26 +//TODO review for project history
25 function display_grade_history() { 27 function display_grade_history() {
26 var module_name = jQuery(this).attr('data-module-name'); 28 var module_name = jQuery(this).attr('data-module-name');
27 toggle_mezuro("#historical-grade"); 29 toggle_mezuro("#historical-grade");
@@ -29,10 +31,12 @@ function display_grade_history() { @@ -29,10 +31,12 @@ function display_grade_history() {
29 return false; 31 return false;
30 } 32 }
31 33
  34 +//TODO review for project history
32 function show_metrics(content) { 35 function show_metrics(content) {
33 jQuery('#historical-' + metricName).html(content); 36 jQuery('#historical-' + metricName).html(content);
34 } 37 }
35 38
  39 +//TODO review for project history
36 function show_grades(content) { 40 function show_grades(content) {
37 jQuery('#historical-grade').html(content); 41 jQuery('#historical-grade').html(content);
38 } 42 }
@@ -42,6 +46,7 @@ function toggle_mezuro(element){ @@ -42,6 +46,7 @@ function toggle_mezuro(element){
42 return false; 46 return false;
43 } 47 }
44 48
  49 +//TODO Waiting for ModuleResultController refactoring
45 function reloadModule(){ 50 function reloadModule(){
46 var results_root_id = jQuery(this).attr('results_root_id'); 51 var results_root_id = jQuery(this).attr('results_root_id');
47 showLoadingProcess(false); 52 showLoadingProcess(false);
@@ -51,11 +56,13 @@ function reloadModule(){ @@ -51,11 +56,13 @@ function reloadModule(){
51 return false; 56 return false;
52 } 57 }
53 58
  59 +//TODO review for project history
54 function reloadProjectWithDate(date){ 60 function reloadProjectWithDate(date){
55 reloadProject(date + "T00:00:00+00:00"); 61 reloadProject(date + "T00:00:00+00:00");
56 return false; 62 return false;
57 } 63 }
58 64
  65 +//TODO review for project history
59 function reloadProject(date){ 66 function reloadProject(date){
60 showLoadingProcess(true); 67 showLoadingProcess(true);
61 68
@@ -73,9 +80,9 @@ function showProcessingFor(state){ @@ -73,9 +80,9 @@ function showProcessingFor(state){
73 jQuery('#msg-time').html(''); 80 jQuery('#msg-time').html('');
74 jQuery('#processing-state').html('<div style="color:Green">READY</div>'); 81 jQuery('#processing-state').html('<div style="color:Green">READY</div>');
75 callAction('processing', 'processing', {}, showProcessing); 82 callAction('processing', 'processing', {}, showProcessing);
76 - callAction('module_result','project_tree', {}, showProjectTree);  
77 - var module_result_id = jQuery("#processing").attr('results_root_id');  
78 - callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult); 83 + callAction('processing','project_tree', {}, showProjectTree);
  84 + //var module_result_id = jQuery("#processing").attr('results_root_id'); //TODO Waiting for ModuleResultController refactoring
  85 + //callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult); //TODO Waiting for ModuleResultController refactoring
79 } 86 }
80 else if (state.endsWith("ING")) { 87 else if (state.endsWith("ING")) {
81 jQuery('#processing-state').html('<div style="color:DarkGoldenRod">'+ state +'</div>'); 88 jQuery('#processing-state').html('<div style="color:DarkGoldenRod">'+ state +'</div>');
@@ -102,6 +109,7 @@ function showProjectTree(content){ @@ -102,6 +109,7 @@ function showProjectTree(content){
102 return false; 109 return false;
103 } 110 }
104 111
  112 +//TODO Waiting for ModuleResultController refactoring
105 function showModuleResult(content){ 113 function showModuleResult(content){
106 if (processingTree != true){ 114 if (processingTree != true){
107 jQuery('#module-result').html(content); 115 jQuery('#module-result').html(content);