diff --git a/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs b/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs index 6df19146e..fe0a4a461 100644 --- a/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs +++ b/NzbDrone.Core/Providers/Fakes/FakeNotificationProvider.cs @@ -37,7 +37,7 @@ namespace NzbDrone.Core.Providers.Fakes fakeNotification.Status = NotificationStatus.InProgress; fakeNotification2.CurrentStatus = DateTime.UtcNow.ToString(); fakeNotification.CurrentStatus = DateTime.Now.ToString(); - return new List { fakeNotification , fakeNotification2 }; + return new List { fakeNotification }; } } diff --git a/NzbDrone.Core/Providers/SyncProvider.cs b/NzbDrone.Core/Providers/SyncProvider.cs index 4d8987054..8621c16fa 100644 --- a/NzbDrone.Core/Providers/SyncProvider.cs +++ b/NzbDrone.Core/Providers/SyncProvider.cs @@ -37,7 +37,7 @@ namespace NzbDrone.Core.Providers _seriesSyncThread = new Thread(SyncUnmappedFolders) { Name = "SyncUnmappedFolders", - Priority = ThreadPriority.BelowNormal + Priority = ThreadPriority.Lowest }; _seriesSyncThread.Start(); @@ -54,10 +54,11 @@ namespace NzbDrone.Core.Providers try { - using (_seriesSyncNotification = new ProgressNotification("Series folder scan")) + using (_seriesSyncNotification = new ProgressNotification("Series Scan")) { _notificationProvider.Register(_seriesSyncNotification); - + _seriesSyncNotification.CurrentStatus = "Analysing Folder"; + Thread.Sleep(20000); var unmappedFolders = _seriesProvider.GetUnmappedFolders(); _seriesSyncNotification.ProgressMax = unmappedFolders.Count; @@ -65,7 +66,7 @@ namespace NzbDrone.Core.Providers { try { - _seriesSyncNotification.CurrentStatus = String.Format("Mapping folder \\{0}", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(new DirectoryInfo(seriesFolder).Name)); + _seriesSyncNotification.CurrentStatus = String.Format("Analysing Folder: {0}", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(new DirectoryInfo(seriesFolder).Name)); Logger.Info("Folder '{0}' isn't mapped in the database. Trying to map it.'", seriesFolder); var mappedSeries = _seriesProvider.MapPathToSeries(seriesFolder); @@ -96,10 +97,11 @@ namespace NzbDrone.Core.Providers _seriesSyncNotification.ProgressValue++; } + _seriesSyncNotification.CurrentStatus = "Series Scan Completed"; + Logger.Info("Series folders scan has successfully completed."); + Thread.Sleep(3000); _seriesSyncNotification.Status = NotificationStatus.Completed; } - - Logger.Info("Series folders scan has successfully completed."); } catch (Exception e) { diff --git a/NzbDrone.Web/Content/Images/spin.gif b/NzbDrone.Web/Content/Images/spin.gif new file mode 100644 index 000000000..085eb46c4 Binary files /dev/null and b/NzbDrone.Web/Content/Images/spin.gif differ diff --git a/NzbDrone.Web/Content/notibar.css b/NzbDrone.Web/Content/notibar.css new file mode 100644 index 000000000..c9585758c --- /dev/null +++ b/NzbDrone.Web/Content/notibar.css @@ -0,0 +1,23 @@ +#msgBox +{ + display: none; + height: 40px; + background-color: #272525; + background-image: url(images/spin.gif) no-repeat left middle; + opacity: .9; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=85)"; + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=85); + padding: 10px; + position: fixed; + text-align: left; + z-index: 99; + margin: 0px auto; + bottom: 0; + width: 930px; + font-size: 20px; + color: White; +} +#msgCloseButton +{ + float: right; +} diff --git a/NzbDrone.Web/Content/style.css b/NzbDrone.Web/Content/style.css index a56e1a7de..1937b1135 100644 --- a/NzbDrone.Web/Content/style.css +++ b/NzbDrone.Web/Content/style.css @@ -10,7 +10,7 @@ body padding: 0; background: #191919 url(images/img07.jpg) no-repeat right top; font-family: Segoe UI, Tahoma, Geneva, sans-serif; - font-size: 11px; + font-size: 13px; color: #3C3C3C; background-attachment: fixed; } @@ -227,10 +227,8 @@ hr #page { - width: 930px; - margin: 0px auto; - padding: 10px 10px 10px 10px; - background: #E1E1E1; + width: 950px; + margin: 0 auto 60px; overflow: hidden; } @@ -244,7 +242,6 @@ hr height: 135px; margin: 0 auto; background: url(images/img03.jpg) no-repeat left top; - } #logo h1, #logo p diff --git a/NzbDrone.Web/Controllers/NotificationController.cs b/NzbDrone.Web/Controllers/NotificationController.cs index bbb7d1c04..693c2dd6a 100644 --- a/NzbDrone.Web/Controllers/NotificationController.cs +++ b/NzbDrone.Web/Controllers/NotificationController.cs @@ -21,7 +21,13 @@ namespace NzbDrone.Web.Controllers [HttpGet] public JsonResult Index() { - return Json(_notifications.GetProgressNotifications, JsonRequestBehavior.AllowGet); + string message = string.Empty; + if (_notifications.GetProgressNotifications.Count != 0) + { + message = _notifications.GetProgressNotifications[0].CurrentStatus; + } + + return Json(message, JsonRequestBehavior.AllowGet); } } diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 40214c618..fd7649a09 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -92,6 +92,7 @@ + @@ -117,6 +118,7 @@ + diff --git a/NzbDrone.Web/Scripts/Notification.js b/NzbDrone.Web/Scripts/Notification.js index 76af8d477..215a2dc9a 100644 --- a/NzbDrone.Web/Scripts/Notification.js +++ b/NzbDrone.Web/Scripts/Notification.js @@ -1,66 +1,47 @@ -(function ($) { +/// - $(document).ready(function () { +$(function () { + var speed = 0; + refreshNotifications(); - var popups = []; - - $.jGrowl.defaults.closer = false; - $.jGrowl.defaults.closeTemplate = ''; - - - if (!$.browser.safari) { - $.jGrowl.defaults.animateOpen = { - width: 'show' - }; - - $.jGrowl.defaults.animateClose = { - width: 'hide' - }; - } + var timer = window.setInterval(function () { + speed = 1800; refreshNotifications(); - var timer = window.setInterval(refreshNotifications, 2000); + }, 2000); - function refreshNotifications() { - $.ajax({ - url: '/Notification', - success: notificationCallback - }); + function refreshNotifications() { + $.ajax({ + url: '/Notification', + success: notificationCallback + }); + } + + function notificationCallback(data) { + + if (data === "") { + CloseMsg(); } - - var failAjaxCounter = 0; - function notificationCallback(data) { - - if (data === "") { - failAjaxCounter = failAjaxCounter + 1; - - if (failAjaxCounter === 3) { - window.clearInterval(timer); - } - } - else { - failAjaxCounter = 0; - for (var i in data) { - - var titleId = data[i].Id + "_title"; - var bodyId = data[i].Id + "_body"; - - //New Notification - if (popups[i] == undefined) { - popups[i] = new Object(); - popups[i].Id = data; - $.jGrowl(MakeDiv(bodyId, data[i].CurrentStatus), { sticky: true, header: MakeDiv(titleId, data[i].Title), id: data[i].Id }); - } - //Update Existing Notification - else { - $('#' + bodyId).html(data[i].CurrentStatus); - } - } - } + else { + DisplayMsg(data); } + } + + //SetupNotifications(); + //DisplayMsg("Scanning Series Folder."); + + function DisplayMsg(sMsg) { + //set the message text + $("#msgText").text(sMsg); + //show the message + $('#msgBox').slideUp(speed, null); + } + + function CloseMsg() { + //hide the message + $('#msgBox').slideUp(speed, null); + //clear msg text + $("#msgtText").val(""); + } +}); - function MakeDiv(id, body) { - return "
" + body + "
"; - } - }); -})(jQuery); diff --git a/NzbDrone.Web/Scripts/jquery.jgrowl.js b/NzbDrone.Web/Scripts/jquery.jgrowl.js index c9a735f20..3013f21d6 100644 --- a/NzbDrone.Web/Scripts/jquery.jgrowl.js +++ b/NzbDrone.Web/Scripts/jquery.jgrowl.js @@ -182,9 +182,11 @@ var self = this; var message = notification.message; var o = notification.options; + var notification = $( - '
' + '
' + o.closeTemplate + '
' + '
' + o.header + '
' + @@ -211,7 +213,7 @@ $('div.jGrowl-notification:first', self.element).before(notification); } - $(this).animate(o.animateOpen, o.speed, o.easing, function () { + $(this).animate(o.animateOpen, 0, o.easing, function () { // Fixes some anti-aliasing issues with IE filters. if ($.browser.msie && (parseInt($(this).css('opacity'), 10) === 1 || parseInt($(this).css('opacity'), 10) === 0)) this.style.removeAttribute('filter'); diff --git a/NzbDrone.Web/Views/Shared/Site.Master b/NzbDrone.Web/Views/Shared/Site.Master index 38b723dd0..efcc0473e 100644 --- a/NzbDrone.Web/Views/Shared/Site.Master +++ b/NzbDrone.Web/Views/Shared/Site.Master @@ -28,11 +28,14 @@ Released : 20100727 Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css") .Add("telerik.sitefinity.css") .Add("style.css") - .Add("jquery.jgrowl.css")).Render(); + .Add("notibar.css")).Render(); %>