From cc69f29f31ff0ecf2d646b2cd7d2eff038f2dddc Mon Sep 17 00:00:00 2001 From: Christian Korber Date: Thu, 7 May 2026 09:20:32 +0200 Subject: [PATCH] luci-base: add additional information to upload modal Sometimes it would be useful to display additional information in the modal (e.g. if upload takes some time on slower devices and feedback it so the user knows about the delay). Signed-off-by: Christian Korber --- modules/luci-base/htdocs/luci-static/resources/ui.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 706cc7f13b..2952ffe0cd 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -4924,12 +4924,16 @@ const UI = baseclass.extend(/** @lends LuCI.ui.prototype */ { * An optional DOM text node whose content text is set to the progress * percentage value during file upload. * + * @param {string} [info] + * An optional string that carries additional information that should + * be shown under the progressbar. + * * @returns {Promise} * Returns a promise resolving to a file upload status object on success * or rejecting with an error in case the upload failed or has been * cancelled by the user. */ - uploadFile(path, progressStatusNode) { + uploadFile(path, progressStatusNode, info) { return new Promise((resolveFn, rejectFn) => { UI.prototype.showModal(_('Uploading file…'), [ E('p', _('Please select the file to upload.')), @@ -4985,7 +4989,11 @@ const UI = baseclass.extend(/** @lends LuCI.ui.prototype */ { const progress = E('div', { 'class': 'cbi-progressbar', 'title': '0%' }, E('div', { 'style': 'width:0' })); - UI.prototype.showModal(_('Uploading file…'), [ progress ]); + let infoNode; + if (info) + infoNode = E('p', _('%s').format(info)); + + UI.prototype.showModal(_('Uploading file…'), [ progress, infoNode ? infoNode : null ]); const data = new FormData();