Added ability to delete single history items

This commit is contained in:
rembo10
2014-04-08 20:17:57 -07:00
parent 9c14a2699e
commit d1d45c21d4
4 changed files with 13 additions and 6 deletions

View File

@@ -1236,6 +1236,7 @@ div#artistheader h2 a {
position: relative;
top: 7px;
}
#trashcan {margin-top:15px;}
.cloudtag {
font-size: 16px;
}

View File

@@ -26,6 +26,7 @@
<th id="size">Size</th>
<th id="status">Status</th>
<th id="action"></th>
<th id="delete"></th>
</tr>
</thead>
<tbody>
@@ -54,6 +55,7 @@
<td id="size">${helpers.bytes_to_mb(item['Size'])}</td>
<td id="status">${item['Status']}</td>
<td id="action">[<a href="#" onclick="doAjaxCall('queueAlbum?AlbumID=${item['AlbumID']}&redirect=history', $(this),'table')" data-success="Retrying download of '${item['Title']}'">retry</a>][<a href="#" onclick="doAjaxCall('queueAlbum?AlbumID=${item['AlbumID']}&new=True&redirect=history',$(this),'table')" data-success="Looking for a new version of '${item['Title']}'">new</a>]</td>
<td id="delete"><a href="#" onclick="doAjaxCall('clearhistory?date_added=${item['DateAdded']}&title=${item['Title']}',$(this),'table')" data-success="${item['Title']} cleared from history"><img src="interfaces/default/images/trashcan.png" height="18" width="18" id="trashcan" title="Clear this item from the history"></a>
</tr>
%endfor
</tbody>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -843,14 +843,18 @@ class WebInterface(object):
return json_albums
getAlbumsByArtist_json.exposed=True
def clearhistory(self, type=None):
def clearhistory(self, type=None, date_added=None, title=None):
myDB = db.DBConnection()
if type == 'all':
logger.info(u"Clearing all history")
myDB.action('DELETE from snatched')
if type:
if type == 'all':
logger.info(u"Clearing all history")
myDB.action('DELETE from snatched')
else:
logger.info(u"Clearing history where status is %s" % type)
myDB.action('DELETE from snatched WHERE Status=?', [type])
else:
logger.info(u"Clearing history where status is %s" % type)
myDB.action('DELETE from snatched WHERE Status=?', [type])
logger.info(u"Deleting '%s' from history" % title)
myDB.action('DELETE from snatched WHERE Title=? AND DateAdded=?', [title, date_added])
raise cherrypy.HTTPRedirect("history")
clearhistory.exposed = True