From e589c5edb469ae13460c8d1f2cc21fdb1fb1308f Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Tue, 19 Feb 2013 16:10:27 +1100 Subject: [PATCH] Update: Plugin Framework & Update --- Disco.Services/Disco.Services.csproj | 9 +- Disco.Services/Plugins/Plugin.cs | 1 - Disco.Services/Plugins/PluginManifest.cs | 12 - Disco.Services/Plugins/UpdatePluginTask.cs | 106 +++++- .../UpdatePluginsAfterDiscoUpdateTask.cs | 4 +- Disco.Services/Properties/AssemblyInfo.cs | 4 +- Disco.Web/App_Start/RouteConfig.cs | 14 + Disco.Web/Controllers/UpdateController.cs | 9 +- Disco.Web/Global.asax.cs | 19 +- Disco.Web/Models/Update/IndexModel.cs | 12 + Disco.Web/Views/Update/Index.cshtml | 261 ++++++++++++++ Disco.Web/Views/Update/Index.generated.cs | 317 ++++++++++++++++++ Disco.Web/Web.Release.config | 71 ++-- Disco.Web/Web.config | 165 ++++----- 14 files changed, 855 insertions(+), 149 deletions(-) create mode 100644 Disco.Web/Models/Update/IndexModel.cs create mode 100644 Disco.Web/Views/Update/Index.cshtml create mode 100644 Disco.Web/Views/Update/Index.generated.cs diff --git a/Disco.Services/Disco.Services.csproj b/Disco.Services/Disco.Services.csproj index 4546c68b..394b0a11 100644 --- a/Disco.Services/Disco.Services.csproj +++ b/Disco.Services/Disco.Services.csproj @@ -50,9 +50,9 @@ ..\Resources\Libraries\Quartz\Quartz.dll - + False - ..\packages\RazorGenerator.Mvc.1.5.0.0\lib\net40\RazorGenerator.Mvc.dll + ..\packages\RazorGenerator.Mvc.1.5.4.0\lib\net40\RazorGenerator.Mvc.dll False @@ -83,9 +83,8 @@ - - False - ..\packages\WebActivator.1.5.3\lib\net40\WebActivator.dll + + ..\packages\WebActivatorEx.2.0.1\lib\net40\WebActivatorEx.dll diff --git a/Disco.Services/Plugins/Plugin.cs b/Disco.Services/Plugins/Plugin.cs index 4af99e36..1296467b 100644 --- a/Disco.Services/Plugins/Plugin.cs +++ b/Disco.Services/Plugins/Plugin.cs @@ -17,7 +17,6 @@ namespace Disco.Services.Plugins public virtual void Install(DiscoDataContext dbContext, ScheduledTaskStatus Status) { return; } public virtual void Initialize(DiscoDataContext dbContext) { return; } public virtual void Uninstall(DiscoDataContext dbContext, bool UninstallData, ScheduledTaskStatus Status) { return; } - public virtual void BeforeUpdate(DiscoDataContext dbContext, PluginManifest UpdateManifest, ScheduledTaskStatus Status) { return; } public virtual void AfterUpdate(DiscoDataContext dbContext, PluginManifest PreviousManifest) { return; } #endregion diff --git a/Disco.Services/Plugins/PluginManifest.cs b/Disco.Services/Plugins/PluginManifest.cs index 7f0d70dc..42397859 100644 --- a/Disco.Services/Plugins/PluginManifest.cs +++ b/Disco.Services/Plugins/PluginManifest.cs @@ -257,18 +257,6 @@ namespace Disco.Services.Plugins return true; } - internal bool BeforePluginUpdate(DiscoDataContext dbContext, PluginManifest UpdateManifest, ScheduledTaskStatus Status) - { - // Initialize Plugin - InitializePluginEnvironment(dbContext); - - using (var pluginInstance = this.CreateInstance()) - { - pluginInstance.BeforeUpdate(dbContext, UpdateManifest, Status); - } - - return true; - } internal bool AfterPluginUpdate(DiscoDataContext dbContext, PluginManifest PreviousManifest) { // Initialize Plugin diff --git a/Disco.Services/Plugins/UpdatePluginTask.cs b/Disco.Services/Plugins/UpdatePluginTask.cs index db3f7270..0dfe549f 100644 --- a/Disco.Services/Plugins/UpdatePluginTask.cs +++ b/Disco.Services/Plugins/UpdatePluginTask.cs @@ -86,6 +86,7 @@ namespace Disco.Services.Plugins { string pluginsLocation; string pluginPackagesLocation; + string pluginsStorageLocation; PluginLibraryUpdateResponse pluginCatalogue; List> UpdatePlugins = new List>(); @@ -94,11 +95,14 @@ namespace Disco.Services.Plugins pluginCatalogue = Plugins.LoadCatalogue(dbContext); pluginsLocation = dbContext.DiscoConfiguration.PluginsLocation; pluginPackagesLocation = dbContext.DiscoConfiguration.PluginPackagesLocation; + pluginsStorageLocation = dbContext.DiscoConfiguration.PluginStorageLocation; } DirectoryInfo pluginDirectoryRoot = new DirectoryInfo(pluginsLocation); if (pluginDirectoryRoot.Exists) { + MirgrateV1Plugins(pluginsLocation, pluginsStorageLocation); + foreach (DirectoryInfo pluginDirectory in pluginDirectoryRoot.EnumerateDirectories()) { string pluginManifestFilename = Path.Combine(pluginDirectory.FullName, "manifest.json"); @@ -131,6 +135,105 @@ namespace Disco.Services.Plugins } } + internal static void MirgrateV1Plugins(string pluginsLocation, string pluginsStorageLocation) + { + var migrationPackage = Path.Combine(HttpRuntime.BinDirectory, "Disco1.1-1.2PluginMigration.zip"); + + if (File.Exists(migrationPackage)) + { + // eduSTAR.net + var eduSTARPluginPath = Path.Combine(pluginsLocation, "EduSTARnetCertificateProvider"); + if (Directory.Exists(eduSTARPluginPath)) + { + var eduSTARPluginAssemblyPath = Path.Combine(eduSTARPluginPath, "EduSTARnetCertificateProvider.dll"); + if (File.Exists(eduSTARPluginAssemblyPath)) + { + // Delete Old Plugin + Directory.Delete(eduSTARPluginPath, true); + + // Add New Plugin + eduSTARPluginPath = Path.Combine(pluginsLocation, "eduSTARnet"); + using (var migrationZipPackageStream = new FileStream(migrationPackage, FileMode.Open, FileAccess.Read, FileShare.Read)) + { + using (ZipArchive migrationZipPackage = new ZipArchive(migrationZipPackageStream)) + { + var pluginZipPackage = migrationZipPackage.Entries.Where(e => e.Name.Equals("eduSTARnet.discoPlugin", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); + if (pluginZipPackage != null) + { + using (var pluginPackageStream = pluginZipPackage.Open()) + { + using (ZipArchive pluginPackageArchive = new ZipArchive(pluginPackageStream)) + { + foreach (var entry in pluginPackageArchive.Entries) + { + var entryPath = Path.Combine(eduSTARPluginPath, entry.FullName); + Directory.CreateDirectory(Path.GetDirectoryName(entryPath)); + using (var entryOutput = new FileStream(entryPath, FileMode.Create, FileAccess.Write, FileShare.None)) + { + using (var entryStream = entry.Open()) + { + entryStream.CopyTo(entryOutput); + } + } + } + } + } + } + } + } + } + } + + // LWT + var LWTPluginPath = Path.Combine(pluginsLocation, "LWTWarrantyProvider"); + if (Directory.Exists(LWTPluginPath)) + { + var LWTPluginAssemblyPath = Path.Combine(LWTPluginPath, "LWTWarrantyProvider.dll"); + if (File.Exists(LWTPluginAssemblyPath)) + { + // Delete Old Plugin + Directory.Delete(LWTPluginPath, true); + // Delete Plugin Storage + var LWTPluginStoragePath = Path.Combine(pluginsStorageLocation, "LWTWarrantyProvider"); + if (Directory.Exists(LWTPluginStoragePath)) + Directory.Delete(LWTPluginStoragePath, true); + + // Add New Plugin + LWTPluginPath = Path.Combine(pluginsLocation, "LWTPlugin"); + using (var migrationZipPackageStream = new FileStream(migrationPackage, FileMode.Open, FileAccess.Read, FileShare.Read)) + { + using (ZipArchive migrationZipPackage = new ZipArchive(migrationZipPackageStream)) + { + var pluginZipPackage = migrationZipPackage.Entries.Where(e => e.Name.Equals("LWTPlugin.discoPlugin", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault(); + if (pluginZipPackage != null) + { + using (var pluginPackageStream = pluginZipPackage.Open()) + { + using (ZipArchive pluginPackageArchive = new ZipArchive(pluginPackageStream)) + { + foreach (var entry in pluginPackageArchive.Entries) + { + var entryPath = Path.Combine(LWTPluginPath, entry.FullName); + Directory.CreateDirectory(Path.GetDirectoryName(entryPath)); + using (var entryOutput = new FileStream(entryPath, FileMode.Create, FileAccess.Write, FileShare.None)) + { + using (var entryStream = entry.Open()) + { + entryStream.CopyTo(entryOutput); + } + } + } + } + } + } + } + } + } + + } + } + } + internal static void ExecuteTaskInternal(ScheduledTaskStatus Status, string pluginPackagesLocation, List> UpdatePlugins) { while (UpdatePlugins.Count > 0) @@ -211,10 +314,9 @@ namespace Disco.Services.Plugins var updatePluginPath = Path.Combine(dbContext.DiscoConfiguration.PluginsLocation, string.Format("{0}.discoPlugin", updateManifest.Id)); File.Move(packageTempFilePath, updatePluginPath); - if (existingManifest != null && Plugins.PluginsLoaded) + if (existingManifest != null) { PluginsLog.LogBeforeUpdate(existingManifest, updateManifest); - existingManifest.BeforePluginUpdate(dbContext, updateManifest, Status); } } } diff --git a/Disco.Services/Plugins/UpdatePluginsAfterDiscoUpdateTask.cs b/Disco.Services/Plugins/UpdatePluginsAfterDiscoUpdateTask.cs index 3238d09d..15b7e3ad 100644 --- a/Disco.Services/Plugins/UpdatePluginsAfterDiscoUpdateTask.cs +++ b/Disco.Services/Plugins/UpdatePluginsAfterDiscoUpdateTask.cs @@ -17,11 +17,11 @@ namespace Disco.Services.Plugins { this.Status.UpdateStatus(0, "Updating plugins after Disco update", "Starting, please wait..."); - // Wait for App to Load (6 Seconds) + // Wait for App to Load (10 Seconds) for (int i = 0; i < 10; i++) { this.Status.UpdateStatus(10 * i); - System.Threading.Thread.Sleep(600); + System.Threading.Thread.Sleep(1000); } // Update Catalogue diff --git a/Disco.Services/Properties/AssemblyInfo.cs b/Disco.Services/Properties/AssemblyInfo.cs index 7ec58967..f817e151 100644 --- a/Disco.Services/Properties/AssemblyInfo.cs +++ b/Disco.Services/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0214.1848")] -[assembly: AssemblyFileVersion("1.2.0214.1848")] +[assembly: AssemblyVersion("1.2.0219.1605")] +[assembly: AssemblyFileVersion("1.2.0219.1605")] diff --git a/Disco.Web/App_Start/RouteConfig.cs b/Disco.Web/App_Start/RouteConfig.cs index cbc68eec..1f82e199 100644 --- a/Disco.Web/App_Start/RouteConfig.cs +++ b/Disco.Web/App_Start/RouteConfig.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; +using SignalR; namespace Disco.Web { @@ -71,6 +72,19 @@ namespace Disco.Web public static void RegisterUpdateRoutes(RouteCollection routes) { + // Task Status SignalR Route + routes.MapConnection( + "API_Logging_TaskStatusNotifications", + "API/Logging/TaskStatusNotifications/{*operation}"); + + // Task Status Ajax Route + routes.MapRoute( + name: "API_Logging_ScheduledTaskStatus", // Route name + url: "API/Logging/ScheduledTaskStatus/{id}", // URL with parameters + defaults: new { area = "API", controller = "Logging", action = "ScheduledTaskStatus", id = UrlParameter.Optional }, // Parameter defaults + namespaces: new string[] { "Disco.Web.Areas.API.Controllers" } // Controllers Namespace Only + ); + // Update Route routes.MapRoute( name: "Update", // Route name diff --git a/Disco.Web/Controllers/UpdateController.cs b/Disco.Web/Controllers/UpdateController.cs index 4f52e243..51d36e6b 100644 --- a/Disco.Web/Controllers/UpdateController.cs +++ b/Disco.Web/Controllers/UpdateController.cs @@ -21,7 +21,7 @@ namespace Disco.Web.Controllers { if (!Request.IsLocal && !InitialConfigController.ServerIsCoreSKU.Value) { - filterContext.Result = new HttpStatusCodeResult(System.Net.HttpStatusCode.ServiceUnavailable, "Initial Configuration of Disco is only allowed via a local connection"); + filterContext.Result = new HttpStatusCodeResult(System.Net.HttpStatusCode.ServiceUnavailable, "Initialization Configuration of Disco is only allowed via a local connection"); } base.OnActionExecuting(filterContext); } @@ -30,7 +30,12 @@ namespace Disco.Web.Controllers { var status = UpdatePluginsAfterDiscoUpdateTask.UpdateDiscoPlugins(true); - return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId)); + var model = new Models.Update.IndexModel() + { + SessionId = status.SessionId + }; + + return View(model); } } } \ No newline at end of file diff --git a/Disco.Web/Global.asax.cs b/Disco.Web/Global.asax.cs index f7318504..9b836f82 100644 --- a/Disco.Web/Global.asax.cs +++ b/Disco.Web/Global.asax.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Configuration; using System.Diagnostics; using System.Linq; using System.Net; @@ -43,13 +44,18 @@ namespace Disco.Web timer_last = timer.ElapsedMilliseconds; // Check for Post-Update - Version previousVersion; - Version currentVersion = Disco.BI.Interop.Community.UpdateCheck.CurrentDiscoVersion(); - using (DiscoDataContext dbContext = new DiscoDataContext()) + bool ignoreVersionUpdate = false; + bool.TryParse(ConfigurationManager.AppSettings["DiscoIgnoreVersionUpdate"], out ignoreVersionUpdate); + Version previousVersion = null; + + if (!ignoreVersionUpdate) { - previousVersion = dbContext.DiscoConfiguration.InstalledDatabaseVersion; + using (DiscoDataContext dbContext = new DiscoDataContext()) + { + previousVersion = dbContext.DiscoConfiguration.InstalledDatabaseVersion; + } } - if (currentVersion == previousVersion) + if (ignoreVersionUpdate || Disco.BI.Interop.Community.UpdateCheck.CurrentDiscoVersion() == previousVersion) { // Normal Startup @@ -86,7 +92,6 @@ namespace Disco.Web else { // Post-Update Startup - AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterUpdateRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(); @@ -94,7 +99,7 @@ namespace Disco.Web using (DiscoDataContext dbContext = new DiscoDataContext()) { - dbContext.DiscoConfiguration.InstalledDatabaseVersion = currentVersion; + dbContext.DiscoConfiguration.InstalledDatabaseVersion = Disco.BI.Interop.Community.UpdateCheck.CurrentDiscoVersion(); dbContext.SaveChanges(); } } diff --git a/Disco.Web/Models/Update/IndexModel.cs b/Disco.Web/Models/Update/IndexModel.cs new file mode 100644 index 00000000..66492697 --- /dev/null +++ b/Disco.Web/Models/Update/IndexModel.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Disco.Web.Models.Update +{ + public class IndexModel + { + public string SessionId { get; set; } + } +} \ No newline at end of file diff --git a/Disco.Web/Views/Update/Index.cshtml b/Disco.Web/Views/Update/Index.cshtml new file mode 100644 index 00000000..b18eb5e4 --- /dev/null +++ b/Disco.Web/Views/Update/Index.cshtml @@ -0,0 +1,261 @@ +@model Disco.Web.Models.Update.IndexModel +@{ + ViewBag.Title = "Disco Post-Update Configuration"; + Layout = "~/Areas/Public/Views/Shared/_Layout.cshtml"; + + Html.BundleDeferred("~/ClientScripts/Modules/Knockout"); + Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR"); + Html.BundleDeferred("~/Style/Config"); +} +
+
+

 

+ + + + + + + + + + + + + + + + + + + + + + +
  +
  +
+
+
+
+

Finished: +

+
+ +
Last Error: +
+
+
Next Scheduled: +
+
+
+ + diff --git a/Disco.Web/Views/Update/Index.generated.cs b/Disco.Web/Views/Update/Index.generated.cs new file mode 100644 index 00000000..882cb2b4 --- /dev/null +++ b/Disco.Web/Views/Update/Index.generated.cs @@ -0,0 +1,317 @@ +#pragma warning disable 1591 +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.17929 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Disco.Web.Views.Update +{ + using System; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Text; + using System.Web; + using System.Web.Helpers; + using System.Web.Mvc; + using System.Web.Mvc.Ajax; + using System.Web.Mvc.Html; + using System.Web.Routing; + using System.Web.Security; + using System.Web.UI; + using System.Web.WebPages; + using Disco.BI.Extensions; + using Disco.Models.Repository; + using Disco.Web; + using Disco.Web.Extensions; + + [System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "1.5.0.0")] + [System.Web.WebPages.PageVirtualPathAttribute("~/Views/Update/Index.cshtml")] + public class Index : System.Web.Mvc.WebViewPage + { + public Index() + { + } + public override void Execute() + { + + #line 2 "..\..\Views\Update\Index.cshtml" + + ViewBag.Title = "Disco Post-Update Configuration"; + Layout = "~/Areas/Public/Views/Shared/_Layout.cshtml"; + + Html.BundleDeferred("~/ClientScripts/Modules/Knockout"); + Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR"); + Html.BundleDeferred("~/Style/Config"); + + + #line default + #line hidden +WriteLiteral("\r\n\r\n \r\n  \r\n \r\n \r\n  \r\n \r\n \r\n \r\n  \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n " + +" \r\n \r\n

