From 8731c5f64239bfdeceacd0001528fe0b6ce125cf Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 17 Nov 2016 09:43:12 +0100 Subject: [PATCH] firmware: condense updates into one tab --- .../app/models/OPNsense/Base/Menu/Menu.xml | 2 +- .../mvc/app/views/OPNsense/Core/firmware.volt | 88 ++++++++++--------- .../widgets/system_information.widget.php | 2 +- 3 files changed, 47 insertions(+), 45 deletions(-) diff --git a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml index f18126061..be6676e79 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml +++ b/src/opnsense/mvc/app/models/OPNsense/Base/Menu/Menu.xml @@ -29,7 +29,7 @@ - + diff --git a/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt b/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt index e99f68b8a..011a59f80 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt @@ -32,7 +32,6 @@ POSSIBILITY OF SUCH DAMAGE. * prepare for checking update status */ function updateStatusPrepare() { - $('#updatelist').empty(); $("#checkupdate_progress").addClass("fa fa-spinner fa-pulse"); $('#updatestatus').html("{{ lang._('Checking... (may take up to 30 seconds)') }}"); } @@ -61,6 +60,9 @@ POSSIBILITY OF SUCH DAMAGE. $("#upgrade").attr("style",""); // show upgrade list + $('#update_status').hide(); + $('#updatelist').show(); + $('#updatelist').empty(); $('#updatetab > a').tab('show'); $("#updatelist").html("{{ lang._('Package Name') }}" + "{{ lang._('Current Version') }}{{ lang._('New Version') }}" + @@ -70,20 +72,23 @@ POSSIBILITY OF SUCH DAMAGE. ''+row['old']+''+row['new']+'' + row['reason'] + ''); }); - } else { - $('#updatelist').html(""+data['status_msg']+""); - } - // update list so plugins sync as well - packagesInfo(); + // update list so plugins sync as well (no logs) + packagesInfo(false); + } else { + // update list so plugins sync as well (all) + packagesInfo(true); + } }); } /** * perform upgrade, install poller to update status */ - function upgrade(){ - $('#progresstab > a').tab('show'); + function upgrade() { + $('#updatelist').hide(); + $('#update_status').show(); + $('#updatetab > a').tab('show'); $('#updatestatus').html("{{ lang._('Upgrading...') }}"); $("#upgrade").attr("style",""); $("#upgrade_progress").addClass("fa fa-spinner fa-pulse"); @@ -122,7 +127,7 @@ POSSIBILITY OF SUCH DAMAGE. */ function action(pkg_act, pkg_name) { - $('#progresstab > a').tab('show'); + $('#updatetab > a').tab('show'); $('#updatestatus').html("{{ lang._('Executing...') }}"); ajaxCall('/api/core/firmware/'+pkg_act+'/'+pkg_name,{},function() { @@ -187,7 +192,7 @@ POSSIBILITY OF SUCH DAMAGE. $('#updatestatus').html("{{ lang._('Package manager update done. Please check for more updates.') }}"); } $("#upgrade").attr("style","display:none"); - packagesInfo(); + packagesInfo(true); } else if (data['status'] == 'reboot') { BootstrapDialog.show({ type:BootstrapDialog.TYPE_INFO, @@ -215,11 +220,10 @@ POSSIBILITY OF SUCH DAMAGE. /** * show package info */ - function packagesInfo() { + function packagesInfo(changelog_display) { ajaxGet('/api/core/firmware/info', {}, function (data, status) { $('#packageslist').empty(); $('#pluginlist').empty(); - $('#changeloglist').empty(); var installed = {}; $("#packageslist").html("{{ lang._('Name') }}" + @@ -228,8 +232,6 @@ POSSIBILITY OF SUCH DAMAGE. $("#pluginlist").html("{{ lang._('Name') }}" + "{{ lang._('Version') }}{{ lang._('Size') }}" + "{{ lang._('Comment') }}"); - $("#changeloglist").html("{{ lang._('Version') }}" + - "{{ lang._('Date') }}"); $.each(data['local'], function(index, row) { $('#packageslist').append( @@ -291,20 +293,27 @@ POSSIBILITY OF SUCH DAMAGE. ); } - $.each(data['changelog'], function(index, row) { - $('#changeloglist').append( - '' + row['version'] + '' + - '' + row['date'] + '' + - '' - ); - }); + if (changelog_display) { + $('#updatelist').empty(); - if (!data['changelog'].length) { - $('#changeloglist').append( - '{{ lang._('Check for updates to view changelog history.') }}' - ); + $("#updatelist").html("{{ lang._('Version') }}" + + "{{ lang._('Date') }}"); + + $.each(data['changelog'], function(index, row) { + $('#updatelist').append( + '' + row['version'] + '' + + '' + row['date'] + '' + + '' + ); + }); + + if (!data['changelog'].length) { + $('#updatelist').append( + '{{ lang._('Check for updates to view changelog history.') }}' + ); + } } // link buttons to actions @@ -346,8 +355,8 @@ POSSIBILITY OF SUCH DAMAGE. $('#message').attr('style', ''); } - // repopulate package information - packagesInfo(); + // populate package information + packagesInfo(true); ajaxGet('/api/core/firmware/running',{},function(data, status) { // if action is already running reattach now... @@ -480,15 +489,17 @@ POSSIBILITY OF SUCH DAMAGE.
diff --git a/src/www/widgets/widgets/system_information.widget.php b/src/www/widgets/widgets/system_information.widget.php index 130d3c6d2..79abf33ec 100644 --- a/src/www/widgets/widgets/system_information.widget.php +++ b/src/www/widgets/widgets/system_information.widget.php @@ -167,7 +167,7 @@ require_once("system.inc"); - +