luci-base: fix "null" text appearing in modal

fix "null" text appearing in modal

UPDATE: added {} in for-loop for readability - CK

Signed-off-by: Andy Chiang <AndyChiang_git@outlook.com>
This commit is contained in:
Andy Chiang
2026-05-11 13:52:21 +07:00
committed by Florian Eckert
parent 55a4b33aaf
commit 7b02b9add5
2 changed files with 4 additions and 3 deletions
@@ -1376,11 +1376,12 @@
return null; return null;
if (Array.isArray(children)) { if (Array.isArray(children)) {
for (let i = 0; i < children.length; i++) for (let i = 0; i < children.length; i++) {
if (this.elem(children[i])) if (this.elem(children[i]))
node.appendChild(children[i]); node.appendChild(children[i]);
else if (children !== null && children !== undefined) else if (children[i] !== null && children[i] !== undefined)
node.appendChild(document.createTextNode(`${children[i]}`)); node.appendChild(document.createTextNode(`${children[i]}`));
}
return node.lastChild; return node.lastChild;
} }
@@ -4993,7 +4993,7 @@ const UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
if (info) if (info)
infoNode = E('p', _('%s').format(info)); infoNode = E('p', _('%s').format(info));
UI.prototype.showModal(_('Uploading file…'), [ progress, infoNode ? infoNode : null ]); UI.prototype.showModal(_('Uploading file…'), [ progress, infoNode ]);
const data = new FormData(); const data = new FormData();