Skip to content

WebUI: Show free disk space in add torrent window#23856

Open
Ryu481 wants to merge 3 commits intoqbittorrent:masterfrom
Ryu481:ShowFreeDiskSpaceInAddTorrentDialogue
Open

WebUI: Show free disk space in add torrent window#23856
Ryu481 wants to merge 3 commits intoqbittorrent:masterfrom
Ryu481:ShowFreeDiskSpaceInAddTorrentDialogue

Conversation

@Ryu481
Copy link
Contributor

@Ryu481 Ryu481 commented Feb 18, 2026

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:

WebUI free disk space

Desktop GUI for comparison:

Desktop GUI free disk space

void defaultSavePathAction();
void sendTestEmailAction();
void getDirectoryContentAction();
void getFreeSpaceAtPathAction();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to increase WebAPI version and this endpoint should be mentioned in WebAPI Changelog.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've increased the WebAPI version and added a mention in the changelog

@glassez glassez added WebUI WebUI-related issues/changes WebAPI WebAPI-related issues/changes labels Feb 18, 2026
@glassez glassez requested review from a team February 18, 2026 15:47
@Ryu481 Ryu481 force-pushed the ShowFreeDiskSpaceInAddTorrentDialogue branch from fb3a946 to bdb9aa2 Compare February 18, 2026 15:57
Comment on lines 104 to 109
const freeSpaceInputs = document.querySelectorAll(".pathFreeSpace:not(.freeSpaceAutoFillInitialized)");
for (const input of freeSpaceInputs) {
input.addEventListener("input", function(event) { showFreeSpace(this); });
input.classList.add("freeSpaceAutoFillInitialized");
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move it after const fileInputs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant like this:

        const directoryInputs = ...

        const fileInputs = ...

        const freeSpaceInputs = ...

Copy link
Member

@Chocobo1 Chocobo1 Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved it to a new file freespaceAutofill.js

.catch(error => {});
};

const filloutFreeSpace = (freeSpace) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can consider inline this function since it is so small.

@Chocobo1 Chocobo1 added this to the 5.3 milestone Feb 19, 2026
@Ryu481 Ryu481 force-pushed the ShowFreeDiskSpaceInAddTorrentDialogue branch 2 times, most recently from 6aa8fc4 to e671412 Compare February 19, 2026 14:03
@Ryu481 Ryu481 force-pushed the ShowFreeDiskSpaceInAddTorrentDialogue branch from e671412 to 716e71a Compare February 19, 2026 15:16
Comment on lines 289 to 290
size.setAttribute("size", window.qBittorrent.Misc.friendlyUnit(metadata.info.length, false));
size.textContent = window.qBittorrent.pathAutofill.showFreeSpace({ value: document.getElementById("savepath").value });
Copy link
Member

@Chocobo1 Chocobo1 Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

@Ryu481 Ryu481 Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try to find a solution how this could be simplified.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have moved all code to addtorrent.js and simplified it as much as I could. setAttribute and getAttribute aren't used anymore.

@Ryu481 Ryu481 force-pushed the ShowFreeDiskSpaceInAddTorrentDialogue branch 3 times, most recently from 168e8aa to dc5e6a8 Compare February 21, 2026 15:09
In this PR the free disk space gets added to the add torrent window in the Web UI
@Ryu481 Ryu481 force-pushed the ShowFreeDiskSpaceInAddTorrentDialogue branch 4 times, most recently from 85e6efc to f4dc0f5 Compare February 23, 2026 15:05
@Ryu481 Ryu481 force-pushed the ShowFreeDiskSpaceInAddTorrentDialogue branch from f4dc0f5 to 25bef03 Compare February 23, 2026 15:17
@Ryu481 Ryu481 requested a review from Chocobo1 February 23, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebAPI WebAPI-related issues/changes WebUI WebUI-related issues/changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants