sonarr-repo-only/NzbDrone.Web/Views/History/Index.cshtml

150 lines
7.9 KiB
Plaintext
Raw Normal View History

@model String
@{ViewBag.Title = "History";}
@section ActionMenu{
<ul class="sub-menu">
2012-08-06 18:49:44 +00:00
<li>@Ajax.ActionLink("Trim History", "Trim", "History", null, new AjaxOptions{ OnSuccess = "redrawGrid", Confirm = "Delete history items older than 30 days?"}, new { Title = "Delete history items older than 30 days" })</li>
<li>@Ajax.ActionLink("Purge History", "Purge", "History", null, new AjaxOptions{ OnSuccess = "redrawGrid", Confirm = "Purge all history items?" }, new { Title = "Delete all history items" })</li>
2012-04-23 19:56:59 +00:00
<li>@Html.ActionLink("Search History", "Index", "SearchHistory", null, new { Title = "Review recent searches" })</li>
</ul>
}
2011-12-01 05:25:01 +00:00
<div class="grid-container">
<table id="historyGrid" class="dataTablesGrid hidden-grid">
<thead>
<tr>
<th></th>
<th>Series Title</th>
<th>Episode</th>
<th>Episode Title</th>
<th>Quality</th>
<th>Grabbed On</th>
@*Commands Column*@
<th>Actions</th>
@*Details Column*@
<th style="display: none;">Details</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
2011-12-01 05:25:01 +00:00
</div>
@section Scripts{
<script type="text/javascript">
deleteHistoryRowUrl = '../History/Delete';
redownloadUrl = '../History/Redownload';
function reloadHistoryGrid() {
var grid = $('#history').data('tGrid');
grid.ajaxRequest();
}
$(document).ready(function() {
$('#historyGrid').removeClass('hidden-grid');
oTable = $('#historyGrid').dataTable({
"sAjaxSource": "History/AjaxBinding",
"bServerSide": true,
"bProcessing": true,
"bShowAll": false,
"bPaginate": true,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": false,
"iDisplayLength": 20,
"sPaginationType": "four_button",
"aoColumns": [
{
sName: 'Icon', sWidth: '20px', "bSortable": false, "bSearchable": false, "mDataProp": function (source, type, val) {
// 'display' and 'filter' use the image
if (type === 'display' || type === 'filter') {
if (source['Indexer'].indexOf("Newznab") === 0)
return "<img src='/Content/Images/Indexers/" + source['Indexer'] + ".png' alt='" + source["Indexer"].replace('_', ' - ') + "' title='" + source["Indexer"].replace('_', ' - ') + "' onerror='this.src=\"/Content/Images/Indexers/Newznab.png\"'>";
return "<img src='/Content/Images/Indexers/" + source['Indexer'] + ".png' alt='" + source["Indexer"] + "' title='" + source["Indexer"] + "'>";
}
// 'sort' and 'type' both just use the raw data
return source["Indexer"];
}
}, //Image
{
sName: 'Series.Title', sWidth: 'auto', "mDataProp": function (source, type, val) {
// 'display' and 'filter' use our fancy naming
if (type === 'display' || type === 'filter') {
return "<a href='/Series/Details?seriesId=" + source["SeriesId"] + "'>" + source["SeriesTitle"] + "</a>";
}
// 'sort' and 'type' both just use the raw data
return source["SeriesTitleSorter"];
}
}, //Series Title
{ sName: 'EpisodeNumbering', sWidth: '80px', "mDataProp": "EpisodeNumbering", "bSortable": false, "bSearchable": false }, //EpisodeNumbering
{ sName: 'Episodes.Title', sWidth: 'auto', "mDataProp": "EpisodeTitle", "bSortable": false }, //Episode Title
{ sName: 'Quality', sWidth: '70px', "mDataProp": "Quality", "bSortable": false, "bSearchable": false }, //Quality
{ sName: 'Date', sWidth: '150px', "bSearchable": false, "mDataProp": function (source, type, val) {
// 'display' and 'filter' use our fancy naming
if (type === 'display' || type === 'filter') {
return source["Date"];
}
// 'sort' and 'type' both just use the raw data
return source["DateSorter"];
}
}, //Date
{ sName: 'Actions', sWidth: '40px', "mDataProp": "HistoryId", "bSortable": false, "bSearchable": false, "fnRender": function (row) {
var deleteImage = "<img src=\"../../Content/Images/close.png\" alt=\"Delete\" title=\"Delete from History\" class=\"gridAction\" onclick=\"deleteHistory(this.parentNode.parentNode, " + row.aData["HistoryId"] + ")\">";
2012-02-25 19:41:48 +00:00
var redownloadImage = "<img src=\"../../Content/Images/redownload.png\" alt=\"Redownload\" title=\Redownload Episode\" class=\"gridAction\" onclick=\"redownloadHistory(this.parentNode.parentNode, " + row.aData["HistoryId"] + ", " + row.aData["EpisodeId"] + ")\">";
return deleteImage + redownloadImage;
}
}, //Actions
{
sName: 'Details', sWidth: 'auto',
"mDataProp": "Details",
"bSortable": false,
"bSearchable": false,
"bVisible": false,
"fnRender": function(row) {
var result = "<b>Overview: </b>" + row.aData["EpisodeOverview"] + "<br/>" +
"<b>NZB Title: </b>" + row.aData["NzbTitle"] + "<br/>" +
"<b>Proper: </b>" + row.aData["IsProper"] + "<br/>" +
"<b>Indexer: </b>" + row.aData["Indexer"].replace('_', ' - ');
if (row.aData["NzbInfoUrl"] != null && row.aData["NzbInfoUrl"] != "")
result += "<br/><b>Nzb Details: </b> <a href=\"" + row.aData["NzbInfoUrl"] + "\" target=\"_blank\">Details</a>";
return result;
}
} //Details
],
"aaSorting": [[5, 'desc']]
}).fnSetFilteringDelay(500);
});
function deleteHistory(row, historyId) {
//Delete from DB
$.ajax({
type: "POST",
url: deleteHistoryRowUrl,
data: { historyId: historyId },
success: function() {
oTable.fnDeleteRow(oTable.fnGetPosition(row));
}
});
}
function redownloadHistory(row, historyId, episodeId) {
$.ajax({
type: "POST",
url: redownloadUrl,
data: { historyId: historyId, episodeId: episodeId },
success: function() {
oTable.fnDeleteRow(oTable.fnGetPosition(row));
}
});
}
</script>
}