AI-Studio/app/MindWork AI Studio/Dialogs/PluginImportDialog.razor.cs
nilskruthoff 8a9e6aeb87
Some checks are pending
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
Added export and import of plugin archives (#885)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
2026-08-06 10:42:20 +02:00

47 lines
1.8 KiB
C#

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));
}