Update: Plugin Framework Install & UI

This commit is contained in:
Gary Sharp
2013-02-12 17:27:54 +11:00
parent b24253fd64
commit 734b02fa1d
35 changed files with 2792 additions and 1888 deletions
@@ -1,53 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Services.Logging;
using Disco.Services.Logging.Models;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class LoggingController : dbAdminController
{
//
// GET: /Config/Logs/
public virtual ActionResult Index()
{
var m = new Models.Logging.IndexModel()
{
LogModules = new Dictionary<LogBase, List<LogEventType>>()
};
foreach (var logModule in LogContext.LogModules.Values)
{
m.LogModules.Add(logModule, logModule.EventTypes.Values.Where(et => et.UsePersist).ToList());
}
return View(m);
}
public virtual ActionResult TaskStatus(string id)
{
if (string.IsNullOrEmpty(id))
{
string sessionId;
do
{
System.Threading.Thread.Sleep(100);
sessionId = Disco.Services.Tasks.ScheduledTasks.GetTaskStatuses(typeof(Disco.BI.Interop.ActiveDirectory.ActiveDirectoryUpdateLastNetworkLogonDateJob)).Select(t => t.SessionId).FirstOrDefault();
} while (sessionId == null);
return View(new Models.Logging.TaskStatusModel() { SessionId = sessionId });
}
else
{
var taskStatus = Disco.Services.Tasks.ScheduledTasks.GetTaskStatus(id);
return View(new Models.Logging.TaskStatusModel() { SessionId = taskStatus.SessionId });
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Services.Logging;
using Disco.Services.Logging.Models;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class LoggingController : dbAdminController
{
//
// GET: /Config/Logs/
public virtual ActionResult Index()
{
var m = new Models.Logging.IndexModel()
{
LogModules = new Dictionary<LogBase, List<LogEventType>>()
};
foreach (var logModule in LogContext.LogModules.Values)
{
m.LogModules.Add(logModule, logModule.EventTypes.Values.Where(et => et.UsePersist).ToList());
}
return View(m);
}
public virtual ActionResult TaskStatus(string id)
{
if (string.IsNullOrEmpty(id))
throw new ArgumentNullException("id", "A Task Status Id is required");
var taskStatus = Disco.Services.Tasks.ScheduledTasks.GetTaskStatus(id);
if (taskStatus == null)
return RedirectToAction(MVC.Config.Logging.Index());
return View(new Models.Logging.TaskStatusModel() { SessionId = taskStatus.SessionId });
}
}
}
@@ -4,6 +4,7 @@ using System.Linq;
using System.Web;
using System.Web.Mvc;
using Disco.Services.Plugins;
using Disco.Services.Tasks;
using Disco.Web.Areas.Config.Models.Plugins;
namespace Disco.Web.Areas.Config.Controllers
@@ -65,5 +66,27 @@ namespace Disco.Web.Areas.Config.Controllers
}
#endregion
public virtual ActionResult Install()
{
// Check for recent catalogue
var catalogue = Plugins.LoadCatalogue(dbContext);
if (catalogue == null || catalogue.ResponseTimestamp < DateTime.Now.AddMinutes(-15))
{
// Need to Update Catalogue
return RedirectToAction(MVC.API.Plugin.UpdateLibraryCatalogue());
}
else
{
var model = new Models.Plugins.InstallModel()
{
Catalogue = catalogue
};
return View(model);
}
}
}
}