Allow to disable the component

This commit is contained in:
Thorsten Sommer 2026-02-01 14:13:30 +01:00
parent f668388192
commit 3b2770dd5c
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 9 additions and 3 deletions

View File

@ -1,5 +1,5 @@
@inherits MSGComponentBase
<MudButton StartIcon="@Icons.Material.Filled.Description" OnClick="async () => await this.SelectFile()" Variant="Variant.Filled" Class="mb-3">
<MudButton StartIcon="@Icons.Material.Filled.Description" OnClick="@(async () => await this.SelectFile())" Variant="Variant.Filled" Class="mb-3" Disabled="@this.Disabled">
@if (string.IsNullOrWhiteSpace(this.Text))
{
@T("Use file content as input")

View File

@ -16,6 +16,9 @@ public partial class ReadFileContent : MSGComponentBase
[Parameter]
public EventCallback<string> FileContentChanged { get; set; }
[Parameter]
public bool Disabled { get; set; }
[Inject]
private RustService RustService { get; init; } = null!;
@ -30,6 +33,9 @@ public partial class ReadFileContent : MSGComponentBase
private async Task SelectFile()
{
if (this.Disabled)
return;
// Ensure that Pandoc is installed and ready:
var pandocState = await this.PandocAvailabilityService.EnsureAvailabilityAsync(
showSuccessMessage: false,