From 4adfc239b0eb8778319002e672e7a2cd6e9f35b5 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Sat, 11 Nov 2017 13:19:15 +0100 Subject: [PATCH] firmware jQuery 3 compatibility issues, for https://github.com/opnsense/core/issues/1739 (the other pages seem fine sofar) --- .../mvc/app/views/OPNsense/Core/firmware.volt | 77 ++++++++++++------- 1 file changed, 49 insertions(+), 28 deletions(-) diff --git a/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt b/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt index 7224f31a8..67da7c000 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt @@ -70,13 +70,13 @@ POSSIBILITY OF SUCH DAMAGE. // show upgrade list $('#update_status').hide(); $('#updatelist').show(); - $('#updatelist').empty(); + $('#updatelist > tbody').empty(); $('#updatetab > a').tab('show'); - $("#updatelist").html("{{ lang._('Package Name') }}" + + $("#updatelist > thead").html("{{ lang._('Package Name') }}" + "{{ lang._('Current Version') }}{{ lang._('New Version') }}" + "{{ lang._('Required Action') }}"); $.each(data['all_packages'], function (index, row) { - $('#updatelist').append(''+row['name']+'' + + $('#updatelist > tbody').append(''+row['name']+'' + ''+row['old']+''+row['new']+'' + row['reason'] + ''); @@ -121,7 +121,7 @@ POSSIBILITY OF SUCH DAMAGE. $("#upgrade_progress" + maj_suffix).addClass("fa fa-spinner fa-pulse"); ajaxCall('/api/core/firmware/upgrade',{upgrade:$.upgrade_action},function() { - $('#updatelist').empty(); + $('#updatelist > tbody, thead').empty(); setTimeout(trackStatus, 500); }); } @@ -139,7 +139,7 @@ POSSIBILITY OF SUCH DAMAGE. $("#audit_progress").addClass("fa fa-spinner fa-pulse"); ajaxCall('/api/core/firmware/audit', {}, function () { - $('#updatelist').empty(); + $('#updatelist > tbody, thead').empty(); setTimeout(trackStatus, 500); }); } @@ -207,7 +207,7 @@ POSSIBILITY OF SUCH DAMAGE. $.upgrade_action = 'action'; ajaxCall('/api/core/firmware/'+pkg_act+'/'+pkg_name,{},function() { - $('#updatelist').empty(); + $('#updatelist > tbody, thead').empty(); setTimeout(trackStatus, 500); }); } @@ -316,17 +316,10 @@ POSSIBILITY OF SUCH DAMAGE. */ function packagesInfo(changelog_display) { ajaxGet('/api/core/firmware/info', {}, function (data, status) { - $('#packageslist').empty(); - $('#pluginlist').empty(); + $('#packageslist > tbody').empty(); + $('#pluginlist > tbody').empty(); var installed = {}; - $("#packageslist").html("{{ lang._('Name') }}" + - "{{ lang._('Version') }}{{ lang._('Size') }}" + - "{{ lang._('License') }}{{ lang._('Comment') }}"); - $("#pluginlist").html("{{ lang._('Name') }}" + - "{{ lang._('Version') }}{{ lang._('Size') }}" + - "{{ lang._('Comment') }}"); - var local_count = 0; var plugin_count = 0; var changelog_count = 0; @@ -341,7 +334,7 @@ POSSIBILITY OF SUCH DAMAGE. } else { return 1; } - $('#packageslist').append( + $('#packageslist > tbody').append( '' + '' + row['name'] + '' + '' + row['version'] + '' + @@ -367,7 +360,7 @@ POSSIBILITY OF SUCH DAMAGE. }); if (local_count == 0) { - $('#packageslist').append( + $('#packageslist > tbody').append( '{{ lang._('No packages were found on your system. Please call for help.') }}' ); } @@ -388,7 +381,7 @@ POSSIBILITY OF SUCH DAMAGE. // this state overwrites installed on purpose status_text = ' ({{ lang._('orphaned') }})'; } - $('#pluginlist').append( + $('#pluginlist > tbody').append( '' + '' + bold_on + row['name'] + status_text + bold_off + '' + '' + bold_on + row['version'] + bold_off + '' + '' + bold_on + row['flatsize'] + bold_off + '' + @@ -410,15 +403,14 @@ POSSIBILITY OF SUCH DAMAGE. }); if (plugin_count == 0) { - $('#pluginlist').append( + $('#pluginlist > tbody').append( '{{ lang._('Check for updates to view available plugins.') }}' ); } if (changelog_display) { - $('#updatelist').empty(); - - $("#updatelist").html("{{ lang._('Version') }}" + + $("#updatelist > tbody").empty(); + $("#updatelist > thead").html("{{ lang._('Version') }}" + "{{ lang._('Date') }}"); installed_version = data['product_version'].replace(/[_-].*/, ''); @@ -436,7 +428,7 @@ POSSIBILITY OF SUCH DAMAGE. bold_off = ''; } - $('#updatelist').append( + $('#updatelist > tbody').append( ' changelog_max ? ' class="changelog-hidden" style="display: none;" ' : '' ) + '>' + bold_on + row['version'] + status_text + bold_off + '' + bold_on + row['date'] + bold_off + '' + '