WebUI: Show free disk space in add torrent window#23856
WebUI: Show free disk space in add torrent window#23856Ryu481 wants to merge 3 commits intoqbittorrent:masterfrom
Conversation
| void defaultSavePathAction(); | ||
| void sendTestEmailAction(); | ||
| void getDirectoryContentAction(); | ||
| void getFreeSpaceAtPathAction(); |
There was a problem hiding this comment.
You need to increase WebAPI version and this endpoint should be mentioned in WebAPI Changelog.
There was a problem hiding this comment.
I've increased the WebAPI version and added a mention in the changelog
fb3a946 to
bdb9aa2
Compare
| const freeSpaceInputs = document.querySelectorAll(".pathFreeSpace:not(.freeSpaceAutoFillInitialized)"); | ||
| for (const input of freeSpaceInputs) { | ||
| input.addEventListener("input", function(event) { showFreeSpace(this); }); | ||
| input.classList.add("freeSpaceAutoFillInitialized"); | ||
| } | ||
|
|
There was a problem hiding this comment.
Please move it after const fileInputs.
There was a problem hiding this comment.
For the savepath field const directoryInputs would be correct but I'm not sure if this is save because const directoryInputs is used in other places too.
There was a problem hiding this comment.
I meant like this:
const directoryInputs = ...
const fileInputs = ...
const freeSpaceInputs = ...There was a problem hiding this comment.
Also I think you should not make changes to pathAutofill.js and instead you should move your code to a new file freespaceAutofill.js.
Or even move it to addtorrent.js if it isn't being reused elsewhere.
There was a problem hiding this comment.
I have moved it to a new file freespaceAutofill.js
| .catch(error => {}); | ||
| }; | ||
|
|
||
| const filloutFreeSpace = (freeSpace) => { |
There was a problem hiding this comment.
You can consider inline this function since it is so small.
6aa8fc4 to
e671412
Compare
e671412 to
716e71a
Compare
| size.setAttribute("size", window.qBittorrent.Misc.friendlyUnit(metadata.info.length, false)); | ||
| size.textContent = window.qBittorrent.pathAutofill.showFreeSpace({ value: document.getElementById("savepath").value }); |
There was a problem hiding this comment.
I think this approach is too complex for getting free space size. I would instead define a simple async function to get the free space value rather than setAttribute and getAttribute, etc.
There was a problem hiding this comment.
I will try to find a solution how this could be simplified.
There was a problem hiding this comment.
I have moved all code to addtorrent.js and simplified it as much as I could. setAttribute and getAttribute aren't used anymore.
168e8aa to
dc5e6a8
Compare
In this PR the free disk space gets added to the add torrent window in the Web UI
85e6efc to
f4dc0f5
Compare
f4dc0f5 to
25bef03
Compare
In this PR I'm going to add the free disk space in the add torrent window. It will be shown in the same way as it is currently shown in the desktop GUI.
WebUI with this PR:
Desktop GUI for comparison: