update used space percent after each ajax call and display the notification
This commit is contained in:
parent
cdd07b3339
commit
1dd70ac506
|
@ -32,14 +32,18 @@ Files={
|
||||||
}
|
}
|
||||||
if(response.data !== undefined && response.data.uploadMaxFilesize !== undefined) {
|
if(response.data !== undefined && response.data.uploadMaxFilesize !== undefined) {
|
||||||
$('#max_upload').val(response.data.uploadMaxFilesize);
|
$('#max_upload').val(response.data.uploadMaxFilesize);
|
||||||
$('#data-upload-form a').attr('original-title', response.data.maxHumanFilesize);
|
$('#upload.button').attr('original-title', response.data.maxHumanFilesize);
|
||||||
|
$('#usedSpacePercent').val(response.data.usedSpacePercent);
|
||||||
|
Files.displayStorageWarnings();
|
||||||
}
|
}
|
||||||
if(response[0] == undefined) {
|
if(response[0] == undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(response[0].uploadMaxFilesize !== undefined) {
|
if(response[0].uploadMaxFilesize !== undefined) {
|
||||||
$('#max_upload').val(response[0].uploadMaxFilesize);
|
$('#max_upload').val(response[0].uploadMaxFilesize);
|
||||||
$('#data-upload-form a').attr('original-title', response[0].maxHumanFilesize);
|
$('#upload.button').attr('original-title', response[0].maxHumanFilesize);
|
||||||
|
$('#usedSpacePercent').val(response[0].usedSpacePercent);
|
||||||
|
Files.displayStorageWarnings();
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -65,6 +69,10 @@ Files={
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
displayStorageWarnings: function() {
|
displayStorageWarnings: function() {
|
||||||
|
if (!OC.Notification.isHidden()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var usedSpacePercent = $('#usedSpacePercent').val();
|
var usedSpacePercent = $('#usedSpacePercent').val();
|
||||||
if (usedSpacePercent > 98) {
|
if (usedSpacePercent > 98) {
|
||||||
OC.Notification.show(t('files', 'Your storage is full, files can not be updated or synced anymore!'));
|
OC.Notification.show(t('files', 'Your storage is full, files can not be updated or synced anymore!'));
|
||||||
|
|
|
@ -297,7 +297,7 @@ OC.Notification={
|
||||||
hide: function(callback) {
|
hide: function(callback) {
|
||||||
$("#notification").text('');
|
$("#notification").text('');
|
||||||
$('#notification').fadeOut('400', function(){
|
$('#notification').fadeOut('400', function(){
|
||||||
if ($("#notification").text() === '') {
|
if (OC.Notification.isHidden()) {
|
||||||
if (OC.Notification.getDefaultNotificationFunction) {
|
if (OC.Notification.getDefaultNotificationFunction) {
|
||||||
OC.Notification.getDefaultNotificationFunction.call();
|
OC.Notification.getDefaultNotificationFunction.call();
|
||||||
}
|
}
|
||||||
|
@ -318,6 +318,9 @@ OC.Notification={
|
||||||
notification.hide();
|
notification.hide();
|
||||||
notification.text(text);
|
notification.text(text);
|
||||||
notification.fadeIn().css("display","inline");
|
notification.fadeIn().css("display","inline");
|
||||||
|
},
|
||||||
|
isHidden: function() {
|
||||||
|
return ($("#notification").text() === '');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue