Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 2e75f9a

Browse files
committed
BUG: refs #0377. Conditionally render the pie chart only when it makes sense
Also reload the page when admin changes the quota value.
1 parent 5f87f26 commit 2e75f9a

File tree

1 file changed

+25
-20
lines changed

1 file changed

+25
-20
lines changed

modules/sizequota/public/js/config/config.folder.js

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ midas.sizequota.folder.successConfig = function(responseText, statusText, xhr, f
2525
}
2626
if(jsonResponse[0])
2727
{
28-
createNotice(jsonResponse[1],4000);
28+
location.reload();
2929
}
3030
else
3131
{
@@ -56,27 +56,32 @@ $(document).ready(function() {
5656
$('input[name="usedefault"]').change(midas.sizequota.folder.radioButtonChanged);
5757
midas.sizequota.folder.radioButtonChanged();
5858

59-
var quota = parseInt($('#quotaValue').html());
60-
var used = parseInt($('#usedSpaceValue').html());
61-
var free = quota - used;
62-
var hUsed = $('#hUsedSpaceValue').html();
63-
var hFree = $('#hFreeSpaceValue').html();
59+
var content = $('#quotaValue').html();
6460

65-
var data = [['Used space (' + hUsed + ')' , used], ['Free space (' + hFree + ')', free]];
66-
if(quota != '' && quota != 0)
61+
if(content != '' && content != 0)
6762
{
68-
$('#quotaChart').show();
69-
$.jqplot('quotaChart', [data], {
70-
seriesDefaults: {
71-
renderer: $.jqplot.PieRenderer,
72-
rendererOptions: {
73-
showDataLabels: true
63+
var quota = parseInt($('#quotaValue').html());
64+
var used = parseInt($('#usedSpaceValue').html());
65+
66+
if(used <= quota)
67+
{
68+
var free = quota - used;
69+
var hUsed = $('#hUsedSpaceValue').html();
70+
var hFree = $('#hFreeSpaceValue').html();
71+
var data = [['Used space (' + hUsed + ')' , used], ['Free space (' + hFree + ')', free]];
72+
$('#quotaChart').show();
73+
$.jqplot('quotaChart', [data], {
74+
seriesDefaults: {
75+
renderer: $.jqplot.PieRenderer,
76+
rendererOptions: {
77+
showDataLabels: true
78+
}
79+
},
80+
legend: {
81+
show: true,
82+
location: 'e'
7483
}
75-
},
76-
legend: {
77-
show: true,
78-
location: 'e'
79-
}
80-
});
84+
});
85+
}
8186
}
8287
});

0 commit comments

Comments
 (0)