mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-12 07:01:37 +00:00
Allow to disable the component
This commit is contained in:
parent
f668388192
commit
3b2770dd5c
@ -1,5 +1,5 @@
|
|||||||
@inherits MSGComponentBase
|
@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))
|
@if (string.IsNullOrWhiteSpace(this.Text))
|
||||||
{
|
{
|
||||||
@T("Use file content as input")
|
@T("Use file content as input")
|
||||||
@ -8,4 +8,4 @@
|
|||||||
{
|
{
|
||||||
@this.Text
|
@this.Text
|
||||||
}
|
}
|
||||||
</MudButton>
|
</MudButton>
|
||||||
|
|||||||
@ -15,6 +15,9 @@ public partial class ReadFileContent : MSGComponentBase
|
|||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public EventCallback<string> FileContentChanged { get; set; }
|
public EventCallback<string> FileContentChanged { get; set; }
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public bool Disabled { get; set; }
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
private RustService RustService { get; init; } = null!;
|
private RustService RustService { get; init; } = null!;
|
||||||
@ -30,6 +33,9 @@ public partial class ReadFileContent : MSGComponentBase
|
|||||||
|
|
||||||
private async Task SelectFile()
|
private async Task SelectFile()
|
||||||
{
|
{
|
||||||
|
if (this.Disabled)
|
||||||
|
return;
|
||||||
|
|
||||||
// Ensure that Pandoc is installed and ready:
|
// Ensure that Pandoc is installed and ready:
|
||||||
var pandocState = await this.PandocAvailabilityService.EnsureAvailabilityAsync(
|
var pandocState = await this.PandocAvailabilityService.EnsureAvailabilityAsync(
|
||||||
showSuccessMessage: false,
|
showSuccessMessage: false,
|
||||||
@ -73,4 +79,4 @@ public partial class ReadFileContent : MSGComponentBase
|
|||||||
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.Error, T("Failed to load file content")));
|
await MessageBus.INSTANCE.SendError(new(Icons.Material.Filled.Error, T("Failed to load file content")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user