Giter Site home page Giter Site logo

Comments (5)

trannamtrung1st avatar trannamtrung1st commented on May 27, 2024

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?

from elfinder.net.core.

benny-adiwijaya avatar benny-adiwijaya commented on May 27, 2024

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();
    }
    public List removed { get; set; }
    public long usage { get; set; }
    public long quota { get; set; }
    }

  • 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

from elfinder.net.core.

trannamtrung1st avatar trannamtrung1st commented on May 27, 2024

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.

from elfinder.net.core.

trannamtrung1st avatar trannamtrung1st commented on May 27, 2024

Hi @benny-adiwijaya, I just updated the plugin to 1.2.5. Nothing changes, but it works as your expectation now.

from elfinder.net.core.

benny-adiwijaya avatar benny-adiwijaya commented on May 27, 2024

yes, it works now.. thank you 👍

from elfinder.net.core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.