diff --git a/app/MindWork AI Studio/Pages/Plugins.razor b/app/MindWork AI Studio/Pages/Plugins.razor index 41f18bc7..003e6a93 100644 --- a/app/MindWork AI Studio/Pages/Plugins.razor +++ b/app/MindWork AI Studio/Pages/Plugins.razor @@ -8,27 +8,58 @@ - - @foreach (var plugin in PluginFactory.AvailablePlugins) - { - - - -
- @((MarkupString)plugin.IconSVG) -
-
-
- + + + + + + + + Plugin + Actions + + + + @switch (context.Key) + { + case GROUP_ENABLED: + + Enabled Plugins + + break; + + case GROUP_DISABLED: + + Disabled Plugins + + break; + + case GROUP_INTERNAL: + + Internal Plugins + + break; + } + + + + + +
+ @((MarkupString)context.IconSVG) +
+
+ - @plugin.Name + @context.Name - @plugin.Description + @context.Description -
-
- } -
+ + + + +
\ No newline at end of file diff --git a/app/MindWork AI Studio/Pages/Plugins.razor.cs b/app/MindWork AI Studio/Pages/Plugins.razor.cs index 74d7729d..01ecd657 100644 --- a/app/MindWork AI Studio/Pages/Plugins.razor.cs +++ b/app/MindWork AI Studio/Pages/Plugins.razor.cs @@ -1,7 +1,40 @@ +using AIStudio.Settings; +using AIStudio.Tools.PluginSystem; + using Microsoft.AspNetCore.Components; namespace AIStudio.Pages; public partial class Plugins : ComponentBase { + private const string GROUP_ENABLED = "Enabled"; + private const string GROUP_DISABLED = "Disabled"; + private const string GROUP_INTERNAL = "Internal"; + + [Inject] + private SettingsManager SettingsManager { get; init; } = null!; + + private TableGroupDefinition groupConfig = null!; + + #region Overrides of ComponentBase + + protected override async Task OnInitializedAsync() + { + this.groupConfig = new TableGroupDefinition + { + Selector = pluginMeta => + { + if (pluginMeta.IsInternal) + return GROUP_INTERNAL; + + return SettingsManager.ConfigurationData.EnabledPlugins.Contains(pluginMeta.Id) + ? GROUP_ENABLED + : GROUP_DISABLED; + } + }; + + await base.OnInitializedAsync(); + } + + #endregion } \ No newline at end of file