mirror of
https://github.com/SickGear/SickGear.git
synced 2025-03-15 09:07:43 +00:00
Merge pull request #721 from JackDandy/feature/ChangeManageFailed
Add "Order" table column and list failed from newest to oldest by def…
This commit is contained in:
commit
abb6a52d32
4 changed files with 119 additions and 105 deletions
|
@ -90,6 +90,10 @@
|
||||||
* Change CPU throttling on General Config/Advanced to "Disabled" by default for new installs
|
* Change CPU throttling on General Config/Advanced to "Disabled" by default for new installs
|
||||||
* Change provider OMGWTFNZBS api url and auto reject nuked releases
|
* Change provider OMGWTFNZBS api url and auto reject nuked releases
|
||||||
* Change Search Provider page to load torrent settings only when Search torrents is enabled in Search Settings
|
* Change Search Provider page to load torrent settings only when Search torrents is enabled in Search Settings
|
||||||
|
* Add "Order" table column and list failed from newest to oldest wherever possible on Manage Failed Downloads
|
||||||
|
* Add number of items shown to Manage Failed Downloads table footer and indicate if number of shown items is limited
|
||||||
|
* Add sorting to "Provider" column and fix sorting of "Remove" column on Manage Failed Downloads
|
||||||
|
* Fix "Limit" drop down on Manage Failed Downloads
|
||||||
|
|
||||||
|
|
||||||
### 0.11.12 (2016-06-20 02:20:00 UTC)
|
### 0.11.12 (2016-06-20 02:20:00 UTC)
|
||||||
|
|
|
@ -14,74 +14,66 @@
|
||||||
#import os.path
|
#import os.path
|
||||||
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl')
|
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_top.tmpl')
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
<!--
|
|
||||||
\$(document).ready(function()
|
|
||||||
{
|
|
||||||
\$('#failedTable:has(tbody tr)').tablesorter({
|
|
||||||
widgets: ['zebra'],
|
|
||||||
sortList: [[0,0]],
|
|
||||||
headers: { 3: { sorter: false } }
|
|
||||||
});
|
|
||||||
\$('#limit').change(function(){
|
|
||||||
url = '$sbRoot/manage/failedDownloads/?limit='+\$(this).val()
|
|
||||||
window.location.href = url
|
|
||||||
});
|
|
||||||
});
|
|
||||||
//-->
|
|
||||||
</script>
|
|
||||||
<script type="text/javascript" src="$sbRoot/js/failedDownloads.js?v=$sbPID"></script>
|
<script type="text/javascript" src="$sbRoot/js/failedDownloads.js?v=$sbPID"></script>
|
||||||
|
<style>
|
||||||
|
.tablesorter .tablesorter-header{padding: 4px 18px 4px 5px}
|
||||||
|
</style>
|
||||||
|
|
||||||
#if $varExists('header')
|
#if $varExists('header')
|
||||||
<h1 class="header">$header</h1>
|
<h1 class="header">$header</h1>
|
||||||
#else
|
#else
|
||||||
<h1 class="title">$title</h1>
|
<h1 class="title">$title</h1>
|
||||||
#end if
|
#end if
|
||||||
#set selected = ' selected="selected"'
|
#set selected = ' selected="selected"'
|
||||||
<div class="h2footer pull-right"><b>Limit:</b>
|
<div class="h2footer pull-right"><b>Limit:</b>
|
||||||
<select id="limit" name="limit" class="form-control form-control-inline input-sm">
|
<select id="limit" name="limit" class="form-control form-control-inline input-sm">
|
||||||
<option value="0"#if '0' == $limit then $selected else ''#>All</option>
|
<option value="0"#if '0' == $limit then $selected else ''#>All</option>
|
||||||
<option value="100"#if '100' == $limit then $selected else ''#>100</option>
|
<option value="100"#if '100' == $limit then $selected else ''#>100</option>
|
||||||
<option value="250"#if '250' == $limit then $selected else ''#>250</option>
|
<option value="250"#if '250' == $limit then $selected else ''#>250</option>
|
||||||
<option value="500"#if '500' == $limit then $selected else ''#>500</option>
|
<option value="500"#if '500' == $limit then $selected else ''#>500</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table id="failedTable" class="sickbeardTable tablesorter" border="0">
|
<table id="failedTable" class="sickbeardTable tablesorter" border="0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="text-nowrap text-left" style="width:75%">Release</th>
|
<th style="width:1%">Order</th>
|
||||||
<th style="width:10%">Size</th>
|
<th class="text-nowrap text-left" style="width:74%">Release</th>
|
||||||
<th style="width:14%">Provider</th>
|
<th style="width:10%">Size</th>
|
||||||
<th style="width:1%">Remove<br />
|
<th style="width:14%">Provider</th>
|
||||||
<input id="removeCheck" type="checkbox" class="bulkCheck">
|
<th style="width:1%;padding: 4px 18px">Remove<br />
|
||||||
</th>
|
<input id="removeCheck" type="checkbox" class="bulkCheck">
|
||||||
</tr>
|
</th>
|
||||||
</thead>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
<tfoot>
|
#set $oldest = $len($failedResults)
|
||||||
<tr>
|
<tfoot>
|
||||||
<td rowspan="1" colspan="4">
|
<tr>
|
||||||
<input id="submitMassRemove" type="button" class="btn pull-right" value="Submit">
|
<td colspan="4" class="text-left">
|
||||||
</td>
|
$oldest items shown#if $getVar('over_limit', False)#, more are available by changing the limit#end if#
|
||||||
</tr>
|
</td>
|
||||||
</tfoot>
|
<td>
|
||||||
|
<input id="submitMassRemove" type="button" class="btn" value="Submit">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
#for $hItem in $failedResults
|
#set $order = $oldest
|
||||||
<tr>
|
#for $hItem in $failedResults[::-1]
|
||||||
<td class="text-nowrap text-left">#echo re.sub('"', '', $hItem['release'])#</td>
|
#set $provider = $providers.getProviderClass($generic.GenericProvider.make_id($hItem['provider']))
|
||||||
<td>#echo ($hItem['size'], '?')[-1 == $hItem['size']]#</td>
|
#set $provider_name = None is not $provider and $provider.name or 'missing provider'
|
||||||
#set $provider = $providers.getProviderClass($generic.GenericProvider.make_id($hItem['provider']))
|
#set $provider_image = None is not $provider and $provider.image_name() or 'missing.png'
|
||||||
#if None is not $provider:
|
<tr>
|
||||||
<td><img src="$sbRoot/images/providers/<%= provider.image_name() %>" width="16" height="16" alt="$provider.name" title="$provider.name" /></td>
|
<td data-order="$order">#echo 1 == $order and 'Newest' or $oldest == $order and 'Oldest' or '-'##set $order -= 1#</td>
|
||||||
#else
|
<td class="text-nowrap text-left">#echo re.sub('"', '', $hItem['release'])#</td>
|
||||||
<td><img src="$sbRoot/images/providers/missing.png" width="16" height="16" alt="missing provider" title="missing provider" /></td>
|
<td>#echo ($hItem['size'], '?')[-1 == $hItem['size']]#</td>
|
||||||
#end if
|
<td><img src="$sbRoot/images/providers/$provider_image" width="16" height="16" alt="$provider_name" title="$provider_name"></td>
|
||||||
<td><input type="checkbox" class="removeCheck" id="remove-#echo re.sub('"', '___', $hItem['release'])#" /></td>
|
<td data-order="0"><input type="checkbox" class="removeCheck" id="remove-#echo re.sub('"', '___', $hItem['release'])#"></td>
|
||||||
</tr>
|
</tr>
|
||||||
#end for
|
#end for
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')
|
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_bottom.tmpl')
|
||||||
|
|
|
@ -1,60 +1,75 @@
|
||||||
$(document).ready(function(){
|
$(document).ready(function() {
|
||||||
$('#submitMassRemove').click(function(){
|
|
||||||
|
|
||||||
var removeArr = new Array()
|
$('#limit').change(function() {
|
||||||
|
window.location.href = sbRoot + '/manage/failedDownloads/?limit=' + $(this).val();
|
||||||
|
});
|
||||||
|
|
||||||
$('.removeCheck').each(function() {
|
$('#submitMassRemove').click(function() {
|
||||||
if (this.checked == true) {
|
|
||||||
removeArr.push($(this).attr('id').split('-')[1])
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (removeArr.length == 0)
|
var removeArr = [];
|
||||||
return false
|
|
||||||
|
|
||||||
url = sbRoot + '/manage/failedDownloads?toRemove='+removeArr.join('|')
|
$('.removeCheck').each(function() {
|
||||||
|
if (!0 == this.checked) {
|
||||||
|
removeArr.push($(this).attr('id').split('-')[1])
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
window.location.href = url
|
if (0 == removeArr.length)
|
||||||
|
return !1;
|
||||||
|
|
||||||
});
|
window.location.href = sbRoot + '/manage/failedDownloads?toRemove=' + removeArr.join('|');
|
||||||
|
});
|
||||||
|
|
||||||
$('.bulkCheck').click(function(){
|
$('.bulkCheck').click(function() {
|
||||||
|
|
||||||
var bulkCheck = this;
|
var bulkCheck = this, whichBulkCheck = $(bulkCheck).attr('id');
|
||||||
var whichBulkCheck = $(bulkCheck).attr('id');
|
|
||||||
|
|
||||||
$('.'+whichBulkCheck+':visible').each(function(){
|
$('.' + whichBulkCheck + ':visible').each(function() {
|
||||||
this.checked = bulkCheck.checked
|
this.checked = bulkCheck.checked
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
['.removeCheck'].forEach(function(name) {
|
['.removeCheck'].forEach(function(name) {
|
||||||
var lastCheck = null;
|
|
||||||
|
|
||||||
$(name).click(function(event) {
|
var lastCheck = null;
|
||||||
|
|
||||||
if(!lastCheck || !event.shiftKey) {
|
$(name).click(function(event) {
|
||||||
lastCheck = this;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var check = this;
|
var table$ = $('#failedTable');
|
||||||
var found = 0;
|
if(!lastCheck || !event.shiftKey) {
|
||||||
|
lastCheck = this;
|
||||||
|
$(this).parent('td').attr('data-order', this.checked ? '1' : '0');
|
||||||
|
table$.trigger('update');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$(name+':visible').each(function() {
|
var check = this, found = 0;
|
||||||
switch (found) {
|
|
||||||
case 2: return false;
|
|
||||||
case 1:
|
|
||||||
this.checked = lastCheck.checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this == check || this == lastCheck)
|
$(name + ':visible').each(function() {
|
||||||
found++;
|
switch (found) {
|
||||||
});
|
case 2:
|
||||||
|
return !1;
|
||||||
|
case 1:
|
||||||
|
this.checked = lastCheck.checked;
|
||||||
|
$(this).parent('td').attr('data-order', this.checked ? '1' : '0');
|
||||||
|
}
|
||||||
|
|
||||||
});
|
if (this == check || this == lastCheck)
|
||||||
|
found++;
|
||||||
|
});
|
||||||
|
|
||||||
});
|
table$.trigger('update');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#failedTable:has(tbody tr)').tablesorter({
|
||||||
|
widgets: ['zebra'],
|
||||||
|
sortList: [[0,0]],
|
||||||
|
sortAppend: [[0,0]],
|
||||||
|
textExtraction: {
|
||||||
|
0: function(node) { return $(node).attr('data-order'); },
|
||||||
|
3: function(node) { return $(node).find('img').attr('title'); },
|
||||||
|
4: function(node) { return $(node).attr('data-order'); }}
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -3886,10 +3886,12 @@ class Manage(MainHandler):
|
||||||
|
|
||||||
myDB = db.DBConnection('failed.db')
|
myDB = db.DBConnection('failed.db')
|
||||||
|
|
||||||
if limit == '0':
|
sql = 'SELECT * FROM failed ORDER BY ROWID DESC'
|
||||||
sqlResults = myDB.select('SELECT * FROM failed')
|
limit = helpers.tryInt(limit, 100)
|
||||||
|
if not limit:
|
||||||
|
sql_results = myDB.select(sql)
|
||||||
else:
|
else:
|
||||||
sqlResults = myDB.select('SELECT * FROM failed LIMIT ?', [limit])
|
sql_results = myDB.select(sql + ' LIMIT ?', [limit + 1])
|
||||||
|
|
||||||
toRemove = toRemove.split('|') if toRemove is not None else []
|
toRemove = toRemove.split('|') if toRemove is not None else []
|
||||||
|
|
||||||
|
@ -3901,8 +3903,9 @@ class Manage(MainHandler):
|
||||||
return self.redirect('/manage/failedDownloads/')
|
return self.redirect('/manage/failedDownloads/')
|
||||||
|
|
||||||
t = PageTemplate(headers=self.request.headers, file='manage_failedDownloads.tmpl')
|
t = PageTemplate(headers=self.request.headers, file='manage_failedDownloads.tmpl')
|
||||||
t.failedResults = sqlResults
|
t.over_limit = limit and len(sql_results) > limit
|
||||||
t.limit = limit
|
t.failedResults = t.over_limit and sql_results[0:-1] or sql_results
|
||||||
|
t.limit = str(limit)
|
||||||
t.submenu = self.ManageMenu()
|
t.submenu = self.ManageMenu()
|
||||||
|
|
||||||
return t.respond()
|
return t.respond()
|
||||||
|
|
Loading…
Reference in a new issue