more notification updates

pull/3113/head
kay.one 13 years ago
parent 0d139f9c21
commit 80d47e611c

@ -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);
}
}
}

@ -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.
/// </summary>
/// <value>The current status.</value>
public String CurrentStatus { get; set; }
public String CurrentMessage { get; set; }
/// <summary>
/// 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;
fakeNotification2.CurrentStatus = DateTime.UtcNow.ToString();
fakeNotification.CurrentStatus = DateTime.Now.ToString();
fakeNotification2.CurrentMessage = DateTime.UtcNow.ToString();
fakeNotification.CurrentMessage = DateTime.Now.ToString();
return new List<ProgressNotification> {fakeNotification};
}
}

@ -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;
}
}

@ -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));
}

@ -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;
}
}
}

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

@ -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);

@ -1,10 +1,11 @@
/// <reference path="jquery-1.5.2-vsdoc.js" />
$(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);

@ -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{
<fieldset>
<div class="display-label">
ID</div>
@ -64,73 +59,67 @@
<div class="display-field">
@Model.Path</div>
</fieldset>
@*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())
{
<br />
<h3>Season @season.SeasonNumber</h3>
Season season1 = season;
Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season.SeasonNumber)
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(o => o.EpisodeId)
.ClientTemplate(
"<input type='checkbox' name='checkedEpisodes' value='<#= EpisodeId #>' />")
.Title("")
.Width(1)
.HtmlAttributes(new {style = "text-align:center"});
<br />
<h3>
Season @season.SeasonNumber</h3>
Season season1 = season;
Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season.SeasonNumber)
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(o => o.EpisodeId)
.ClientTemplate(
"<input type='checkbox' name='checkedEpisodes' value='<#= EpisodeId #>' />")
.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("<div><#= Overview #> </br><#= Path #> </div>"))
.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)
{
<br />
<h3>
Specials</h3>
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("<div><#= Overview #></div>"))
.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("<div><#= Overview #> </br><#= Path #> </div>"))
.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)
{
<br />
<h3>
Specials</h3>
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{
<script type="text/javascript">
function episodeDetailExpanded(e) {

Loading…
Cancel
Save