updated notification ui

This commit is contained in:
Keivan 2010-10-17 23:06:16 -07:00
parent 273de41d23
commit 9c7500d4ae
11 changed files with 93 additions and 77 deletions

View File

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

View File

@ -37,7 +37,7 @@ namespace NzbDrone.Core.Providers
_seriesSyncThread = new Thread(SyncUnmappedFolders) _seriesSyncThread = new Thread(SyncUnmappedFolders)
{ {
Name = "SyncUnmappedFolders", Name = "SyncUnmappedFolders",
Priority = ThreadPriority.BelowNormal Priority = ThreadPriority.Lowest
}; };
_seriesSyncThread.Start(); _seriesSyncThread.Start();
@ -54,10 +54,11 @@ namespace NzbDrone.Core.Providers
try try
{ {
using (_seriesSyncNotification = new ProgressNotification("Series folder scan")) using (_seriesSyncNotification = new ProgressNotification("Series Scan"))
{ {
_notificationProvider.Register(_seriesSyncNotification); _notificationProvider.Register(_seriesSyncNotification);
_seriesSyncNotification.CurrentStatus = "Analysing Folder";
Thread.Sleep(20000);
var unmappedFolders = _seriesProvider.GetUnmappedFolders(); var unmappedFolders = _seriesProvider.GetUnmappedFolders();
_seriesSyncNotification.ProgressMax = unmappedFolders.Count; _seriesSyncNotification.ProgressMax = unmappedFolders.Count;
@ -65,7 +66,7 @@ namespace NzbDrone.Core.Providers
{ {
try 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); Logger.Info("Folder '{0}' isn't mapped in the database. Trying to map it.'", seriesFolder);
var mappedSeries = _seriesProvider.MapPathToSeries(seriesFolder); var mappedSeries = _seriesProvider.MapPathToSeries(seriesFolder);
@ -96,10 +97,11 @@ namespace NzbDrone.Core.Providers
_seriesSyncNotification.ProgressValue++; _seriesSyncNotification.ProgressValue++;
} }
_seriesSyncNotification.CurrentStatus = "Series Scan Completed";
Logger.Info("Series folders scan has successfully completed.");
Thread.Sleep(3000);
_seriesSyncNotification.Status = NotificationStatus.Completed; _seriesSyncNotification.Status = NotificationStatus.Completed;
} }
Logger.Info("Series folders scan has successfully completed.");
} }
catch (Exception e) catch (Exception e)
{ {

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

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

View File

@ -10,7 +10,7 @@ body
padding: 0; padding: 0;
background: #191919 url(images/img07.jpg) no-repeat right top; background: #191919 url(images/img07.jpg) no-repeat right top;
font-family: Segoe UI, Tahoma, Geneva, sans-serif; font-family: Segoe UI, Tahoma, Geneva, sans-serif;
font-size: 11px; font-size: 13px;
color: #3C3C3C; color: #3C3C3C;
background-attachment: fixed; background-attachment: fixed;
} }
@ -227,10 +227,8 @@ hr
#page #page
{ {
width: 930px; width: 950px;
margin: 0px auto; margin: 0 auto 60px;
padding: 10px 10px 10px 10px;
background: #E1E1E1;
overflow: hidden; overflow: hidden;
} }
@ -244,7 +242,6 @@ hr
height: 135px; height: 135px;
margin: 0 auto; margin: 0 auto;
background: url(images/img03.jpg) no-repeat left top; background: url(images/img03.jpg) no-repeat left top;
} }
#logo h1, #logo p #logo h1, #logo p

View File

@ -21,7 +21,13 @@ namespace NzbDrone.Web.Controllers
[HttpGet] [HttpGet]
public JsonResult Index() 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);
} }
} }

View File

@ -92,6 +92,7 @@
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Content\Images\spin.gif" />
<Content Include="Content\Black\editor.png" /> <Content Include="Content\Black\editor.png" />
<Content Include="Content\Black\loading.gif" /> <Content Include="Content\Black\loading.gif" />
<Content Include="Content\Black\sprite.png" /> <Content Include="Content\Black\sprite.png" />
@ -117,6 +118,7 @@
<Content Include="Content\Images\img03.jpg" /> <Content Include="Content\Images\img03.jpg" />
<Content Include="Content\Images\img07.jpg" /> <Content Include="Content\Images\img07.jpg" />
<Content Include="Content\jquery.jgrowl.css" /> <Content Include="Content\jquery.jgrowl.css" />
<Content Include="Content\notibar.css" />
<Content Include="Content\Office2007\editor.png" /> <Content Include="Content\Office2007\editor.png" />
<Content Include="Content\Office2007\loading.gif" /> <Content Include="Content\Office2007\loading.gif" />
<Content Include="Content\Office2007\sprite.png" /> <Content Include="Content\Office2007\sprite.png" />

View File

@ -1,66 +1,47 @@
(function ($) { /// <reference path="jquery-1.4.1-vsdoc.js" />
$(document).ready(function () { $(function () {
var speed = 0;
refreshNotifications();
var popups = []; var timer = window.setInterval(function () {
speed = 1800;
$.jGrowl.defaults.closer = false;
$.jGrowl.defaults.closeTemplate = '';
if (!$.browser.safari) {
$.jGrowl.defaults.animateOpen = {
width: 'show'
};
$.jGrowl.defaults.animateClose = {
width: 'hide'
};
}
refreshNotifications(); refreshNotifications();
var timer = window.setInterval(refreshNotifications, 2000); }, 2000);
function refreshNotifications() { function refreshNotifications() {
$.ajax({ $.ajax({
url: '/Notification', url: '/Notification',
success: notificationCallback success: notificationCallback
}); });
}
function notificationCallback(data) {
if (data === "") {
CloseMsg();
} }
else {
var failAjaxCounter = 0; DisplayMsg(data);
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);
}
}
}
} }
}
//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 "<div id ='" + id + "'>" + body + "</div>";
}
});
})(jQuery);

View File

@ -182,9 +182,11 @@
var self = this; var self = this;
var message = notification.message; var message = notification.message;
var o = notification.options; var o = notification.options;
var notification = $( var notification = $(
'<div class="jGrowl-notification ui-state-highlight ui-corner-all' + '<div id=' +
notification.options.guid +' class="jGrowl-notification ui-state-highlight ui-corner-all' +
((o.group != undefined && o.group != '') ? ' ' + o.group : '') + '">' + ((o.group != undefined && o.group != '') ? ' ' + o.group : '') + '">' +
'<div class="close">' + o.closeTemplate + '</div>' + '<div class="close">' + o.closeTemplate + '</div>' +
'<div class="header">' + o.header + '</div>' + '<div class="header">' + o.header + '</div>' +
@ -211,7 +213,7 @@
$('div.jGrowl-notification:first', self.element).before(notification); $('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. // Fixes some anti-aliasing issues with IE filters.
if ($.browser.msie && (parseInt($(this).css('opacity'), 10) === 1 || parseInt($(this).css('opacity'), 10) === 0)) if ($.browser.msie && (parseInt($(this).css('opacity'), 10) === 1 || parseInt($(this).css('opacity'), 10) === 0))
this.style.removeAttribute('filter'); this.style.removeAttribute('filter');

View File

@ -28,11 +28,14 @@ Released : 20100727
Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css") Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css")
.Add("telerik.sitefinity.css") .Add("telerik.sitefinity.css")
.Add("style.css") .Add("style.css")
.Add("jquery.jgrowl.css")).Render(); .Add("notibar.css")).Render();
%> %>
</head> </head>
<body> <body>
<div id="header"> <div id="header">
<div id="msgBox">
<span id="msgText">Scanning Series Folder...</span>
</div>
<div id="menu"> <div id="menu">
<ul> <ul>
<%=Html.CurrentActionLink("Series", "Index", "Series") %> <%=Html.CurrentActionLink("Series", "Index", "Series") %>

View File

@ -11,8 +11,8 @@
</target> </target>
</targets> </targets>
<rules> <rules>