var processingTree = false; var metricName; jQuery(function (){ jQuery('.source-tree-link').live("click", reloadModule); jQuery('[show-metric-history]').live("click", display_metric_history); //TODO review for project history jQuery('[show-grade-history]').live("click", display_grade_history); //TODO review for project history jQuery('#project_date_submit').live("click", reloadProcessingWithDate); //TODO review for project history showLoadingProcess(true); showProcessing(); }); function showProcessing() { repository_id = processingData('repository-id'); callAction('processing', 'state', {repository_id: repository_id}, showProcessingFor); } //TODO review for project history function display_metric_history() { var module_result_id = jQuery(this).attr('data-module-id'); var metric_name = jQuery(this).attr('show-metric-history'); toggle_mezuro("." + metric_name); metricName = metric_name; callAction('module_result', 'metric_result_history', {metric_name: metric_name, module_result_id: module_result_id}, show_metrics); return false; } //TODO review for project history function display_grade_history() { var module_name = jQuery(this).attr('data-module-id'); toggle_mezuro("#historical-grade"); callAction('module_result', 'module_result_history', {module_result_id: module_result_id}, show_grades); return false; } //TODO review for project history function show_metrics(content) { jQuery('#historical-' + metricName).html(content); } //TODO review for project history function show_grades(content) { jQuery('#historical-grade').html(content); } function toggle_mezuro(element){ jQuery(element).toggle(); return false; } //TODO Waiting for ModuleResultController refactoring function reloadModule(){ var module_result_id = jQuery(this).attr('module_result_id'); showLoadingProcess(false); processingTree = true; // callAction('module_result', 'project_tree', {results_root_id: results_root_id }, showProjectTree); callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult); return false; } //TODO review for project history function reloadProcessingWithDate(date){ reloadProcessing(date + "T00:00:00+00:00"); return false; } //TODO review for project history function reloadProcessing(date){ repository_id = processingData('repository-id'); showLoadingProcess(true); callAction('processing', 'processing', {date: date, repository_id: repository_id}, function(content){ showReadyProcessing(content); var module_result_id = jQuery("#module_result_root_id").attr('module_result_root_id'); //TODO Waiting for ModuleResultController refactoring callAction('module_result', 'module_result', {module_result_id: module_result_id}, showModuleResult); //TODO Waiting for ModuleResultController refactoring } ); } function showProcessingFor(state){ repository_id = processingData('repository-id'); if (state == 'ERROR') { jQuery('#project-state').html('
");
showModuleResult("
");
}
function sourceNodeToggle(id){
var suffixes = ['_hidden', '_plus', '_minus'];
for (var i in suffixes)
jQuery('#' + id + suffixes[i]).toggle();
}