Adds the plugins and metadata provider management UI

This commit is contained in:
BinaryAlley committed 2026-08-12 11:07:28 -07:00
1 parent 7d417c1710
commit 4926efbe8d
46 files changed
+2764 -20

No files matched your search

@@ -0,0 +1,17 @@
namespace Lumina.Presentation.Web.Common.Enums.Plugins;
/// <summary>
/// Enumeration for the load status of a plugin.
/// </summary>
public enum PluginLoadStatus
{
/// <summary>
/// The plugin was loaded successfully.
/// </summary>
Loaded,
/// <summary>
/// The plugin failed to load.
/// </summary>
FailedToLoad
}
@@ -0,0 +1,27 @@
namespace Lumina.Presentation.Web.Common.Enums.Plugins;
/// <summary>
/// Enumeration for the types of a plugin setting.
/// </summary>
public enum PluginSettingType
{
/// <summary>
/// A free-form single line text value.
/// </summary>
Text,
/// <summary>
/// A numeric value.
/// </summary>
Number,
/// <summary>
/// A boolean (true/false) value.
/// </summary>
Boolean,
/// <summary>
/// A value selected from a list of allowed values.
/// </summary>
Select
}
@@ -0,0 +1,33 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Models.Plugins;
/// <summary>
/// Represents a metadata provider configured for a media library.
/// </summary>
[DebuggerDisplay("Name: {Name}")]
public class LibraryMetadataProviderModel
{
/// <summary>
/// Gets or sets the unique identifier of the plugin providing the metadata.
/// </summary>
public Guid PluginId { get; set; }
/// <summary>
/// Gets or sets the display name of the metadata provider.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets whether the metadata provider is enabled for the media library.
/// </summary>
public bool IsEnabled { get; set; }
/// <summary>
/// Gets or sets the rank of the metadata provider, determining the order in which providers are tried.
/// </summary>
public int Rank { get; set; }
}
@@ -0,0 +1,55 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Plugins;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.Models.Plugins;
/// <summary>
/// Represents a detected plugin.
/// </summary>
[DebuggerDisplay("Name: {Name}")]
public class PluginModel
{
/// <summary>
/// Gets or sets the unique identifier of the plugin.
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the display name of the plugin.
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the author of the plugin.
/// </summary>
public string Author { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the version of the plugin.
/// </summary>
public string Version { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the description of the plugin.
/// </summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the load status of the plugin.
/// </summary>
public PluginLoadStatus LoadStatus { get; set; }
/// <summary>
/// Gets or sets the error message when the plugin failed to load.
/// </summary>
public string? LoadError { get; set; }
/// <summary>
/// Gets or sets the settings of the plugin.
/// </summary>
public Dictionary<string, string>? Settings { get; set; }
}
@@ -0,0 +1,37 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Plugins;
using System.Collections.Generic;
#endregion
namespace Lumina.Presentation.Web.Common.Models.Plugins;
/// <summary>
/// Describes a single setting of a plugin.
/// </summary>
public class PluginSettingDescriptorModel
{
/// <summary>
/// Gets or sets the unique key of the setting.
/// </summary>
public string Key { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the display label of the setting.
/// </summary>
public string Label { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the type of the setting.
/// </summary>
public PluginSettingType Type { get; set; }
/// <summary>
/// Gets or sets the default value of the setting.
/// </summary>
public string? DefaultValue { get; set; }
/// <summary>
/// Gets or sets the list of allowed values, when the setting is a selection.
/// </summary>
public IReadOnlyList<string>? AllowedValues { get; set; }
}
@@ -0,0 +1,27 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
#endregion
namespace Lumina.Presentation.Web.Common.Models.Plugins;
/// <summary>
/// Represents the settings of a plugin and their schema.
/// </summary>
public class PluginSettingsModel
{
/// <summary>
/// Gets or sets the unique identifier of the plugin.
/// </summary>
public Guid PluginId { get; set; }
/// <summary>
/// Gets or sets the schema of the plugin settings.
/// </summary>
public List<PluginSettingDescriptorModel> Schema { get; set; } = [];
/// <summary>
/// Gets or sets the current values of the plugin settings.
/// </summary>
public Dictionary<string, string>? Settings { get; set; }
}
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
#endregion
namespace Lumina.Presentation.Web.Common.Models.Plugins;
/// <summary>
/// Represents a request to reorder the metadata providers of a media library.
/// </summary>
public class ReorderLibraryMetadataProvidersModel
{
/// <summary>
/// Gets or sets the Id of the media library whose metadata providers are reordered.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the plugin Ids in the new order, from highest to lowest rank.
/// </summary>
public List<Guid> PluginIds { get; set; } = [];
}
@@ -0,0 +1,27 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
#endregion
namespace Lumina.Presentation.Web.Common.Models.Plugins;
/// <summary>
/// Represents a request to enable or disable a metadata provider for a media library.
/// </summary>
public class SetLibraryMetadataProviderEnabledModel
{
/// <summary>
/// Gets or sets the Id of the media library whose metadata provider is enabled or disabled.
/// </summary>
public Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the plugin providing the metadata.
/// </summary>
public Guid PluginId { get; set; }
/// <summary>
/// Gets or sets whether the metadata provider should be enabled for the media library.
/// </summary>
public bool IsEnabled { get; set; }
}
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
#endregion
namespace Lumina.Presentation.Web.Common.Models.Plugins;
/// <summary>
/// Represents a request to update the settings of a plugin.
/// </summary>
public class UpdatePluginSettingsModel
{
/// <summary>
/// Gets or sets the unique identifier of the plugin.
/// </summary>
public Guid PluginId { get; set; }
/// <summary>
/// Gets or sets the settings of the plugin.
/// </summary>
public Dictionary<string, string>? Settings { get; set; }
}