diff --git a/files/www/luci-static/resources/view/blue-merle.js b/files/www/luci-static/resources/view/blue-merle.js index bfafcc2..bd81de6 100644 --- a/files/www/luci-static/resources/view/blue-merle.js +++ b/files/www/luci-static/resources/view/blue-merle.js @@ -328,66 +328,6 @@ function handleSimSwap(ev) { function handleOpkg(ev) { - return new Promise(function(resolveFn, rejectFn) { - var cmd = ev.target.getAttribute('data-command'), - pkg = ev.target.getAttribute('data-package'), - rem = document.querySelector('input[name="autoremove"]'), - owr = document.querySelector('input[name="overwrite"]'), - i18n = document.querySelector('input[name="i18ninstall"]'); - - var dlg = ui.showModal(_('Executing package manager'), [ - E('p', { 'class': 'spinning' }, - _('Waiting for the opkg %h command to complete…').format(cmd)) - ]); - - var argv = [ cmd, '--force-removal-of-dependent-packages' ]; - - if (rem && rem.checked) - argv.push('--autoremove'); - - if (owr && owr.checked) - argv.push('--force-overwrite'); - - if (i18n && i18n.checked) - argv.push.apply(argv, i18n.getAttribute('data-packages').split(' ')); - - if (pkg != null) - argv.push(pkg); - - fs.exec_direct('/usr/libexec/opkg-call', argv, 'json').then(function(res) { - dlg.removeChild(dlg.lastChild); - - if (res.stdout) - dlg.appendChild(E('pre', [ res.stdout ])); - - if (res.stderr) { - dlg.appendChild(E('h5', _('Errors'))); - dlg.appendChild(E('pre', { 'class': 'errors' }, [ res.stderr ])); - } - - if (res.code !== 0) - dlg.appendChild(E('p', _('The opkg %h command failed with code %d.').format(cmd, (res.code & 0xff) || -1))); - - dlg.appendChild(E('div', { 'class': 'right' }, - E('div', { - 'class': 'btn', - 'click': L.bind(function(res) { - if (ui.menu && ui.menu.flushCache) - ui.menu.flushCache(); - - ui.hideModal(); - - if (res.code !== 0) - rejectFn(new Error(res.stderr || 'opkg error %d'.format(res.code))); - else - resolveFn(res); - }, this, res) - }, _('Dismiss')))); - }).catch(function(err) { - ui.addNotification(null, E('p', _('Unable to execute opkg %s command: %s').format(cmd, err))); - ui.hideModal(); - }); - }); } function handleUpload(ev)