diff --git a/NzbDrone.Core/Instrumentation/SubsonicTarget.cs b/NzbDrone.Core/Instrumentation/SubsonicTarget.cs index 2e7510afd..708ea7dcf 100644 --- a/NzbDrone.Core/Instrumentation/SubsonicTarget.cs +++ b/NzbDrone.Core/Instrumentation/SubsonicTarget.cs @@ -7,11 +7,11 @@ namespace NzbDrone.Core.Instrumentation { public class SubsonicTarget : Target { - private readonly IRepository _repo; + private readonly IRepository _repository; - public SubsonicTarget(IRepository repo) + public SubsonicTarget(IRepository repository) { - _repo = repo; + _repository = repository; } protected override void Write(LogEventInfo logEvent) @@ -31,8 +31,8 @@ namespace NzbDrone.Core.Instrumentation if (logEvent.Exception != null) { - if (String.IsNullOrWhiteSpace(log.Message)) - log.Message = logEvent.Exception.Message; + + log.Message += ": " + logEvent.Exception.Message; log.Exception = logEvent.Exception.ToString(); log.ExceptionType = logEvent.Exception.GetType().ToString(); @@ -42,7 +42,7 @@ namespace NzbDrone.Core.Instrumentation log.Level = logEvent.Level.Name; - _repo.Add(log); + _repository.Add(log); } } } \ No newline at end of file diff --git a/NzbDrone.Core/Model/Notification/ProgressNotification.cs b/NzbDrone.Core/Model/Notification/ProgressNotification.cs index 05177cea2..a95aa9610 100644 --- a/NzbDrone.Core/Model/Notification/ProgressNotification.cs +++ b/NzbDrone.Core/Model/Notification/ProgressNotification.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Model.Notification public ProgressNotification(string title) { Title = title; - CurrentStatus = String.Empty; + CurrentMessage = String.Empty; Id = Guid.NewGuid(); ProgressMax = 100; ProgressValue = 0; @@ -33,7 +33,7 @@ namespace NzbDrone.Core.Model.Notification /// Gets or sets the current status of this task. this field could be use to show the currently processing item in a long running task. /// /// The current status. - public String CurrentStatus { get; set; } + public String CurrentMessage { get; set; } /// /// Gets or sets the completion status in percent. diff --git a/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs b/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs index 9d5be038a..bbdb92dd1 100644 --- a/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs +++ b/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs @@ -29,8 +29,8 @@ namespace NzbDrone.Core.Providers.Fakes { fakeNotification.Status = ProgressNotificationStatus.InProgress; fakeNotification.Status = ProgressNotificationStatus.InProgress; - fakeNotification2.CurrentStatus = DateTime.UtcNow.ToString(); - fakeNotification.CurrentStatus = DateTime.Now.ToString(); + fakeNotification2.CurrentMessage = DateTime.UtcNow.ToString(); + fakeNotification.CurrentMessage = DateTime.Now.ToString(); return new List {fakeNotification}; } } diff --git a/NzbDrone.Core/Providers/Jobs/JobProvider.cs b/NzbDrone.Core/Providers/Jobs/JobProvider.cs index c748499e3..0828dc1c4 100644 --- a/NzbDrone.Core/Providers/Jobs/JobProvider.cs +++ b/NzbDrone.Core/Providers/Jobs/JobProvider.cs @@ -187,6 +187,7 @@ namespace NzbDrone.Core.Providers.Jobs { settings.Success = false; Logger.ErrorException("An error has occurred while executing timer job " + timerClass.Name, e); + _notification.CurrentMessage = timerClass.Name + " Failed."; _notification.Status = ProgressNotificationStatus.Failed; } } diff --git a/NzbDrone.Core/Providers/Jobs/NewSeriesUpdate.cs b/NzbDrone.Core/Providers/Jobs/NewSeriesUpdate.cs index e3f850ec1..f2af6d1d3 100644 --- a/NzbDrone.Core/Providers/Jobs/NewSeriesUpdate.cs +++ b/NzbDrone.Core/Providers/Jobs/NewSeriesUpdate.cs @@ -45,14 +45,14 @@ namespace NzbDrone.Core.Providers.Jobs { try { - notification.CurrentStatus = String.Format("Searching For: {0}", new DirectoryInfo(currentSeries.Path).Name); + notification.CurrentMessage = String.Format("Searching For: {0}", new DirectoryInfo(currentSeries.Path).Name); var updatedSeries = _seriesProvider.UpdateSeriesInfo(currentSeries.SeriesId); - notification.CurrentStatus = String.Format("Downloading episode info For: {0}", + notification.CurrentMessage = String.Format("Downloading episode info For: {0}", updatedSeries.Title); _episodeProvider.RefreshEpisodeInfo(updatedSeries.SeriesId); - notification.CurrentStatus = String.Format("Scanning disk for {0} files", + notification.CurrentMessage = String.Format("Scanning disk for {0} files", updatedSeries.Title); _mediaFileProvider.Scan(_seriesProvider.GetSeries(updatedSeries.SeriesId)); } diff --git a/NzbDrone.Core/Providers/Jobs/UpdateInfoJob.cs b/NzbDrone.Core/Providers/Jobs/UpdateInfoJob.cs index 04a83a00a..42a2f6979 100644 --- a/NzbDrone.Core/Providers/Jobs/UpdateInfoJob.cs +++ b/NzbDrone.Core/Providers/Jobs/UpdateInfoJob.cs @@ -40,11 +40,10 @@ namespace NzbDrone.Core.Providers.Jobs foreach (var series in seriesToUpdate) { - notification.CurrentStatus = "Updating series info for " + series.Title; + notification.CurrentMessage = "Updating " + series.Title; _seriesProvider.UpdateSeriesInfo(series.SeriesId); - notification.CurrentStatus = "Updating episode info for " + series.Title; _episodeProvider.RefreshEpisodeInfo(series.SeriesId); - notification.CurrentStatus = "Update completed for " + series.Title; + notification.CurrentMessage = "Update completed for " + series.Title; } } } diff --git a/NzbDrone.Web/Content/notibar.css b/NzbDrone.Web/Content/notibar.css index d5c65537a..43e9d26f9 100644 --- a/NzbDrone.Web/Content/notibar.css +++ b/NzbDrone.Web/Content/notibar.css @@ -15,6 +15,7 @@ font-size: 20px; color: White; text-align: center; + white-space:nowrap; } #msgCloseButton { diff --git a/NzbDrone.Web/Controllers/NotificationController.cs b/NzbDrone.Web/Controllers/NotificationController.cs index 4aef9c82e..6f154de33 100644 --- a/NzbDrone.Web/Controllers/NotificationController.cs +++ b/NzbDrone.Web/Controllers/NotificationController.cs @@ -20,7 +20,7 @@ namespace NzbDrone.Web.Controllers string message = string.Empty; if (_notifications.GetProgressNotifications.Count != 0) { - message = _notifications.GetProgressNotifications[0].CurrentStatus; + message = _notifications.GetProgressNotifications[0].CurrentMessage; } return Json(message, JsonRequestBehavior.AllowGet); diff --git a/NzbDrone.Web/Scripts/Notification.js b/NzbDrone.Web/Scripts/Notification.js index 8604b8c27..052e8d1f3 100644 --- a/NzbDrone.Web/Scripts/Notification.js +++ b/NzbDrone.Web/Scripts/Notification.js @@ -1,10 +1,11 @@ /// $(function () { var speed = 0; + var isShown = false; refreshNotifications(); var timer = window.setInterval(function () { - speed = 500; + speed = 1000; refreshNotifications(); }, 2000); @@ -28,19 +29,80 @@ $(function () { //SetupNotifications(); //DisplayMsg("Scanning Series Folder."); + + function DisplayMsg(sMsg) { //set the message text - $("#msgText").text(sMsg); - //show the message - $('#msgBox').slideDown(speed, null); + + + //$("#msgText").text(sMsg); + $("#msgText").showHtml(sMsg, 200); + + + if (!isShown) { + isShown = true; + if (speed === 0) { + $('#msgBox').show(); + } + else { + $('#msgBox').show("slide", { direction: "right" }, speed); + } + + } } function CloseMsg() { //hide the message - $('#msgBox').slideUp(speed, null); - //clear msg text - $("#msgtText").val(""); + if (isShown) { + $('#msgBox').hide("slide", { direction: "right" }, speed); + } + + isShown = false; } }); + + +// Animates the dimensional changes resulting from altering element contents +// Usage examples: +// $("#myElement").showHtml("new HTML contents"); +// $("div").showHtml("new HTML contents", 400); +// $(".className").showHtml("new HTML contents", 400, +// function() {/* on completion */}); +(function ($) { + $.fn.showHtml = function (html, speed, callback) { + return this.each(function () { + // The element to be modified + var el = $(this); + + // Preserve the original values of width and height - they'll need + // to be modified during the animation, but can be restored once + // the animation has completed. + var finish = { width: this.style.width, height: this.style.height }; + + // The original width and height represented as pixel values. + // These will only be the same as `finish` if this element had its + // dimensions specified explicitly and in pixels. Of course, if that + // was done then this entire routine is pointless, as the dimensions + // won't change when the content is changed. + var cur = { width: el.width() + 'px', height: el.height() + 'px' }; + + // Modify the element's contents. Element will resize. + el.html(html); + + // Capture the final dimensions of the element + // (with initial style settings still in effect) + var next = { width: el.width() + 'px', height: el.height() + 'px' }; + + el.css(cur) // restore initial dimensions + .animate(next, speed, function () // animate to final dimensions + { + el.css(finish); // restore initial style settings + if ($.isFunction(callback)) callback(); + }); + }); + }; + + +})(jQuery); \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/Details.cshtml b/NzbDrone.Web/Views/Series/Details.cshtml index 2de7aa9ad..dbfcb1834 100644 --- a/NzbDrone.Web/Views/Series/Details.cshtml +++ b/NzbDrone.Web/Views/Series/Details.cshtml @@ -1,13 +1,10 @@ @model NzbDrone.Core.Repository.Series @using NzbDrone.Core.Repository @using NzbDrone.Web.Models - @section TitleContent{ @Model.Title } - @section ActionMenu{ - @{Html.Telerik().Menu().Name("SeriesMenu").Items(items => { items.Add().Text("Edit").Action("Edit", "Series", @@ -20,7 +17,7 @@ "Series"); items.Add().Text("Scan For Episodes on Disk").Action( "SyncEpisodesOnDisk", "Series", - new {seriesId = Model.SeriesId}); + new { seriesId = Model.SeriesId }); items.Add().Text("Update Info").Action( "UpdateInfo", "Series", new { seriesId = Model.SeriesId }); @@ -35,9 +32,7 @@ }); }).Render();} } - @section MainContent{ -
ID
@@ -64,73 +59,67 @@
@Model.Path
- @*Todo: This breaks when using SQLServer... thoughts?*@ - - @foreach (var season in Model.Seasons.Where(s => s.SeasonNumber > 0).Reverse()) - { + @*Todo: This breaks when using SQLServer... thoughts?*@ + @foreach (var season in Model.Seasons.Where(s => s.SeasonNumber > 0).Reverse()) + { -
-

Season @season.SeasonNumber

- Season season1 = season; - Html.Telerik().Grid().Name("seasons_" + season.SeasonNumber) - .TableHtmlAttributes(new { @class = "Grid" }) - .Columns(columns => - { - columns.Bound(o => o.EpisodeId) - .ClientTemplate( - "") - .Title("") - .Width(1) - .HtmlAttributes(new {style = "text-align:center"}); +
+

+ Season @season.SeasonNumber

+ Season season1 = season; + Html.Telerik().Grid().Name("seasons_" + season.SeasonNumber) + .TableHtmlAttributes(new { @class = "Grid" }) + .Columns(columns => + { + columns.Bound(o => o.EpisodeId) + .ClientTemplate( + "") + .Title("") + .Width(1) + .HtmlAttributes(new { style = "text-align:center" }); - columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); - columns.Bound(c => c.Title).Title("Title").Width(300); - columns.Bound(c => c.AirDate).Format("{0:d}").Width(10); - columns.Bound(c => c.Quality).Width(10); - columns.Bound(c => c.Path); - }) - //.DetailView(detailView => detailView.Template(e => Html.RenderPartial("EpisodeDetail", e))) - .DetailView(detailView => detailView.ClientTemplate("
<#= Overview #>
<#= Path #>
")) - .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true)) - .Footer(false) - .DataBinding( - d => - d.Ajax().Select("_AjaxSeasonGrid", "Series", - new RouteValueDictionary {{"seasonId", season1.SeasonId.ToString()}})) - //.EnableCustomBinding(true) - //.ClientEvents(e => e.OnDetailViewExpand("episodeDetailExpanded")) //Causes issues displaying the episode detail multiple times... - .ToolBar( - c => - c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new {seasonId = season1.SeasonId}) - .ButtonType(GridButtonType.Text)) - .Render(); - } - - //Specials - @{var specialSeasons = Model.Seasons.Where(s => s.SeasonNumber == 0).FirstOrDefault();} - - @if (specialSeasons != null) - { - -
-

- Specials

- Html.Telerik().Grid(specialSeasons.Episodes).Name("seasons_specials") - .TableHtmlAttributes(new { @class = "Grid" }) - .Columns(columns => - { - columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode"); - columns.Bound(c => c.Title); - columns.Bound(c => c.AirDate).Format("{0:d}").Width(0); - }) - .DetailView(detailView => detailView.ClientTemplate("
<#= Overview #>
")) - .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber)).Enabled(false)) - .Footer(false) - .Render(); - } + columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); + columns.Bound(c => c.Title).Title("Title").Width(300); + columns.Bound(c => c.AirDate).Format("{0:d}").Width(10); + columns.Bound(c => c.Quality).Width(10); + columns.Bound(c => c.Path); + }) + //.DetailView(detailView => detailView.Template(e => Html.RenderPartial("EpisodeDetail", e))) + .DetailView(detailView => detailView.ClientTemplate("
<#= Overview #>
<#= Path #>
")) + .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true)) + .Footer(false) + .DataBinding( + d => + d.Ajax().Select("_AjaxSeasonGrid", "Series", + new RouteValueDictionary { { "seasonId", season1.SeasonId.ToString() } })) + //.EnableCustomBinding(true) + //.ClientEvents(e => e.OnDetailViewExpand("episodeDetailExpanded")) //Causes issues displaying the episode detail multiple times... + .ToolBar( + c => + c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new { seasonId = season1.SeasonId }) + .ButtonType(GridButtonType.Text)) + .Render(); + } + @{var specialSeasons = Model.Seasons.Where(s => s.SeasonNumber == 0).FirstOrDefault();} + @if (specialSeasons != null) + { +
+

+ Specials

+ Html.Telerik().Grid(specialSeasons.Episodes).Name("seasons_specials") + .TableHtmlAttributes(new { @class = "Grid" }) + .Columns(columns => + { + columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode"); + columns.Bound(c => c.Title); + columns.Bound(c => c.AirDate).Format("{0:d}").Width(0); + }) + .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber)).Enabled(false)) + .Footer(false) + .Render(); + } } - @section Scripts{