qol: formatting

This commit is contained in:
Gary Sharp
2025-07-20 13:47:56 +10:00
parent 49da389c2c
commit 5792771ea1
158 changed files with 693 additions and 679 deletions
@@ -90,7 +90,8 @@ namespace Disco.Services.Plugins.Features.DetailsProvider
return user.UserDetails
.Where(d => string.Equals(d.Scope, DetailsScope, StringComparison.Ordinal))
.ToDictionary(d => d.Key, d => d.Value, StringComparer.OrdinalIgnoreCase);
} else
}
else
{
return database.UserDetails
.Where(d => d.UserId == user.UserId &&
@@ -15,7 +15,7 @@ namespace Disco.Services.Plugins.Features.RepairProvider
/// The repairer identifier. Used to link this provider to any <see cref="Models.Repository.RepairerName"/>. This identifier is used to automatically set the RepairerName when a job is submitted using this plugin.
/// </summary>
public abstract string ProviderId { get; }
#region Job Submission
/// <summary>
@@ -64,7 +64,7 @@ namespace Disco.Services.Plugins.Features.RepairProvider
public virtual Tuple<Type, dynamic> JobDetails(DiscoDataContext Database, Controller controller, Job Job)
{
return null;
}
}
#endregion
@@ -1,7 +1,7 @@
using System;
using System.Web.Mvc;
using Disco.Models.UI;
using Disco.Models.UI;
using Disco.Services.Plugins.Features.UIExtension.Results;
using System;
using System.Web.Mvc;
namespace Disco.Services.Plugins.Features.UIExtension
{
@@ -19,7 +19,8 @@ namespace Disco.Services.Plugins.Features.UIExtension
}
public UIExtensionFeature()
{
plugin = new Lazy<WebHelper>(new Func<WebHelper>(() => {
plugin = new Lazy<WebHelper>(new Func<WebHelper>(() =>
{
if (Context == null)
throw new InvalidOperationException("The Context property is not initialized");
@@ -5,7 +5,7 @@ namespace Disco.Services.Plugins.Features.UIExtension
public abstract class UIExtensionResult
{
public PluginFeatureManifest Source { get; private set; }
public UIExtensionResult(PluginFeatureManifest Source)
{
this.Source = Source;
@@ -1,9 +1,9 @@
using System;
using Disco.Models.UI;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Web;
using System.Web.Mvc;
using Disco.Models.UI;
namespace Disco.Services.Plugins.Features.UIExtension
{
@@ -1,10 +1,10 @@
using System;
using Disco.Data.Repository;
using Disco.Models.BI.Config;
using Disco.Models.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Disco.Data.Repository;
using Disco.Models.BI.Config;
using Disco.Models.Repository;
namespace Disco.Services.Plugins.Features.WarrantyProvider
{
+1 -1
View File
@@ -72,7 +72,7 @@ namespace Disco.Services.Plugins
Status.UpdateStatus(20, $"{packageManifest.Name} [{packageManifest.Id} v{packageManifest.Version.ToString(4)}] by {packageManifest.Author}", "Initializing Install Environment");
PluginsLog.LogInstalling(packageManifest);
lock (Plugins._PluginLock)
{
if (!Plugins.PluginsLoaded)
+3 -3
View File
@@ -1,12 +1,12 @@
using System;
using Disco.Data.Repository;
using Disco.Data.Repository;
using Disco.Services.Tasks;
using System;
namespace Disco.Services.Plugins
{
public abstract class Plugin : IDisposable
{
public PluginManifest Manifest {get; internal set;}
public PluginManifest Manifest { get; internal set; }
#region Lifecycle
// Events/Triggers for Custom Plugin Initialization (Optional)
@@ -1,6 +1,6 @@
using System;
using Disco.Data.Repository;
using System;
using System.Web.Mvc;
using Disco.Data.Repository;
namespace Disco.Services.Plugins
{
+8 -8
View File
@@ -1,13 +1,13 @@
using System;
using Disco.Services.Web.Bundles;
using System;
using System.Collections.Generic;
using System.IO;
using System.Web.Mvc;
using System.Web.WebPages;
using System.Web.Routing;
using System.Web;
using System.Web.Mvc.Html;
using System.Globalization;
using Disco.Services.Web.Bundles;
using System.IO;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.WebPages;
namespace Disco.Services.Plugins
{
+3 -3
View File
@@ -1,11 +1,11 @@
using System;
using Disco.Data.Repository;
using Disco.Data.Repository;
using System;
namespace Disco.Services.Plugins
{
public abstract class PluginFeature : IDisposable
{
public PluginFeatureManifest Manifest {get; internal set;}
public PluginFeatureManifest Manifest { get; internal set; }
// Allow Custom Initialization (Optional)
public virtual void Initialize(DiscoDataContext Database) { return; }
@@ -1,7 +1,7 @@
using System;
using System.Linq;
using Disco.Data.Repository;
using Disco.Data.Repository;
using Newtonsoft.Json;
using System;
using System.Linq;
namespace Disco.Services.Plugins
{
+6 -6
View File
@@ -1,4 +1,9 @@
using System;
using Disco.Data.Repository;
using Disco.Services.Authorization;
using Disco.Services.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -6,11 +11,6 @@ using System.Reflection;
using System.Security.Cryptography;
using System.Web;
using System.Web.Mvc;
using Disco.Data.Repository;
using Disco.Services.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Disco.Services.Authorization;
using System.Web.Routing;
namespace Disco.Services.Plugins
+3 -2
View File
@@ -6,7 +6,7 @@ namespace Disco.Services.Plugins
{
private Lazy<WebPageHelper<T>> _plugin;
public PluginManifest Manifest {get;private set;}
public PluginManifest Manifest { get; private set; }
public WebPageHelper<T> Plugin
{
get
@@ -20,7 +20,8 @@ namespace Disco.Services.Plugins
var self = GetType();
Manifest = Plugins.GetPlugin(self.Assembly);
_plugin = new Lazy<WebPageHelper<T>>(() => {
_plugin = new Lazy<WebPageHelper<T>>(() =>
{
if (Context == null)
throw new InvalidOperationException("The WebViewPage Context property is not initialized");
+243 -243
View File
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using Disco.Services.Logging;
using Disco.Services.Logging;
using Disco.Services.Logging.Models;
using System;
using System.Collections.Generic;
using System.Reflection;
namespace Disco.Services.Plugins
@@ -180,249 +180,249 @@ namespace Disco.Services.Plugins
{
return new List<LogEventType>
{
new LogEventType
{
Id = (int)EventTypeIds.InitializingPlugins,
ModuleId = _ModuleId,
Name = "Initializing Plugins",
Format = "Starting plugin discovery and initialization from: {0}",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializingPluginAssembly,
ModuleId = _ModuleId,
Name = "Initializing Plugin Assembly",
Format = "Initializing Plugin Assembly: [{0}] From '{1}'",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializedPlugin,
ModuleId = _ModuleId,
Name = "Initialized Plugin",
Format = "Initialized Plugin: '{0} (v{1})' [{2}] From '{3}'",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializedPluginFeature,
ModuleId = _ModuleId,
Name = "Initialized Plugin Feature",
Format = "Initialized Plugin Feature: '{1}' From '{0}'",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeWarning,
ModuleId = _ModuleId,
Name = "Initialize Warning",
Format = "Initialize Warning: {0}",
Severity = (int)LogEventType.Severities.Warning,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeError,
ModuleId = _ModuleId,
Name = "Initialize Error",
Format = "Initialize Error: {0}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeException,
ModuleId = _ModuleId,
Name = "Initialize Exception",
Format = "Exception: {0}; {1}: {2}; {3}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeExceptionWithInner,
ModuleId = _ModuleId,
Name = "Initialize Exception with Inner Exception",
Format = "Exception: {0}; {1}: {2}; {3}; Inner: {4}: {5}; {6}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginException,
ModuleId = _ModuleId,
Name = "Plugin Exception",
Format = "Exception: {0}; {1}: {2}; {3}",
Severity = (int)LogEventType.Severities.Error,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginExceptionWithInner,
ModuleId = _ModuleId,
Name = "Plugin Exception with Inner Exception",
Format = "Exception: {0}; {1}: {2}; {3}; Inner: {4}: {5}; {6}",
Severity = (int)LogEventType.Severities.Error,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
{
Id = (int)EventTypeIds.InitializingPlugins,
ModuleId = _ModuleId,
Name = "Initializing Plugins",
Format = "Starting plugin discovery and initialization from: {0}",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginWarning,
ModuleId = _ModuleId,
Name = "Plugin Warning",
Format = "{0} [{1} v{2}]: {3}",
Severity = (int)LogEventType.Severities.Warning,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
{
Id = (int)EventTypeIds.InitializingPluginAssembly,
ModuleId = _ModuleId,
Name = "Initializing Plugin Assembly",
Format = "Initializing Plugin Assembly: [{0}] From '{1}'",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginMessage,
ModuleId = _ModuleId,
Name = "Plugin Message",
Format = "{0} [{1} v{2}]: {3}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginReferenceAssemblyLoaded,
ModuleId = _ModuleId,
Name = "Plugin Reference Assembly Loaded",
Format = "Loaded Plugin Reference Assembly: [{0}] From: '{1}'; Requested by: [{2}]",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginConfigurationLoaded,
ModuleId = _ModuleId,
Name = "Plugin Configuration Loaded",
Format = "Plugin Configuration Loaded: [{0}] by [{1}]",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginConfigurationSaved,
ModuleId = _ModuleId,
Name = "Plugin Configuration Saved",
Format = "Plugin Configuration Saved: [{0}] by [{1}]",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginWebControllerAccessed,
ModuleId = _ModuleId,
Name = "Plugin Web Controller Accessed",
Format = "Plugin Web Controller Accessed: Plugin [{0}], Action [{1}], By [{2}]",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.Installing,
ModuleId = _ModuleId,
Name = "Installing Plugin",
Format = "Installing Plugin: {2} [{0} v{1}]",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.Installed,
ModuleId = _ModuleId,
Name = "Plugin Installed",
Format = "Plugin Installed: {2} [{0} v{1}], Location: {3}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.BeforeUpdate,
ModuleId = _ModuleId,
Name = "Updating Plugin",
Format = "Updating Plugin: {1} [{0}], v{3} -> v{4}, Location: {2}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.AfterUpdate,
ModuleId = _ModuleId,
Name = "Plugin Updated",
Format = "Plugin Updated: {1} [{0}], v{3} -> v{4}, Location: {2}",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.Uninstalling,
ModuleId = _ModuleId,
Name = "Uninstalling Plugin",
Format = "Uninstalling Plugin: {1} [{0} v{3}], Location: {2}, UninstallData: {4}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.Uninstalled,
ModuleId = _ModuleId,
Name = "Plugin Uninstalled",
Format = "Plugin Uninstalled: {1} [{0} v{3}], Location: {2}, UninstallData: {4}",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
}
};
{
Id = (int)EventTypeIds.InitializedPlugin,
ModuleId = _ModuleId,
Name = "Initialized Plugin",
Format = "Initialized Plugin: '{0} (v{1})' [{2}] From '{3}'",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializedPluginFeature,
ModuleId = _ModuleId,
Name = "Initialized Plugin Feature",
Format = "Initialized Plugin Feature: '{1}' From '{0}'",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeWarning,
ModuleId = _ModuleId,
Name = "Initialize Warning",
Format = "Initialize Warning: {0}",
Severity = (int)LogEventType.Severities.Warning,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeError,
ModuleId = _ModuleId,
Name = "Initialize Error",
Format = "Initialize Error: {0}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeException,
ModuleId = _ModuleId,
Name = "Initialize Exception",
Format = "Exception: {0}; {1}: {2}; {3}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.InitializeExceptionWithInner,
ModuleId = _ModuleId,
Name = "Initialize Exception with Inner Exception",
Format = "Exception: {0}; {1}: {2}; {3}; Inner: {4}: {5}; {6}",
Severity = (int)LogEventType.Severities.Error,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginException,
ModuleId = _ModuleId,
Name = "Plugin Exception",
Format = "Exception: {0}; {1}: {2}; {3}",
Severity = (int)LogEventType.Severities.Error,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginExceptionWithInner,
ModuleId = _ModuleId,
Name = "Plugin Exception with Inner Exception",
Format = "Exception: {0}; {1}: {2}; {3}; Inner: {4}: {5}; {6}",
Severity = (int)LogEventType.Severities.Error,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginWarning,
ModuleId = _ModuleId,
Name = "Plugin Warning",
Format = "{0} [{1} v{2}]: {3}",
Severity = (int)LogEventType.Severities.Warning,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginMessage,
ModuleId = _ModuleId,
Name = "Plugin Message",
Format = "{0} [{1} v{2}]: {3}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginReferenceAssemblyLoaded,
ModuleId = _ModuleId,
Name = "Plugin Reference Assembly Loaded",
Format = "Loaded Plugin Reference Assembly: [{0}] From: '{1}'; Requested by: [{2}]",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginConfigurationLoaded,
ModuleId = _ModuleId,
Name = "Plugin Configuration Loaded",
Format = "Plugin Configuration Loaded: [{0}] by [{1}]",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginConfigurationSaved,
ModuleId = _ModuleId,
Name = "Plugin Configuration Saved",
Format = "Plugin Configuration Saved: [{0}] by [{1}]",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.PluginWebControllerAccessed,
ModuleId = _ModuleId,
Name = "Plugin Web Controller Accessed",
Format = "Plugin Web Controller Accessed: Plugin [{0}], Action [{1}], By [{2}]",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.Installing,
ModuleId = _ModuleId,
Name = "Installing Plugin",
Format = "Installing Plugin: {2} [{0} v{1}]",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.Installed,
ModuleId = _ModuleId,
Name = "Plugin Installed",
Format = "Plugin Installed: {2} [{0} v{1}], Location: {3}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.BeforeUpdate,
ModuleId = _ModuleId,
Name = "Updating Plugin",
Format = "Updating Plugin: {1} [{0}], v{3} -> v{4}, Location: {2}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.AfterUpdate,
ModuleId = _ModuleId,
Name = "Plugin Updated",
Format = "Plugin Updated: {1} [{0}], v{3} -> v{4}, Location: {2}",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.Uninstalling,
ModuleId = _ModuleId,
Name = "Uninstalling Plugin",
Format = "Uninstalling Plugin: {1} [{0} v{3}], Location: {2}, UninstallData: {4}",
Severity = (int)LogEventType.Severities.Information,
UseLive = true,
UsePersist = true,
UseDisplay = true
},
new LogEventType
{
Id = (int)EventTypeIds.Uninstalled,
ModuleId = _ModuleId,
Name = "Plugin Uninstalled",
Format = "Plugin Uninstalled: {1} [{0} v{3}], Location: {2}, UninstallData: {4}",
Severity = (int)LogEventType.Severities.Information,
UseLive = false,
UsePersist = true,
UseDisplay = true
}
};
}
}
}
+2 -1
View File
@@ -139,7 +139,8 @@ namespace Disco.Services.Plugins
pluginPackagesLocation = database.DiscoConfiguration.PluginPackagesLocation;
installedPluginManifests = OfflineInstalledPlugins(database);
if (installedPluginManifests.Count > 0){
if (installedPluginManifests.Count > 0)
{
libraryManifest = PluginLibrary.LoadManifest(database);
libraryIncompatibility = libraryManifest.LoadIncompatibilityData();
}