X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=luci2%2Fhtdocs%2Fluci2%2Fview%2Fsystem.software.js;h=9f208d3255dd1cd1e7f096d3f21ed22512a614bf;hb=90469275848f4b6fc1a8d73371e8bb2e8c4fb129;hp=7526e01986b150be78133ed6e677fcedbac41a57;hpb=2f0e65dd27549ef4fde5b18588083968a59b66bd;p=project%2Fluci2%2Fui.git diff --git a/luci2/htdocs/luci2/view/system.software.js b/luci2/htdocs/luci2/view/system.software.js index 7526e01..9f208d3 100644 --- a/luci2/htdocs/luci2/view/system.software.js +++ b/luci2/htdocs/luci2/view/system.software.js @@ -1,7 +1,7 @@ L.ui.view.extend({ updateDiskSpace: function() { - return L.system.getInfo(function(info) { + return L.system.getDiskInfo().then(function(info) { $('#package_space').empty().append( new L.ui.progress({ value: info.root.used / 1024, @@ -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,8 +25,8 @@ L.ui.view.extend({ confirm: function() { L.ui.dialog(title, L.tr('Waiting for package manager …'), { style: 'wait' }); - action(name || pkgname).then(function(res) { - self.fetchInstalledList().then(function() { return fetchPackageList(); }).then(function() { + action(pkgname).then(function(res) { + self.fetchInstalledList().then(function() { return self.fetchPackageList(); }).then(function() { var output = [ ]; if (res.stdout) @@ -54,11 +50,11 @@ L.ui.view.extend({ fetchInstalledList: function() { var self = this; - return L.opkg.installedPackages(0, 0, '*', function(list) { + return L.opkg.installedPackages(0, 0, '*').then(function(list) { self.installedList = { }; for (var i = 0; i < list.length; i++) self.installedList[list[i][0]] = true; - }) + }); }, fetchPackageList: function(offset, interactive) @@ -92,7 +88,7 @@ L.ui.view.extend({ var install_disabled = $('#package_install').attr('disabled'); var self = this; - return action(offset, 100, pattern, function(list) { + return action(offset, 100, pattern).then(function(list) { var packageTable = new L.ui.table({ placeholder: L.tr('No matching packages found.'), columns: [ { @@ -116,12 +112,14 @@ L.ui.view.extend({ return $('