firmware jQuery 3 compatibility issues, for https://github.com/opnsense/core/issues/1739

(the other pages seem fine sofar)
This commit is contained in:
Ad Schellevis 2017-11-11 13:19:15 +01:00
parent 4f9caaa55b
commit 4adfc239b0

View File

@ -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("<tr><th>{{ lang._('Package Name') }}</th>" +
$("#updatelist > thead").html("<tr><th>{{ lang._('Package Name') }}</th>" +
"<th>{{ lang._('Current Version') }}</th><th>{{ lang._('New Version') }}</th>" +
"<th>{{ lang._('Required Action') }}</th></tr>");
$.each(data['all_packages'], function (index, row) {
$('#updatelist').append('<tr><td>'+row['name']+'</td>' +
$('#updatelist > tbody').append('<tr><td>'+row['name']+'</td>' +
'<td>'+row['old']+'</td><td>'+row['new']+'</td><td>' +
row['reason'] + '</td></tr>');
@ -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("<tr><th>{{ lang._('Name') }}</th>" +
"<th>{{ lang._('Version') }}</th><th>{{ lang._('Size') }}</th>" +
"<th>{{ lang._('License') }}</th><th>{{ lang._('Comment') }}</th><th></th></tr>");
$("#pluginlist").html("<tr><th>{{ lang._('Name') }}</th>" +
"<th>{{ lang._('Version') }}</th><th>{{ lang._('Size') }}</th>" +
"<th>{{ lang._('Comment') }}</th><th></th></tr>");
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(
'<tr>' +
'<td>' + row['name'] + '</td>' +
'<td>' + row['version'] + '</td>' +
@ -367,7 +360,7 @@ POSSIBILITY OF SUCH DAMAGE.
});
if (local_count == 0) {
$('#packageslist').append(
$('#packageslist > tbody').append(
'<tr><td colspan=5>{{ lang._('No packages were found on your system. Please call for help.') }}</td></tr>'
);
}
@ -388,7 +381,7 @@ POSSIBILITY OF SUCH DAMAGE.
// this state overwrites installed on purpose
status_text = ' ({{ lang._('orphaned') }})';
}
$('#pluginlist').append(
$('#pluginlist > tbody').append(
'<tr>' + '<td>' + bold_on + row['name'] + status_text + bold_off + '</td>' +
'<td>' + bold_on + row['version'] + bold_off + '</td>' +
'<td>' + bold_on + row['flatsize'] + bold_off + '</td>' +
@ -410,15 +403,14 @@ POSSIBILITY OF SUCH DAMAGE.
});
if (plugin_count == 0) {
$('#pluginlist').append(
$('#pluginlist > tbody').append(
'<tr><td colspan=5>{{ lang._('Check for updates to view available plugins.') }}</td></tr>'
);
}
if (changelog_display) {
$('#updatelist').empty();
$("#updatelist").html("<tr><th>{{ lang._('Version') }}</th>" +
$("#updatelist > tbody").empty();
$("#updatelist > thead").html("<tr><th>{{ lang._('Version') }}</th>" +
"<th>{{ lang._('Date') }}</th><th></th></tr>");
installed_version = data['product_version'].replace(/[_-].*/, '');
@ -436,7 +428,7 @@ POSSIBILITY OF SUCH DAMAGE.
bold_off = '</b>';
}
$('#updatelist').append(
$('#updatelist > tbody').append(
'<tr' + (changelog_count > changelog_max ? ' class="changelog-hidden" style="display: none;" ' : '' ) +
'><td>' + bold_on + row['version'] + status_text + bold_off + '</td><td>' + bold_on + row['date'] + bold_off + '</td>' +
'<td><button class="btn btn-default btn-xs act_changelog" data-version="' + row['version'] + '" ' +
@ -446,13 +438,13 @@ POSSIBILITY OF SUCH DAMAGE.
});
if (!data['changelog'].length) {
$('#updatelist').append(
$('#updatelist > tbody').append(
'<tr><td colspan=3>{{ lang._('Check for updates to view changelog history.') }}</td></tr>'
);
}
if (changelog_count > changelog_max) {
$('#updatelist').append(
$('#updatelist > tbody').append(
'<tr class= "changelog-full"><td colspan=3><a id="changelog-act" href="#">{{ lang._('Click to view full changelog history.') }}</a></td></tr>'
);
$("#changelog-act").click(function(event) {
@ -693,13 +685,42 @@ POSSIBILITY OF SUCH DAMAGE.
<div class="tab-content content-box tab-content">
<div id="updates" class="tab-pane fade in active">
<textarea name="output" id="update_status" class="form-control" rows="25" wrap="hard" readonly style="max-width:100%; font-family: monospace; display: none;"></textarea>
<table class="table table-striped table-condensed table-responsive" id="updatelist"></table>
<table class="table table-striped table-condensed table-responsive" id="updatelist">
<thead>
</thead>
<tbody></tbody>
</table>
</div>
<div id="plugins" class="tab-pane fade in">
<table class="table table-striped table-condensed table-responsive" id="pluginlist"></table>
<table class="table table-striped table-condensed table-responsive" id="pluginlist">
<thead>
<tr>
<th>{{ lang._('Name') }}</th>
<th>{{ lang._('Version') }}</th>
<th>{{ lang._('Size') }}</th>
<th>{{ lang._('Comment') }}</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div id="packages" class="tab-pane fade in">
<table class="table table-striped table-condensed table-responsive" id="packageslist"></table>
<table class="table table-striped table-condensed table-responsive" id="packageslist">
<thead>
<tr>
<th>{{ lang._('Name') }}</th>
<th>{{ lang._('Version') }}</th>
<th>{{ lang._('Size') }}</th>
<th>{{ lang._('License') }}</th>
<th>{{ lang._('Comment') }}</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div id="settings" class="tab-pane fade in">
<table class="table table-striped table-responsive">