Commit 8783afe5 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

all ok

parent f5f81272
......@@ -699,7 +699,7 @@ class tx_nG6_eid {
$get_analyzes = true;
}
$octet = true;
if(trim(t3lib_div::_GP('octet')) == '1'){
if(trim(t3lib_div::_GP('bases')) == '1'){
$octet = false;
}
print json_encode(tx_nG6_db::select_storage_distribution($values, $by, $role, $get_analyzes, $octet));
......@@ -712,7 +712,7 @@ class tx_nG6_eid {
$get_analyzes = true;
}
$octet = true;
if(trim(t3lib_div::_GP('octet')) == '1'){
if(trim(t3lib_div::_GP('bases')) == '1'){
$octet = false;
}
$cumulate = false;
......
......@@ -117,7 +117,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</label>
<label class="radio">
<input type="radio" name="display_b" id="project_evolution" value="project_evolution">
display the projects creation evolution
display the projects creation evolution
</label>
<label class="radio">
<input type="radio" name="display_b" id="data_distribution" value="data_distribution">
......@@ -127,6 +127,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<input type="radio" name="display_b" id="data_evolution" value="data_evolution">
display the stored data evolution
</label>
<br />
<label class="checkbox" style="font-size:12px">
<input id="chk_includes_analyses" type="checkbox">
Includes analyses
</label>
<label class="checkbox" style="font-size:12px">
<input id="chk_display_bases" type="checkbox">
Should the size be in number of bases (default is in bytes)
</label>
<label class="checkbox" style="font-size:12px">
<input id="chk_cumulate" type="checkbox">
Cumulate values
</label>
<div class="row">
<div class="span2 offset9">
......@@ -138,21 +152,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<br />
<div id="highcharts_graph"> </div>
<br />
<!--
<div id="chart_options" class="form-inline">
<label class="control-label" style="font-size:12px" for="group_list">Select a user group</label>
<label class="checkbox" style="font-size:12px">
<input id="chk_get_analyzes" type="checkbox">
Includes analyses
</label>
<label class="checkbox" style="font-size:12px">
<input id="chk_get_cumulative" type="checkbox">
Cumulate values
</label>
</div>
-->
</div>
......
......@@ -83,146 +83,6 @@ $(function () {
};
});
/*
redraw_chart();
// group list
$("select[id=group_list]").change(function(){
redraw_chart();
});
// get analyzes ?
$("#chk_get_analyzes").change(function(){
redraw_chart();
});
// get cumulatives ?
$("#chk_get_cumulative").change(function(){
redraw_chart();
});
// lock/unlock chart options fields when ajax request is sent
function lock_fields(lock){
if(lock==1){
$("select[id=group_list]").attr('disabled','disabled');
$("#chk_get_analyzes").attr('disabled','disabled');
$("#chk_get_cumulative").attr('disabled','disabled');
$("#chart_options").attr('disabled','disabled');
}else{
$("select[id=group_list]").removeAttr('disabled');
$("#chk_get_analyzes").removeAttr('disabled');
$("#chk_get_cumulative").removeAttr('disabled');
$("#chart_options").removeAttr('disabled');
}
}
function get_octet_string_representation (size, round) {
var octets_link = new Array("bytes", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb"),
p = parseInt(Math.ceil(parseFloat(size.toString().length)/parseFloat(3) - parseFloat(1))),
pow_needed = p * 10;
pow_needed = Math.pow(2, pow_needed);
value = parseFloat(size)/parseFloat(pow_needed);
var tmp = value.toString().split(".");
if (tmp.length > 1 && round > 0) {
value = tmp[0] + "." + tmp[1].slice(0, round);
} else if (tmp.length > 1 && round == 0) {
value = tmp[0];
}
value = value + " " + octets_link[p];
return value;
}
// redraw chart
function redraw_chart(){
var size_url = "index.php?eID=tx_nG6&type=get_size_per_group";
size_url += "&usergroup="+$("#group_list option:selected").val();
size_url += "&data_folder="+$("#data_folder").val();
if($("#chk_get_analyzes").is(':checked')){
size_url += "&get_analyzes=1";
}else{
size_url += "&get_analyzes=0";
}
if($("#chk_get_cumulative").is(':checked')){
size_url += "&get_cumulatives=1";
}else{
size_url += "&get_cumulatives=0";
}
$.ajax({
url: size_url,
dataType: 'json',
beforeSend: function(){
$("#chart_options").addClass("chart-loading");
lock_fields(1);
},
success: function(val, status, xhr) {
chart = new Highcharts.StockChart({
chart: {
renderTo: 'size_chart'
},
rangeSelector: {
selected: 4
},
yAxis: {
min: 0,
labels: {
formatter: function() {
return get_octet_string_representation(this.value, 0);
}
},
plotLines: [{
value: 0,
width: 2,
color: 'silver'
}]
},
credits: { enabled: false },
tooltip: {
formatter: function() {
var s = Highcharts.dateFormat('%B %Y', this.x) + ":";
$.each(this.points, function(i, point) {
s += '<strong>'+ get_octet_string_representation(point.y, 2) +'</strong>';
});
return s;
}
},
series: [{name: "size", data: val}]
});
},
// ajax complete event : remove gif loading animation and unlock fields
complete: function(){
$("#chart_options").removeClass("chart-loading");
lock_fields(0);
}
});
}*/
$("#wf_monitoring").activewf({
serverURL: $("#server_url").val()
});
......@@ -238,6 +98,38 @@ $(function () {
});
function get_octet_string_representation (size, round) {
var octets_link = new Array("bytes", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb"),
p = parseInt(Math.ceil(parseFloat(size.toString().length)/parseFloat(3) - parseFloat(1))),
pow_needed = p * 10;
pow_needed = Math.pow(2, pow_needed);
value = parseFloat(size)/parseFloat(pow_needed);
var tmp = value.toString().split(".");
if (tmp.length > 1 && round > 0) {
value = tmp[0] + "." + tmp[1].slice(0, round);
} else if (tmp.length > 1 && round == 0) {
value = tmp[0];
}
value = value + " " + octets_link[p];
return value;
}
function get_base_string_representation (size, round) {
var bases_link = new Array("bases", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb"),
p = parseInt(Math.ceil(parseFloat(size.toString().length)/parseFloat(3) - parseFloat(1))),
pow_needed = p * 10;
pow_needed = Math.pow(2, pow_needed);
value = parseFloat(size)/parseFloat(pow_needed);
var tmp = value.toString().split(".");
if (tmp.length > 1 && round > 0) {
value = tmp[0] + "." + tmp[1].slice(0, round);
} else if (tmp.length > 1 && round == 0) {
value = tmp[0];
}
value = value + " " + bases_link[p];
return value;
}
function projectEvolutionHandler() {
$("table[id^=data_table_]").each(function(){
if ($(this).parent('div.dataTables_wrapper').first().css("display") != 'none') {
......@@ -253,8 +145,9 @@ function projectEvolutionHandler() {
$(this).find(":checked").each(function(){
values.push($(this).val());
});
var cumulate = $("#chk_cumulate").attr("checked") == "checked" ? "1" : "0" ;
$.ajax({
url: "index.php?eID=tx_nG6&type=project_evolution&by="+group_by+"&role="+role+"&values="+values.join(","),
url: "index.php?eID=tx_nG6&type=project_evolution&by="+group_by+"&role="+role+"&cumulate="+cumulate+"&values="+values.join(","),
dataType: 'json',
success: function(val, status, xhr) {
// reformat the data with values to integer
......@@ -364,15 +257,16 @@ function dataDistributionHandler(){
$(this).find(":checked").each(function(){
values.push($(this).val());
});
var bases = $("#chk_display_bases").attr("checked") == "checked" ? "1" : "0" ;
var analysis = $("#chk_includes_analyses").attr("checked") == "checked" ? "1" : "0" ;
$.ajax({
url: "index.php?eID=tx_nG6&type=data_distribution&by="+group_by+"&role="+role+"&values="+values.join(","),
url: "index.php?eID=tx_nG6&type=data_distribution&by="+group_by+"&role="+role+"&get_analyzes="+analysis+"&bases="+bases+"&values="+values.join(","),
dataType: 'json',
success: function(val, status, xhr) {
// reformat the data with values to integer
for (var i=0; i <val.length; i++ ) {
val[i][1] = parseInt(val[i][1]);
}
console.log(val)
$('#highcharts_graph').highcharts({
chart: {
width: 930
......@@ -426,8 +320,11 @@ function dataEvolutionHandler(){
$(this).find(":checked").each(function(){
values.push($(this).val());
});
var bases = $("#chk_display_bases").attr("checked") == "checked" ? "1" : "0" ;
var analysis = $("#chk_includes_analyses").attr("checked") == "checked" ? "1" : "0" ;
var cumulate = $("#chk_cumulate").attr("checked") == "checked" ? "1" : "0" ;
$.ajax({
url: "index.php?eID=tx_nG6&type=data_evolution&by="+group_by+"&role="+role+"&values="+values.join(","),
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
......@@ -444,15 +341,40 @@ function dataEvolutionHandler(){
},
yAxis: {
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);
}
}
},
plotLines: [{
value: 0,
width: 2,
color: 'silver'
}]
},
tooltip: {
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;
}
},
credits: { enabled: false },
series: [{name: "data storage size", data: val}]
});
$("#refresh_graph_btn").addClass("disabled")
$("#refresh_graph_btn").unbind("click");
}
......@@ -474,7 +396,7 @@ function updateButtons () {
$("#refresh_graph_btn").bind("click", dataEvolutionHandler);
}
$("#refresh_graph_btn").each(function(){
if ($("[type='checkbox']:checked").size() == 0) {
if ($("table[id^=data_table_]").find("[type='checkbox']:checked").size() == 0) {
// Add tooltip
$(this).attr('rel', 'tooltip');
// Disable button
......@@ -491,6 +413,22 @@ function updateButtons () {
$(this).tooltip('destroy');
}
});
document.getElementById("chk_includes_analyses").disabled = false;
document.getElementById("chk_display_bases").disabled = false;
document.getElementById("chk_cumulate").disabled = false;
if ($("input[name=display_b]:checked").val() == "project_distribution") {
document.getElementById("chk_includes_analyses").disabled = true;
document.getElementById("chk_display_bases").disabled = true;
document.getElementById("chk_cumulate").disabled = true;
} else if ($("input[name=display_b]:checked").val() == "project_evolution") {
document.getElementById("chk_includes_analyses").disabled = true;
document.getElementById("chk_display_bases").disabled = true;
} else if ($("input[name=display_b]:checked").val() == "data_distribution") {
document.getElementById("chk_cumulate").disabled = true;
}
}
function initStatMenuDataTable () {
......
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