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"/>
|
<PreviewExperimental ApplyInnerScrollingFix="true"/>
|
||||||
|
|
||||||
<InnerScrolling>
|
<InnerScrolling>
|
||||||
<MudList T="string">
|
|
||||||
@foreach (var plugin in PluginFactory.AvailablePlugins)
|
<MudTable Items="@PluginFactory.AvailablePlugins" Hover="@true" GroupBy="@this.groupConfig" Class="border-dashed border rounded-lg">
|
||||||
{
|
<ColGroup>
|
||||||
<MudListItem>
|
<col/>
|
||||||
<AvatarContent>
|
<col style="width: 12em;"/>
|
||||||
<MudAvatar Size="Size.Large" Class="align-content-stretch me-4">
|
</ColGroup>
|
||||||
<div class="plugin-icon-container">
|
<HeaderContent>
|
||||||
@((MarkupString)plugin.IconSVG)
|
<MudTh>Plugin</MudTh>
|
||||||
</div>
|
<MudTh>Actions</MudTh>
|
||||||
</MudAvatar>
|
</HeaderContent>
|
||||||
</AvatarContent>
|
<GroupHeaderTemplate>
|
||||||
<ChildContent>
|
<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">
|
<MudText Typo="Typo.h6">
|
||||||
@plugin.Name
|
@context.Name
|
||||||
</MudText>
|
</MudText>
|
||||||
<MudJustifiedText Typo="Typo.body1">
|
<MudJustifiedText Typo="Typo.body1">
|
||||||
@plugin.Description
|
@context.Description
|
||||||
</MudJustifiedText>
|
</MudJustifiedText>
|
||||||
</ChildContent>
|
</MudStack>
|
||||||
</MudListItem>
|
</MudStack>
|
||||||
}
|
|
||||||
</MudList>
|
</RowTemplate>
|
||||||
|
</MudTable>
|
||||||
</InnerScrolling>
|
</InnerScrolling>
|
||||||
</div>
|
</div>
|
@ -1,7 +1,40 @@
|
|||||||
|
using AIStudio.Settings;
|
||||||
|
using AIStudio.Tools.PluginSystem;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
namespace AIStudio.Pages;
|
namespace AIStudio.Pages;
|
||||||
|
|
||||||
public partial class Plugins : ComponentBase
|
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