some changes to unmapped view

pull/3113/head
Keivan 14 years ago
parent 16fcda18c3
commit bfef6166f5

@ -83,7 +83,7 @@ namespace NzbDrone.Core.Test
var unmappedFolder = seriesController.GetUnmappedFolders(); var unmappedFolder = seriesController.GetUnmappedFolders();
//Assert //Assert
Assert.AreElementsEqualIgnoringOrder(MockLib.StandardSeries, unmappedFolder); Assert.AreElementsEqualIgnoringOrder(MockLib.StandardSeries, unmappedFolder.Values);
} }

@ -21,7 +21,7 @@ namespace NzbDrone.Core.Providers
TvdbSeries MapPathToSeries(string path); TvdbSeries MapPathToSeries(string path);
void AddSeries(string path, TvdbSeries series); void AddSeries(string path, TvdbSeries series);
List<String> GetUnmappedFolders(); Dictionary<Guid, String> GetUnmappedFolders();
Series FindSeries(string cleanTitle); Series FindSeries(string cleanTitle);
bool QualityWanted(int seriesId, QualityTypes quality); bool QualityWanted(int seriesId, QualityTypes quality);
} }

@ -58,19 +58,19 @@ namespace NzbDrone.Core.Providers
return _sonioRepo.Exists<Series>(s => s.SeriesId == seriesId && (QualityTypes)s.Quality == quality); return _sonioRepo.Exists<Series>(s => s.SeriesId == seriesId && (QualityTypes)s.Quality == quality);
} }
public List<String> GetUnmappedFolders() public Dictionary<Guid, String> GetUnmappedFolders()
{ {
Logger.Debug("Generating list of unmapped folders"); Logger.Debug("Generating list of unmapped folders");
if (String.IsNullOrEmpty(_config.SeriesRoot)) if (String.IsNullOrEmpty(_config.SeriesRoot))
throw new InvalidOperationException("TV Series folder is not configured yet."); throw new InvalidOperationException("TV Series folder is not configured yet.");
var results = new List<String>(); var results = new Dictionary<Guid, String>();
foreach (string seriesFolder in _diskProvider.GetDirectories(_config.SeriesRoot)) foreach (string seriesFolder in _diskProvider.GetDirectories(_config.SeriesRoot))
{ {
var cleanPath = Parser.NormalizePath(new DirectoryInfo(seriesFolder).FullName); var cleanPath = Parser.NormalizePath(new DirectoryInfo(seriesFolder).FullName);
if (!_sonioRepo.Exists<Series>(s => s.Path == cleanPath)) if (!_sonioRepo.Exists<Series>(s => s.Path == cleanPath))
{ {
results.Add(cleanPath); results.Add(Guid.NewGuid(), cleanPath);
} }
} }

@ -63,7 +63,7 @@ namespace NzbDrone.Core.Providers
var unmappedFolders = _seriesProvider.GetUnmappedFolders(); var unmappedFolders = _seriesProvider.GetUnmappedFolders();
_seriesSyncNotification.ProgressMax = unmappedFolders.Count; _seriesSyncNotification.ProgressMax = unmappedFolders.Count;
foreach (string seriesFolder in unmappedFolders) foreach (string seriesFolder in unmappedFolders.Values)
{ {
try try
{ {

@ -51,7 +51,7 @@ namespace NzbDrone.Web.Controllers
public ActionResult UnMapped() public ActionResult UnMapped()
{ {
return View(_seriesProvider.GetUnmappedFolders()); return View(_seriesProvider.GetUnmappedFolders().Select(c => new MappingModel() { Id = 1, Path = c.Value }).ToList());
} }
@ -156,6 +156,14 @@ namespace NzbDrone.Web.Controllers
// //
// GET: /Series/Details/5 // GET: /Series/Details/5
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult _SaveAjaxEditing(string id)
{
return RedirectToAction("UnMapped");
}
public ActionResult Details(int seriesId) public ActionResult Details(int seriesId)
{ {
return View(_seriesProvider.GetSeries(seriesId)); return View(_seriesProvider.GetSeries(seriesId));

@ -84,6 +84,7 @@
</Compile> </Compile>
<Compile Include="Helpers\IsCurrentActionHelper.cs" /> <Compile Include="Helpers\IsCurrentActionHelper.cs" />
<Compile Include="Models\AccountModels.cs" /> <Compile Include="Models\AccountModels.cs" />
<Compile Include="Models\MappingModel.cs" />
<Compile Include="Models\EpisodeModel.cs" /> <Compile Include="Models\EpisodeModel.cs" />
<Compile Include="Models\QualityModel.cs" /> <Compile Include="Models\QualityModel.cs" />
<Compile Include="Models\SettingsModels.cs" /> <Compile Include="Models\SettingsModels.cs" />

@ -1,4 +1,4 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<List<String>>" %> <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<List<NzbDrone.Web.Models.MappingModel>>" %>
<%@ Import Namespace="Telerik.Web.Mvc.UI" %> <%@ Import Namespace="Telerik.Web.Mvc.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
@ -10,13 +10,19 @@
<h3> <h3>
Please Re-sync your folders. If the problem persists try renaming your folders to Please Re-sync your folders. If the problem persists try renaming your folders to
something more similar to the name of series they contain.</h3> something more similar to the name of series they contain.</h3>
<% <%= Html.Telerik().Grid(Model)
.Name("Grid")
.DataKeys(dataKeys => dataKeys.Add(c => c.Id))
Html.Telerik().Grid(Model) .DataBinding(dataBinding => dataBinding
.Name("Grid") //Server binding
.Columns(columns => columns.Bound(o => o).Title("Folder")) .Ajax()
.Sortable(sort => sort.OrderBy(order => order.Add(o => o).Ascending()).Enabled(false)) .Select("UnMapped", "Series")
.Render(); .Update("Update", "Home")
)
.Columns(columns =>
{
columns.Bound(c => c.Path);
columns.Command(commands => commands.Edit());
})
%> %>
</asp:Content> </asp:Content>

Loading…
Cancel
Save