Commit f7582c32 authored by Celine Noirot's avatar Celine Noirot
Browse files

Add 2 years purge data (version alpha) with graphique evolution

parent 8369a8e8
......@@ -525,8 +525,7 @@ class tx_nG6_db {
return $final_results;
}
function select_storage_evolution($values, $by, $role, $get_analyzes, $octet, $cumulate) {
error_log(date(DATE_RFC2822) . " entrée dans select_storage_evolution\n",3,"/save/ng6-test/src/nG6/ui/nG6/testMM.log");
function select_storage_evolution($values, $by, $role, $get_analyzes, $octet, $cumulate) {
if ($by == "organism" || $by == "location") {
$by = "tx_nG6_".$by;
}
......@@ -536,6 +535,7 @@ function select_storage_evolution($values, $by, $role, $get_analyzes, $octet, $c
}
$from = "" ;
$where = "fe_groups.".$by." IN ('".implode("', '", $values)."')" ;
if ($role == "create_user") {
$from = 'tx_nG6_project '
.' INNER JOIN tx_nG6_project_run ON tx_nG6_project_run.project_id= tx_nG6_project.uid'
......@@ -563,8 +563,6 @@ function select_storage_evolution($values, $by, $role, $get_analyzes, $octet, $c
$results = array();
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
error_log("select_storage_evolution recup runs ".$res_row["crdate"]." - ".$res_row[$storage_unit] ."\n",3,"/save/ng6-test/src/nG6/ui/nG6/testMM.log");
$analyses_size = 0;
$analyses_size_purged = 0;
if ($get_analyzes && $octet) {
......@@ -576,7 +574,8 @@ function select_storage_evolution($values, $by, $role, $get_analyzes, $octet, $c
}
if( array_key_exists( $res_row["crdate"], $results) ) {
$results[$res_row["crdate"]] += array($res_row[$storage_unit] + $analyses_size, $res_row["purged_size"] + $analyses_size_purged);
$results[$res_row["crdate"]][0] += $res_row[$storage_unit] + $analyses_size;
$results[$res_row["crdate"]][1] += $res_row["purged_size"] + $analyses_size_purged;
} else {
$results[$res_row["crdate"]] = array($res_row[$storage_unit] + $analyses_size, $res_row["purged_size"] + $analyses_size_purged);
}
......@@ -584,11 +583,6 @@ function select_storage_evolution($values, $by, $role, $get_analyzes, $octet, $c
$final_results = array();
foreach($results as $group_key => $group_values) {
//error_log("select_storage_evolution ".$group_key." - ".$group_values[0]." - ".$group_values[1] ."\n",3,"/save/ng6-test/src/nG6/ui/nG6/testMM.log");
if ($group_values[1] > 0){
error_log("select_storage_evolution purged ".$group_key." - ".$group_values[0]." - ".$group_values[1] ."\n",3,"/save/ng6-test/src/nG6/ui/nG6/testMM.log");
}
if ($cumulate && count($final_results) > 0) {
$final_results[] = array( $group_key, $group_values[0] + $final_results[count($final_results)-1][1],$group_values[0] + $group_values[1] + $final_results[count($final_results)-1][2]);
} else {
......
......@@ -695,15 +695,13 @@ function drawDataEvolution(stat_tables){
real_group = $group_by.attr('id').split('_')[1],
role = $("input[type=radio][name=users_to_consider]:checked").val(),
values = getDatatableCheckedValue(stat_tables),
bases = $("#chk_display_bases").attr("checked") == "checked" ? "1" : "0",
analysis = $("#chk_includes_analyses").attr("checked") == "checked" ? "1" : "0",
bases = $("#chk_display_bases")[0].checked ? "1" : "0",
analysis = $("#chk_includes_analyses")[0].checked ? "1" : "0",
cumulate = $("#chk_cumulate")[0].checked ? "1" : "0" ;
$.ajax({
url: "index.php?eID=tx_nG6&type=data_evolution&by="+group_by+"&role="+role+"&cumulate="+cumulate+"&get_analyzes="+analysis+"&bases="+bases+"&values="+values.join(","),
dataType: 'json',
success: function(val, status, xhr) {
// reformat the data with values to integer
var val_stored = [];
var val_purged = [];
......@@ -716,21 +714,16 @@ function drawDataEvolution(stat_tables){
seriesData = [
{
type:"line",
name: "data storage size",
name: "Size of data still stored",
data: val_stored,
tooltip: {
valueSuffix: ' octets'
},
color: "green"
},{
type:"line",
name: "data purged size",
data: val_purged, yAxis: 1,
tooltip: {
valueSuffix: ' octets'
},
color: "blue"
name: "Size of data (stored + purged)",
data: val_purged,
color: "blue",
dashStyle: 'dash'
}
]
......@@ -738,83 +731,41 @@ function drawDataEvolution(stat_tables){
chart = new Highcharts.StockChart({
chart: {
renderTo: 'highcharts_graph',
zoomType: 'xy'
},
rangeSelector: {
selected: 4
},
yAxis: [
{
gridLineWidth: 1,
title: {
text: 'Data stored',
text: 'Size of data still stored',
style: {
color: "green"
}
},
min: 0,
labels: {
formatter: function() {
if ($("#chk_display_bases").attr("checked") == "checked") {
return get_base_string_representation(this.value, 0);
} else {
return get_octet_string_representation(this.value, 0);
}
},
style: {
color: "green"
}
}
// ,
// plotLines: [{
// value: 0,
// width: 2,
// color: 'silver'
// }]
min: 0
},
{
gridLineWidth: 0,
gridLineWidth: 1,
title: {
text: 'Data purged',
text: 'Size of data (stored + purged)',
style: {
color: "blue"
}
},
min: 0,
labels: {
formatter: function() {
if ($("#chk_display_bases").attr("checked") == "checked") {
return get_base_string_representation(this.value, 0);
} else {
return get_octet_string_representation(this.value, 0);
}
},
style: {
color: "blue"
}
}
// ,
// plotLines: [{
// value: 0,
// width: 2,
// color: 'black'
// }]
min: 0
, opposite: true},
],
tooltip: {
shared: true,
// formatter: function() {
// var s = Highcharts.dateFormat('%B %Y', this.x) + ":";
// $.each(this.points, function(i, point) {
// if ($("#chk_display_bases").attr("checked") == "checked") {
// s += '<strong>'+ get_base_string_representation(point.y, 2) +'</strong>';
// } else {
// s += '<strong>'+ get_octet_string_representation(point.y, 2) +'</strong>';
// }
//
// });
// return s;
// }
formatter: function() {
var toolTipTxt = '<b>'+ Highcharts.dateFormat('%B %Y', this.x) + ":" +'</b>';
$.each(this.points, function(i, point) {
toolTipTxt += '<br/><span style="color:'+ point.series.color +'"> ' + point.series.name + ': ' + get_octet_string_representation(point.y, 2)+'</span>';
});
return toolTipTxt;
} ,shared: true,
},
credits: { enabled: false },
series: seriesData,
......@@ -861,14 +812,6 @@ function initStatMenuDataTables () {
null,
null]
});
stat_tables["obsolete"] = $("#data_table_obsolete").DataTable({
"language": {
"info": 'Showing _START_ to _END_ of _MAX_ entries <strong><small id="nb_selected_span"></small></strong>'},
"order": [[ 1, "asc" ]],
"columns": [
{ "orderable": false },
null,null,null,null,null,null,null,null,null,null,null]
});
$("#data_table_laboratories, #data_table_organizations, #data_table_locations ").on( 'draw.dt', function () {
var $table = $('div[id^=wrapper_datatable]:visible'),
......@@ -885,6 +828,7 @@ function initStatMenuDataTables () {
});
$.each(stat_tables,function(idx, table){
//console.log(table);
table.draw();
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment