mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-15 20:53:47 +00:00
Added export and import of plugin archives (#885)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
e7407ce60a
commit
8a9e6aeb87
43 files changed
+2041
-256
No files matched your search
@@ -0,0 +1,16 @@
|
||||
@inherits MSGComponentBase
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
<MudStack Row="true" AlignItems="AlignItems.Start" Spacing="3">
|
||||
<MudIcon Icon="@this.Icon" Color="@this.IconColor" Size="Size.Large"/>
|
||||
<MudJustifiedText Typo="Typo.body1">
|
||||
@this.Message
|
||||
</MudJustifiedText>
|
||||
</MudStack>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="@this.Close" Variant="Variant.Filled" Color="Color.Primary">
|
||||
@T("Close")
|
||||
</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
@@ -0,0 +1,35 @@
|
||||
using AIStudio.Components;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AIStudio.Dialogs;
|
||||
|
||||
/// <summary>
|
||||
/// A dialog that informs the user about something without asking for a decision. Use it when a
|
||||
/// message must not be missed, e.g., when an action was refused.
|
||||
/// </summary>
|
||||
public partial class InformationDialog : MSGComponentBase
|
||||
{
|
||||
[CascadingParameter]
|
||||
private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// The message shown to the user.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public string Message { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The icon shown next to the message.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public string Icon { get; set; } = Icons.Material.Filled.Info;
|
||||
|
||||
/// <summary>
|
||||
/// The color of the icon.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public Color IconColor { get; set; } = Color.Info;
|
||||
|
||||
private void Close() => this.MudDialog.Close(DialogResult.Ok(true));
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
@inherits MSGComponentBase
|
||||
<MudDialog>
|
||||
<DialogContent>
|
||||
<MudJustifiedText Typo="Typo.body1" Class="mb-3">
|
||||
@this.IntroductionText @T("Plugins contain code that runs inside AI Studio. Install plugins only when you trust their source.")
|
||||
</MudJustifiedText>
|
||||
|
||||
<MudPaper Class="pa-3 mb-3 border-dashed border rounded-lg">
|
||||
<MudText Typo="Typo.h6">
|
||||
@this.Preview.Plugin.Name
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2" Class="mb-2">
|
||||
@this.Preview.Plugin.Description
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2">
|
||||
@T("Type"): <strong>@this.TypeLabel</strong>
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2">
|
||||
@T("Version"): <strong>@this.Preview.Plugin.Version</strong>
|
||||
</MudText>
|
||||
<MudText Typo="Typo.body2">
|
||||
@T("Authors"): <strong>@this.AuthorsLabel</strong>
|
||||
</MudText>
|
||||
@if (!string.IsNullOrWhiteSpace(this.Preview.Plugin.SourceURL))
|
||||
{
|
||||
<MudText Typo="Typo.body2">
|
||||
@T("Source"): <strong>@this.Preview.Plugin.SourceURL</strong>
|
||||
</MudText>
|
||||
}
|
||||
@if (!string.IsNullOrWhiteSpace(this.Preview.Plugin.SupportContact))
|
||||
{
|
||||
<MudText Typo="Typo.body2">
|
||||
@T("Support contact"): <strong>@this.Preview.Plugin.SupportContact</strong>
|
||||
</MudText>
|
||||
}
|
||||
</MudPaper>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(this.Preview.Plugin.DeprecationMessage))
|
||||
{
|
||||
<MudAlert Severity="Severity.Warning" Variant="Variant.Outlined" Class="mb-3">
|
||||
@string.Format(T("The authors marked this plugin as deprecated: {0}"), this.Preview.Plugin.DeprecationMessage)
|
||||
</MudAlert>
|
||||
}
|
||||
|
||||
@if (this.Preview.ExistingPlugin is { } existingPlugin)
|
||||
{
|
||||
<MudAlert Severity="Severity.Warning" Variant="Variant.Outlined" Class="mb-3">
|
||||
@string.Format(T("This replaces the already installed plugin '{0}'. Version {1} gets replaced by version {2}."), existingPlugin.Name, existingPlugin.Version, this.Preview.Plugin.Version)
|
||||
</MudAlert>
|
||||
}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<MudButton OnClick="@this.Cancel" Variant="Variant.Filled">
|
||||
@T("Cancel")
|
||||
</MudButton>
|
||||
<MudButton OnClick="@this.Confirm" Variant="Variant.Filled" Color="Color.Warning">
|
||||
@(this.Preview.ReplacesExisting ? T("Replace plugin") : T("Install plugin"))
|
||||
</MudButton>
|
||||
</DialogActions>
|
||||
</MudDialog>
|
||||
@@ -0,0 +1,47 @@
|
||||
using AIStudio.Components;
|
||||
using AIStudio.Tools.PluginSystem;
|
||||
using AIStudio.Tools.Services;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace AIStudio.Dialogs;
|
||||
|
||||
/// <summary>
|
||||
/// Asks the user whether a plugin archive may be installed. It shows the metadata the archive
|
||||
/// declares about itself, so the user can judge the plugin before its code runs.
|
||||
/// </summary>
|
||||
public partial class PluginImportDialog : MSGComponentBase
|
||||
{
|
||||
[CascadingParameter]
|
||||
private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// The metadata of the plugin archive about to be installed.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public PluginImportPreview Preview { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Names the kind of plugin the user is about to install. Each plugin type gets its own
|
||||
/// sentence instead of a placeholder because articles and word order differ between languages.
|
||||
/// </summary>
|
||||
private string IntroductionText => this.Preview.Plugin.Type switch
|
||||
{
|
||||
PluginType.LANGUAGE => this.T("You are about to install a language plugin from a file."),
|
||||
PluginType.ASSISTANT => this.T("You are about to install an assistant plugin from a file."),
|
||||
PluginType.CONFIGURATION => this.T("You are about to install a configuration plugin from a file."),
|
||||
PluginType.THEME => this.T("You are about to install a theme plugin from a file."),
|
||||
|
||||
_ => this.T("You are about to install a plugin from a file."),
|
||||
};
|
||||
|
||||
private string TypeLabel => this.Preview.Plugin.Type.GetName();
|
||||
|
||||
private string AuthorsLabel => this.Preview.Plugin.Authors.Length > 0
|
||||
? string.Join(", ", this.Preview.Plugin.Authors)
|
||||
: this.T("Unknown");
|
||||
|
||||
private void Cancel() => this.MudDialog.Cancel();
|
||||
|
||||
private void Confirm() => this.MudDialog.Close(DialogResult.Ok(true));
|
||||
}
|
||||
Reference in new issue
Block a user