more notification updates

pull/2/head
kay.one 14 years ago
parent 0d139f9c21
commit 80d47e611c

@ -7,11 +7,11 @@ namespace NzbDrone.Core.Instrumentation
{ {
public class SubsonicTarget : Target 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) protected override void Write(LogEventInfo logEvent)
@ -31,8 +31,8 @@ namespace NzbDrone.Core.Instrumentation
if (logEvent.Exception != null) 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.Exception = logEvent.Exception.ToString();
log.ExceptionType = logEvent.Exception.GetType().ToString(); log.ExceptionType = logEvent.Exception.GetType().ToString();
@ -42,7 +42,7 @@ namespace NzbDrone.Core.Instrumentation
log.Level = logEvent.Level.Name; log.Level = logEvent.Level.Name;
_repo.Add(log); _repository.Add(log);
} }
} }
} }

@ -10,7 +10,7 @@ namespace NzbDrone.Core.Model.Notification
public ProgressNotification(string title) public ProgressNotification(string title)
{ {
Title = title; Title = title;
CurrentStatus = String.Empty; CurrentMessage = String.Empty;
Id = Guid.NewGuid(); Id = Guid.NewGuid();
ProgressMax = 100; ProgressMax = 100;
ProgressValue = 0; 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. /// 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.
/// </summary> /// </summary>
/// <value>The current status.</value> /// <value>The current status.</value>
public String CurrentStatus { get; set; } public String CurrentMessage { get; set; }
/// <summary> /// <summary>
/// Gets or sets the completion status in percent. /// Gets or sets the completion status in percent.

@ -29,8 +29,8 @@ namespace NzbDrone.Core.Providers.Fakes
{ {
fakeNotification.Status = ProgressNotificationStatus.InProgress; fakeNotification.Status = ProgressNotificationStatus.InProgress;
fakeNotification.Status = ProgressNotificationStatus.InProgress; fakeNotification.Status = ProgressNotificationStatus.InProgress;
fakeNotification2.CurrentStatus = DateTime.UtcNow.ToString(); fakeNotification2.CurrentMessage = DateTime.UtcNow.ToString();
fakeNotification.CurrentStatus = DateTime.Now.ToString(); fakeNotification.CurrentMessage = DateTime.Now.ToString();
return new List<ProgressNotification> {fakeNotification}; return new List<ProgressNotification> {fakeNotification};
} }
} }

@ -187,6 +187,7 @@ namespace NzbDrone.Core.Providers.Jobs
{ {
settings.Success = false; settings.Success = false;
Logger.ErrorException("An error has occurred while executing timer job " + timerClass.Name, e); Logger.ErrorException("An error has occurred while executing timer job " + timerClass.Name, e);
_notification.CurrentMessage = timerClass.Name + " Failed.";
_notification.Status = ProgressNotificationStatus.Failed; _notification.Status = ProgressNotificationStatus.Failed;
} }
} }

@ -45,14 +45,14 @@ namespace NzbDrone.Core.Providers.Jobs
{ {
try 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); 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); updatedSeries.Title);
_episodeProvider.RefreshEpisodeInfo(updatedSeries.SeriesId); _episodeProvider.RefreshEpisodeInfo(updatedSeries.SeriesId);
notification.CurrentStatus = String.Format("Scanning disk for {0} files", notification.CurrentMessage = String.Format("Scanning disk for {0} files",
updatedSeries.Title); updatedSeries.Title);
_mediaFileProvider.Scan(_seriesProvider.GetSeries(updatedSeries.SeriesId)); _mediaFileProvider.Scan(_seriesProvider.GetSeries(updatedSeries.SeriesId));
} }

@ -40,11 +40,10 @@ namespace NzbDrone.Core.Providers.Jobs
foreach (var series in seriesToUpdate) foreach (var series in seriesToUpdate)
{ {
notification.CurrentStatus = "Updating series info for " + series.Title; notification.CurrentMessage = "Updating " + series.Title;
_seriesProvider.UpdateSeriesInfo(series.SeriesId); _seriesProvider.UpdateSeriesInfo(series.SeriesId);
notification.CurrentStatus = "Updating episode info for " + series.Title;
_episodeProvider.RefreshEpisodeInfo(series.SeriesId); _episodeProvider.RefreshEpisodeInfo(series.SeriesId);
notification.CurrentStatus = "Update completed for " + series.Title; notification.CurrentMessage = "Update completed for " + series.Title;
} }
} }
} }

