Closed benny-adiwijaya closed 3 years ago
Hi @benny-adiwijaya, the backend updates the storage usage on each of those commands' execution. Can you provide an example of how you are working to retrieve the storage usage?
Hi @trannamtrung1st, this is example code
Application response for upload and delete
public class ApplicationUploadResponse : UploadResponse
{
public ApplicationUploadResponse(UploadResponse uploadResponse)
{
added = uploadResponse.added;
}
public long usage { get; set; }
public long quota { get; set; }
}
public class ApplicationRmResponse
{
public ApplicationRmResponse()
{
removed = new List
Added this code in CuztomizeResponse in FilesController else if (connectorResult.Response is UploadResponse uploadResponse) { connectorResult.Response = new ApplicationUploadResponse(uploadResponse) { quota = quota, usage = storageCache.Storage }; } else if (connectorResult.Response is RmResponse rmResponse) { connectorResult.Response = new ApplicationRmResponse() { removed = rmResponse.removed, quota = quota, usage = storageCache.Storage }; }
-And for javascript I added this elf.bind('upload', function (e, fm) { fm.getUI().data('_quota', e.data.quota); fm.getUI().data('_usage', e.data.usage); elfinderSetVolumeSize(); }); elf.bind('rm', function (e, fm) { fm.getUI().data('_quota', e.data.quota); fm.getUI().data('_usage', e.data.usage); elfinderSetVolumeSize(); });
When delete files, sometimes usage not updated
It's on purpose since I think 'delete' is not too important to be necessary to update storage instantly. So I decided to let a background worker do the calculation after the deletion, and it may run after you retrieving the usage. The instant update can affect the performance. However, I think I will enable an option to decide whether to use it or not.
Hi @benny-adiwijaya, I just updated the plugin to 1.2.5. Nothing changes, but it works as your expectation now.
yes, it works now.. thank you 👍
Hi,
Is it possible to update usage in every action like copy, upload, delete etc instead only when open directory? I already tried to do so but sometimes the usage value is not correct and won't change except when open directory