Skip to content

Commit f7412b1

Browse files
committed
Sabnzbd: refresh table content on tab-click
History tab and warnings tab. Queue and diskspace is auto refreshed every 5 seconds.
1 parent bf656a7 commit f7412b1

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

interfaces/default/html/sabnzbd.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ <h1 class="page-header page-title">
1919
</form>
2020
<ul class="nav nav-tabs">
2121
<li class="active"><a href="#active" data-toggle="tab">Active</a></li>
22-
<li><a href="#history" data-toggle="tab">History</a></li>
23-
<li><a href="#warnings" data-toggle="tab">Warnings</a></li>
22+
<li><a href="#history" data-toggle="tab" id="tab-history">History</a></li>
23+
<li><a href="#warnings" data-toggle="tab" id="tab-warnings">Warnings</a></li>
2424
<li><a href="#sabnzbd-stats" data-toggle="tab">Stats</a></li>
2525
</ul>
2626
<div class="tab-content">

interfaces/default/js/sabnzbd.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ $(document).ready(function () {
4343
}, 5000);
4444
loadHistory();
4545
loadWarnings();
46+
47+
// reload tab content on tab click
48+
$('#tab-history').click(function() {
49+
loadHistory();
50+
})
51+
$('#tab-warnings').click(function() {
52+
loadWarnings();
53+
})
4654
});
4755

4856
function removeHistoryItem(id) {
@@ -75,10 +83,11 @@ function retryHistoryItem(id) {
7583

7684
function loadHistory() {
7785
$.ajax({
78-
url: WEBDIR + 'sabnzbd/GetHistory?limit=20',
86+
url: WEBDIR + 'sabnzbd/GetHistory?limit=30',
7987
type: 'get',
8088
dataType: 'json',
8189
success: function (data) {
90+
$('#history_table_body').empty();
8291
if (data.status == false) {
8392
$('#notification_area').addClass('alert alert-error');
8493
$('#notification_area').html('<strong>Error</strong> Could not connect to SABnzbd, go to <a href="' + WEBDIR + 'settings">settings</a>');
@@ -272,6 +281,7 @@ function loadWarnings() {
272281
type: 'get',
273282
dataType: 'json',
274283
success: function (data) {
284+
$('#warning_table_body').empty();
275285
if (data.warnings == 0) {
276286
var row = $('<tr>')
277287
row.append($('<td>').html('No warnings'));

0 commit comments

Comments
 (0)