luci-base: add additional information to upload modal
authorChristian Korber <redacted>
Thu, 7 May 2026 07:20:32 +0000 (09:20 +0200)
committerFlorian Eckert <redacted>
Thu, 7 May 2026 08:12:53 +0000 (10:12 +0200)
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 <redacted>
modules/luci-base/htdocs/luci-static/resources/ui.js

index 706cc7f13b193cf281722a41a1e073949cdf22a9..2952ffe0cd2063707ccb46ec5caf1696d780d718 100644 (file)
@@ -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<LuCI.ui.FileUploadReply>}
         * 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();
 
git clone https://git.99rst.org/PROJECT