[pve-devel] [RFC manager] fix #3248: GUI: storage: upload multiple files

Matthias Heiserer m.heiserer at proxmox.com
Thu Jul 7 14:37:44 CEST 2022


On 01.07.2022 16:21, Dominik Csapak wrote:
> i can add the same isos multiple times. does that make sense?
> i know i can use different target names for them, but what would
> that be good for? imho preventing the user from uploading
> the same iso multiple times would be good
Same iso meaning two files with same name? afaic that's the only thing 
the browser allows us to see.

> i think what could make the whole thing a bit better in general is
> by having the selecting and uploading part split into two windows:
Good idea, will change it in v2

[...]
>> +    currentUploadIndex: 1,
>> +    startUpload: function() {
>> +        const me = this;
>> +        const view = me.getView();
>> +        const grid = me.lookup('grid');
>> +        view.taskDone();
>> +
> 
> what's that doing here?
> why do you call 'taskDone' at the beginning of the upload?
> 
to update the view, so that uploaded files are shown in the background :)
but you're right, it should be called when the upload is actually finished.
> 
>> +        const last = grid.store.last();
>> +        if (!last) {
>> +        me.getViewModel().set('uploadInProgress', false);
>> +        return;
>> +        }
>> +        const endId = parseInt(last.id.replace('pve-multiupload-', 
>> ''), 10);
>> +        let record;
>> +        while (!record && me.currentUploadIndex <= endId) {
>> +        record = 
>> grid.store.getById(`pve-multiupload-${me.currentUploadIndex++}`);
>> +        }
>> +
>> +        if (!record) {
>> +        me.getViewModel().set('uploadInProgress', false);
>> +        return;
>> +        }
> 
> AFAICS, you try to get the record with lowest id higher than 
> currentUploadIndex ?
> you rely here on extjs generated id, but you could handle that yourself by
> e.g. having a list with the added files (and use e.g. the filename as id)
> then you have simple lookup like
> 
> let filename = me.uploadList[currentUploadIndex];
> let record = grid.getStore().getById(filename);
> 
> does that make sense?Sounds good.

[...]





More information about the pve-devel mailing list