@ -15,6 +15,7 @@
font-size: 20px; font-size: 20px;
color: White; color: White;
text-align: center; text-align: center;
white-space:nowrap;
} }
#msgCloseButton #msgCloseButton
{ {

@ -20,7 +20,7 @@ namespace NzbDrone.Web.Controllers
string message = string.Empty; string message = string.Empty;
if (_notifications.GetProgressNotifications.Count != 0) if (_notifications.GetProgressNotifications.Count != 0)
{ {
message = _notifications.GetProgressNotifications[0].CurrentStatus; message = _notifications.GetProgressNotifications[0].CurrentMessage;
} }
return Json(message, JsonRequestBehavior.AllowGet); return Json(message, JsonRequestBehavior.AllowGet);

@ -1,10 +1,11 @@
/// <reference path="jquery-1.5.2-vsdoc.js" /> /// <reference path="jquery-1.5.2-vsdoc.js" />
$(function () { $(function () {
var speed = 0; var speed = 0;
var isShown = false;
refreshNotifications(); refreshNotifications();
var timer = window.setInterval(function () { var timer = window.setInterval(function () {
speed = 500; speed = 1000;
refreshNotifications(); refreshNotifications();
}, 2000); }, 2000);
@ -28,19 +29,80 @@ $(function () {
//SetupNotifications(); //SetupNotifications();
//DisplayMsg("Scanning Series Folder."); //DisplayMsg("Scanning Series Folder.");
function DisplayMsg(sMsg) { function DisplayMsg(sMsg) {
//set the message text //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() { function CloseMsg() {
//hide the message //hide the message
$('#msgBox').slideUp(speed, null); if (isShown) {
//clear msg text $('#msgBox').hide("slide", { direction: "right" }, speed);
$("#msgtText").val(""); }
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);

@ -1,13 +1,10 @@
@model NzbDrone.Core.Repository.Series @model NzbDrone.Core.Repository.Series
@using NzbDrone.Core.Repository @using NzbDrone.Core.Repository
@using NzbDrone.Web.Models @using NzbDrone.Web.Models
@section TitleContent{ @section TitleContent{
@Model.Title @Model.Title
} }
@section ActionMenu{ @section ActionMenu{
@{Html.Telerik().Menu().Name("SeriesMenu").Items(items => @{Html.Telerik().Menu().Name("SeriesMenu").Items(items =>
{ {
items.Add().Text("Edit").Action("Edit", "Series", items.Add().Text("Edit").Action("Edit", "Series",
@ -35,9 +32,7 @@
}); });
}).Render();} }).Render();}
} }
@section MainContent{ @section MainContent{
<fieldset> <fieldset>
<div class="display-label"> <div class="display-label">
ID</div> ID</div>
@ -65,12 +60,12 @@
@Model.Path</div> @Model.Path</div>
</fieldset> </fieldset>
@*Todo: This breaks when using SQLServer... thoughts?*@ @*Todo: This breaks when using SQLServer... thoughts?*@
@foreach (var season in Model.Seasons.Where(s => s.SeasonNumber > 0).Reverse()) @foreach (var season in Model.Seasons.Where(s => s.SeasonNumber > 0).Reverse())
{ {
<br /> <br />
<h3>Season @season.SeasonNumber</h3> <h3>
Season @season.SeasonNumber</h3>
Season season1 = season; Season season1 = season;
Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season.SeasonNumber) Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season.SeasonNumber)
.TableHtmlAttributes(new { @class = "Grid" }) .TableHtmlAttributes(new { @class = "Grid" })
@ -105,10 +100,7 @@
.ButtonType(GridButtonType.Text)) .ButtonType(GridButtonType.Text))
.Render(); .Render();
} }
//Specials
@{var specialSeasons = Model.Seasons.Where(s => s.SeasonNumber == 0).FirstOrDefault();} @{var specialSeasons = Model.Seasons.Where(s => s.SeasonNumber == 0).FirstOrDefault();}
@if (specialSeasons != null) @if (specialSeasons != null)
{ {
@ -123,14 +115,11 @@
columns.Bound(c => c.Title); columns.Bound(c => c.Title);
columns.Bound(c => c.AirDate).Format("{0:d}").Width(0); columns.Bound(c => c.AirDate).Format("{0:d}").Width(0);
}) })
.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #></div>"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber)).Enabled(false)) .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber)).Enabled(false))
.Footer(false) .Footer(false)
.Render(); .Render();
} }
} }
@section Scripts{ @section Scripts{
<script type="text/javascript"> <script type="text/javascript">
function episodeDetailExpanded(e) { function episodeDetailExpanded(e) {

Loading…
Cancel
Save