Merge pull request #7592 from nextcloud/update-quota-on-files-upload
Update quota on files upload
This commit is contained in:
commit
08cbfb6c6b
|
@ -1768,7 +1768,6 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: parse remaining quota from PROPFIND response
|
|
||||||
this.updateStorageStatistics(true);
|
this.updateStorageStatistics(true);
|
||||||
|
|
||||||
// first entry is the root
|
// first entry is the root
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
state.dir = null;
|
state.dir = null;
|
||||||
state.call = null;
|
state.call = null;
|
||||||
Files.updateMaxUploadFilesize(response);
|
Files.updateMaxUploadFilesize(response);
|
||||||
|
Files.updateQuota(response);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -77,6 +78,32 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateQuota:function(response) {
|
||||||
|
if (response === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (response.data !== undefined
|
||||||
|
&& response.data.quota !== undefined
|
||||||
|
&& response.data.used !== undefined
|
||||||
|
&& response.data.usedSpacePercent !== undefined) {
|
||||||
|
var humanUsed = OC.Util.humanFileSize(response.data.used, true);
|
||||||
|
var humanQuota = OC.Util.humanFileSize(response.data.quota, true);
|
||||||
|
if (response.data.quota > 0) {
|
||||||
|
$('#quota').attr('data-original-title', Math.floor(response.data.used/response.data.quota*1000)/10 + '%');
|
||||||
|
$('#quota progress').val(response.data.usedSpacePercent);
|
||||||
|
$('#quotatext').text(t('files', '{used} of {quota} used', {used: humanUsed, quota: humanQuota}));
|
||||||
|
} else {
|
||||||
|
$('#quotatext').text(t('files', '{used} used', {used: humanUsed}));
|
||||||
|
}
|
||||||
|
if (response.data.usedSpacePercent > 80) {
|
||||||
|
$('#quota progress').addClass('warn');
|
||||||
|
} else {
|
||||||
|
$('#quota progress').removeClass('warn');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fix path name by removing double slash at the beginning, if any
|
* Fix path name by removing double slash at the beginning, if any
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -56,6 +56,8 @@ class Helper {
|
||||||
'uploadMaxFilesize' => $maxUploadFileSize,
|
'uploadMaxFilesize' => $maxUploadFileSize,
|
||||||
'maxHumanFilesize' => $maxHumanFileSize,
|
'maxHumanFilesize' => $maxHumanFileSize,
|
||||||
'freeSpace' => $storageInfo['free'],
|
'freeSpace' => $storageInfo['free'],
|
||||||
|
'quota' => $storageInfo['quota'],
|
||||||
|
'used' => $storageInfo['used'],
|
||||||
'usedSpacePercent' => (int)$storageInfo['relative'],
|
'usedSpacePercent' => (int)$storageInfo['relative'],
|
||||||
'owner' => $storageInfo['owner'],
|
'owner' => $storageInfo['owner'],
|
||||||
'ownerDisplayName' => $storageInfo['ownerDisplayName'],
|
'ownerDisplayName' => $storageInfo['ownerDisplayName'],
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<li id="quota" class="pinned <?php
|
<li id="quota" class="pinned <?php p($pinned===0?'first-pinned ':'') ?><?php
|
||||||
if ($_['quota'] !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
|
if ($_['quota'] !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
|
||||||
?>has-tooltip" title="<?php p($_['usage_relative'] . '%');
|
?>has-tooltip" title="<?php p($_['usage_relative'] . '%');
|
||||||
} ?>">
|
} ?>">
|
||||||
|
|
Loading…
Reference in New Issue