Finished: \r\n

\r\n \r\n \r\n " + +" \r\n \r\n \r\n \r\n \r\n \r\n Last Error:\r\n \r\n \r\n \r\n \r\n " + +" \r\n Next Scheduled: \r\n \r\n \r\n
\r\n \r" + +"\n\r\n\r\n ko.bindingHandlers.progressValue = {\r\n init: function (element, val" + +"ueAccessor, allBindingsAccessor, viewModel) {\r\n var $element = $(elem" + +"ent);\r\n if (!$element.is(\'.ui-progressbar\'))\r\n $elemen" + +"t.progressbar();\r\n },\r\n update: function (element, valueAccessor, " + +"allBindingsAccessor, viewModel) {\r\n var v = ko.utils.unwrapObservable" + +"(valueAccessor());\r\n var vInt = parseInt(v);\r\n if (vInt >=" + +" 0) {\r\n $(element).progressbar(\'option\', \'value\', vInt);\r\n " + +" }\r\n }\r\n };\r\n //* http://webcloud.se/log/JavaScript-and-ISO-860" + +"1/\r\n Date.prototype.setISO8601 = function (string) {\r\n var regexp = \"(" + +"[0-9]{4})(-([0-9]{2})(-([0-9]{2})\" +\r\n \"(T([0-9]{2}):([0-9]{2})(:([0-9]{2" + +"})(\\.([0-9]+))?)?\" +\r\n \"(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?\";\r\n " + +" var d = string.match(new RegExp(regexp));\r\n\r\n var offset = 0;\r\n " + +" var date = new Date(d[1], 0, 1);\r\n\r\n if (d[3]) { date.setMonth(d[3] - 1)" + +"; }\r\n if (d[5]) { date.setDate(d[5]); }\r\n if (d[7]) { date.setHour" + +"s(d[7]); }\r\n if (d[8]) { date.setMinutes(d[8]); }\r\n if (d[10]) { d" + +"ate.setSeconds(d[10]); }\r\n if (d[12]) { date.setMilliseconds(Number(\"0.\" " + +"+ d[12]) * 1000); }\r\n if (d[14]) {\r\n offset = (Number(d[16]) *" + +" 60) + Number(d[17]);\r\n offset *= ((d[15] == \'-\') ? 1 : -1);\r\n " + +" }\r\n\r\n offset -= date.getTimezoneOffset();\r\n time = (Number(date) " + +"+ (offset * 60 * 1000));\r\n this.setTime(Number(time));\r\n return th" + +"is;\r\n }\r\n\r\n\r\n $(function () {\r\n var sessionId = \'"); + + + #line 96 "..\..\Views\Update\Index.cshtml" + Write(Model.SessionId); + + + #line default + #line hidden +WriteLiteral("\';\r\n var sessionStatusUrl = \'"); + + + #line 97 "..\..\Views\Update\Index.cshtml" + Write(Url.Action(MVC.API.Logging.ScheduledTaskStatus(Model.SessionId))); + + + #line default + #line hidden +WriteLiteral("\';\r\n\r\n // Clear Menu\r\n $(\'#menu\').empty();\r\n\r\n var view = $(" + +"\'#scheduledTaskStatus\');\r\n var vm = null;\r\n\r\n var liveConnection =" + +" null;\r\n\r\n var statusViewModel = function (sessionId) {\r\n var " + +"self = this;\r\n\r\n self.Initialized = ko.observable(false);\r\n\r\n " + +" self.TimestampParse = function (timestamp) {\r\n if (timestamp)" + +" {\r\n if (timestamp.indexOf(\"\\/Date(\") == 0)\r\n " + +" return new Date(parseInt(timestamp.substr(6)));\r\n els" + +"e\r\n return (new Date()).setISO8601(timestamp);\r\n " + +" }\r\n return new Date();\r\n }\r\n self.Ti" + +"mestampFormat = function (timestamp) {\r\n var addZero = function (" + +"v) { v = v + \'\'; if (v.length == 1) v = \'0\' + v; return v; }\r\n re" + +"turn timestamp.getFullYear() + \'/\' + addZero((1 + timestamp.getMonth())) + \'/\' +" + +" addZero(timestamp.getDate()) + \' \' + addZero(timestamp.getHours()) + \':\' + addZ" + +"ero(timestamp.getMinutes()) + \':\' + addZero(timestamp.getSeconds());\r\n " + +" }\r\n\r\n self.SessionId = sessionId;\r\n self.TaskName = ko.o" + +"bservable(null);\r\n self.StatusVersion = -1;\r\n\r\n self.Progr" + +"ess = ko.observable(0);\r\n self.CurrentProcess = ko.observable(null);\r" + +"\n self.CurrentDescription = ko.observable(null);\r\n\r\n self." + +"IsRunning = ko.observable(null);\r\n\r\n self.TaskExceptionMessage = ko.o" + +"bservable(null);\r\n\r\n self.FinishedTimestamp = ko.observable(null);\r\n " + +" self.NextScheduledTimestamp = ko.observable(null)\r\n\r\n self" + +".NextScheduledTimestampFormatted = ko.computed(function () {\r\n re" + +"turn self.TimestampFormat(self.TimestampParse(self.NextScheduledTimestamp()));\r\n" + +" });\r\n self.FinishedTimestampFormatted = ko.computed(funct" + +"ion () {\r\n return self.TimestampFormat(self.TimestampParse(self.F" + +"inishedTimestamp()));\r\n });\r\n\r\n self.FinishedUrl = ko.obse" + +"rvable(null);\r\n self.FinishedMessage = ko.observable(null);\r\n\r\n " + +" self.Finished = function () {\r\n if (self.FinishedTimestamp(" + +")) {\r\n if (self.FinishedUrl() && !self.TaskExceptionMessage()" + +") {\r\n if (self.FinishedMessage())\r\n " + +" window.setTimeout(function () { window.location.href = self.FinishedUrl();" + +" }, 3000);\r\n else\r\n window.loc" + +"ation.href = self.FinishedUrl();\r\n }\r\n }\r\n " + +" }\r\n\r\n self.Initialize = function (taskStatus) {\r\n " + +" self.TaskName(taskStatus.TaskName);\r\n self.FinishedUrl(taskSt" + +"atus.FinishedUrl);\r\n\r\n self.Progress(taskStatus.Progress);\r\n " + +" self.CurrentProcess(taskStatus.CurrentProcess);\r\n self" + +".CurrentDescription(taskStatus.CurrentDescription);\r\n\r\n self.IsRu" + +"nning(taskStatus.IsRunning);\r\n\r\n self.TaskExceptionMessage(taskSt" + +"atus.TaskExceptionMessage);\r\n\r\n self.FinishedTimestamp(taskStatus" + +".FinishedTimestamp);\r\n self.NextScheduledTimestamp(taskStatus.Nex" + +"tScheduledTimestamp);\r\n\r\n self.FinishedMessage(taskStatus.Finishe" + +"dMessage);\r\n\r\n self.Initialized(true);\r\n\r\n self.Fi" + +"nished();\r\n }\r\n self.Update = function (taskStatus) {\r\n " + +" if (!self.Initialized())\r\n return self.Initializ" + +"e(taskStatus);\r\n\r\n if (taskStatus.StatusVersion < self.StatusVers" + +"ion)\r\n return; // Have Newer Status Update\r\n s" + +"elf.StatusVersion = taskStatus.StatusVersion;\r\n\r\n if (taskStatus." + +"ChangedProperties) {\r\n for (var changedPropertyIndex = 0; cha" + +"ngedPropertyIndex < taskStatus.ChangedProperties.length; changedPropertyIndex++)" + +" {\r\n switch (taskStatus.ChangedProperties[changedProperty" + +"Index]) {\r\n case \'Progress\':\r\n " + +" self.Progress(taskStatus.Progress);\r\n br" + +"eak;\r\n case \'CurrentProcess\':\r\n " + +" self.CurrentProcess(taskStatus.CurrentProcess);\r\n " + +" break;\r\n case \'CurrentDescription\':\r\n " + +" self.CurrentDescription(taskStatus.CurrentDescription" + +");\r\n break;\r\n case \'Is" + +"Running\':\r\n self.IsRunning(taskStatus.IsRunning);" + +"\r\n break;\r\n case \'Task" + +"Exception\':\r\n self.TaskExceptionMessage(taskStatu" + +"s.TaskExceptionMessage);\r\n break;\r\n " + +" case \'NextScheduledTimestamp\':\r\n se" + +"lf.NextScheduledTimestamp(taskStatus.NextScheduledTimestamp);\r\n " + +" break;\r\n case \'FinishedUrl\':\r\n " + +" self.FinishedUrl(taskStatus.FinishedUrl);\r\n " + +" break;\r\n case \'FinishedMessage\':\r\n" + +" self.FinishedMessage(taskStatus.FinishedMessage)" + +";\r\n break;\r\n case \'Fin" + +"ishedTimestamp\':\r\n self.FinishedTimestamp(taskSta" + +"tus.FinishedTimestamp);\r\n window.setTimeout(self." + +"Finished, 1);\r\n break;\r\n " + +" default:\r\n // Ignore\r\n " + +"}\r\n }\r\n }\r\n }\r\n }\r\n\r\n " + +" vm = new statusViewModel(sessionId);\r\n ko.applyBindings(vm, view[0]);\r\n\r" + +"\n // Start Live Connection\r\n updateWithLive();\r\n\r\n function" + +" updateWithAjax(onSuccess) {\r\n $.ajax({\r\n url: session" + +"StatusUrl,\r\n dataType: \'json\',\r\n type: \'POST\',\r\n " + +" traditional: true,\r\n success: update_Received,\r\n " + +" error: function (jqXHR, textStatus, errorThrown) {\r\n " + +" alert(\'Unable to load Session: \' + errorThrown);\r\n }\r\n " + +" });\r\n }\r\n function updateWithLive() {\r\n liveConne" + +"ction = $.connection(\'"); + + + #line 249 "..\..\Views\Update\Index.cshtml" + Write(Url.Content("~/API/Logging/TaskStatusNotifications")); + + + #line default + #line hidden +WriteLiteral(@"'); + liveConnection.received(update_Received); + liveConnection.start(function () { + liveConnection.send('/addToGroups:' + sessionId); + updateWithAjax(); + }); + } + function update_Received(taskStatus) { + vm.Update(taskStatus); + } + + }); + +"); + + } + } +} +#pragma warning restore 1591 diff --git a/Disco.Web/Web.Release.config b/Disco.Web/Web.Release.config index 9ebb53d6..25df1dfa 100644 --- a/Disco.Web/Web.Release.config +++ b/Disco.Web/Web.Release.config @@ -1,35 +1,38 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Disco.Web/Web.config b/Disco.Web/Web.config index 762bd6a1..98eabce9 100644 --- a/Disco.Web/Web.config +++ b/Disco.Web/Web.config @@ -1,83 +1,84 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file