From 90469275848f4b6fc1a8d73371e8bb2e8c4fb129 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 2 Oct 2013 16:05:35 +0000 Subject: [PATCH] luci2: fix package install / removal on button click in system/software view --- luci2/htdocs/luci2/view/system.software.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/luci2/htdocs/luci2/view/system.software.js b/luci2/htdocs/luci2/view/system.software.js index fc4d692..9f208d3 100644 --- a/luci2/htdocs/luci2/view/system.software.js +++ b/luci2/htdocs/luci2/view/system.software.js @@ -11,16 +11,12 @@ L.ui.view.extend({ }); }, - installRemovePackage: function(name) + installRemovePackage: function(pkgname, installed) { - if (typeof(name) != 'string') - name = undefined; - - var pkgname = (name || this.getAttribute('name')).replace(/^.*\//, ''); - var installed = name ? false : !!this.getAttribute('installed'); + var dspname = pkgname.replace(/^.+\//, ''); var action = installed ? L.opkg.removePackage : L.opkg.installPackage; - var title = (installed ? L.tr('Removing package "%s" …') : L.tr('Installing package "%s" …')).format(pkgname); - var confirm = (installed ? L.tr('Really remove package "%h" ?') : L.tr('Really install package "%h" ?')).format(pkgname); + var title = (installed ? L.tr('Removing package "%s" …') : L.tr('Installing package "%s" …')).format(dspname); + var confirm = (installed ? L.tr('Really remove package "%h" ?') : L.tr('Really install package "%h" ?')).format(dspname); var self = this; @@ -29,7 +25,7 @@ L.ui.view.extend({ confirm: function() { L.ui.dialog(title, L.tr('Waiting for package manager …'), { style: 'wait' }); - action(name || pkgname).then(function(res) { + action(pkgname).then(function(res) { self.fetchInstalledList().then(function() { return self.fetchPackageList(); }).then(function() { var output = [ ]; @@ -116,12 +112,14 @@ L.ui.view.extend({ return $('