mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 07:59:47 +00:00
Changed the plugin list to be a table
This commit is contained in:
parent
c99b231f4a
commit
3f57207512
@ -8,27 +8,58 @@
|
||||
<PreviewExperimental ApplyInnerScrollingFix="true"/>
|
||||
|
||||
<InnerScrolling>
|
||||
<MudList T="string">
|
||||
@foreach (var plugin in PluginFactory.AvailablePlugins)
|
||||
{
|
||||
<MudListItem>
|
||||
<AvatarContent>
|
||||
<MudAvatar Size="Size.Large" Class="align-content-stretch me-4">
|
||||
<div class="plugin-icon-container">
|
||||
@((MarkupString)plugin.IconSVG)
|
||||
</div>
|
||||
</MudAvatar>
|
||||
</AvatarContent>
|
||||
<ChildContent>
|
||||
|
||||
<MudTable Items="@PluginFactory.AvailablePlugins" Hover="@true" GroupBy="@this.groupConfig" Class="border-dashed border rounded-lg">
|
||||
<ColGroup>
|
||||
<col/>
|
||||
<col style="width: 12em;"/>
|
||||
</ColGroup>
|
||||
<HeaderContent>
|
||||
<MudTh>Plugin</MudTh>
|
||||
<MudTh>Actions</MudTh>
|
||||
</HeaderContent>
|
||||
<GroupHeaderTemplate>
|
||||
<MudTh Class="mud-table-cell-custom-group" colspan="2">
|
||||
@switch (context.Key)
|
||||
{
|
||||
case GROUP_ENABLED:
|
||||
<MudText Typo="Typo.h6" Class="mb-2">
|
||||
Enabled Plugins
|
||||
</MudText>
|
||||
break;
|
||||
|
||||
case GROUP_DISABLED:
|
||||
<MudText Typo="Typo.h6" Class="mb-2">
|
||||
Disabled Plugins
|
||||
</MudText>
|
||||
break;
|
||||
|
||||
case GROUP_INTERNAL:
|
||||
<MudText Typo="Typo.h6" Class="mb-2">
|
||||
Internal Plugins
|
||||
</MudText>
|
||||
break;
|
||||
}
|
||||
</MudTh>
|
||||
</GroupHeaderTemplate>
|
||||
<RowTemplate>
|
||||
<MudStack Row="true">
|
||||
<MudAvatar Size="Size.Medium" Class="align-content-stretch me-4">
|
||||
<div class="plugin-icon-container">
|
||||
@((MarkupString)context.IconSVG)
|
||||
</div>
|
||||
</MudAvatar>
|
||||
<MudStack Class="mb-2 mt-2">
|
||||
<MudText Typo="Typo.h6">
|
||||
@plugin.Name
|
||||
@context.Name
|
||||
</MudText>
|
||||
<MudJustifiedText Typo="Typo.body1">
|
||||
@plugin.Description
|
||||
@context.Description
|
||||
</MudJustifiedText>
|
||||
</ChildContent>
|
||||
</MudListItem>
|
||||
}
|
||||
</MudList>
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
|
||||
</RowTemplate>
|
||||
</MudTable>
|
||||
</InnerScrolling>
|
||||
</div>
|
@ -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<IPluginMetadata> groupConfig = null!;
|
||||
|
||||
#region Overrides of ComponentBase
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
this.groupConfig = new TableGroupDefinition<IPluginMetadata>
|
||||
{
|
||||
Selector = pluginMeta =>
|
||||
{
|
||||
if (pluginMeta.IsInternal)
|
||||
return GROUP_INTERNAL;
|
||||
|
||||
return SettingsManager.ConfigurationData.EnabledPlugins.Contains(pluginMeta.Id)
|
||||
? GROUP_ENABLED
|
||||
: GROUP_DISABLED;
|
||||
}
|
||||
};
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
Loading…
Reference in New Issue
Block a user