1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-10 11:10:40 +02:00

System/Indexers moved to DataTables

This commit is contained in:
Mark McDowall 2012-02-09 22:26:48 -08:00
parent 185edfb7f7
commit f21f3517cf
3 changed files with 48 additions and 37 deletions

View File

@ -65,7 +65,10 @@ public ActionResult Jobs()
public ActionResult Indexers()
{
return View(_indexerProvider.All());
var indexers = _indexerProvider.All();
var serialized = new JavaScriptSerializer().Serialize(indexers);
return View((object)serialized);
}
public ActionResult Config()

View File

@ -1,5 +1,43 @@
@model IEnumerable<NzbDrone.Core.Repository.IndexerDefinition>
@{ViewBag.Title = "Indexers";}
@{Html.Telerik().Grid(Model).Name("Grid")
.TableHtmlAttributes(new { @class = "Grid" })
.Render();}
@model string
<div class="grid-container">
<table id="indexersGrid" class="dataTablesGrid hidden-grid no-details">
<thead>
<tr>
<th>ID</th>
<th>Enable</th>
<th>Index Provider Type</th>
<th>Name</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
@section Scripts{
<script type="text/javascript">
$(document).ready(function() {
$('#indexersGrid').removeClass('hidden-grid');
oTable = $('.dataTablesGrid').dataTable({
"bShowAll": false,
"aaData": @Html.Raw(Model),
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"iDisplayLength": 20,
"sPaginationType": "four_button",
"aoColumns": [
{ sWidth: '100px', "mDataProp": "Id"}, //Id
{ sWidth: '100px', "mDataProp": "Enable"}, //Enable
{ sWidth: 'autopx', "mDataProp": "IndexProviderType" }, //Type
{ sWidth: '150px', "mDataProp": "Name" } //Name
]
});
});
</script>
}

View File

@ -102,34 +102,4 @@
});
});
</script>
}
@*@{Html.Telerik().Grid(Model).Name("Grid")
.Columns(c => c.Bound(g => g.Id))
.Columns(c => c.Bound(g => g.Enable))
.Columns(c => c.Bound(g => g.TypeName))
.Columns(c => c.Bound(g => g.Name))
.Columns(c => c.Bound(g => g.Interval))
.Columns(c => c.Bound(g => g.LastExecution))
.Columns(c => c.Bound(g => g.Success))
.Columns(c => c.Bound(g => g.Id)
.Title("Command")
.Template(@<text> @{ if(item.Enable)
{
@Ajax.ImageActionLink("../../Content/Images/Gear.png", new { Alt = "Run", Width = 18, Height = 18, Title = "Run Job" }, "RunJob", new { TypeName = item.TypeName }, null, null)
}
}
</text>))
.Sortable(c=>c.OrderBy(col=>col.Add(g=>g.Interval)))
.Render();}
<h1>Items currently in queue</h1>
@{Html.Telerik().Grid((IEnumerable<JobQueueItemModel>)ViewData["Queue"]).Name("QueueGrid")
.Columns(c => c.Bound(g => g.Name).Title("Type").Width(100))
.Columns(c => c.Bound(g => g.TargetId).Title("Target"))
.Columns(c => c.Bound(g => g.SecondaryTargetId).Title("Secondary Target"))
.Render();}*@
}