mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-04-28 07:59:47 +00:00
WIP: Included a pandoc dialog to check for the availability and to include an automatic download process for the user
This commit is contained in:
parent
331c6caf4b
commit
09c9834c04
41
app/MindWork AI Studio/Dialogs/PandocDialog.razor
Normal file
41
app/MindWork AI Studio/Dialogs/PandocDialog.razor
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<MudDialog>
|
||||||
|
<TitleContent>
|
||||||
|
Install Pandoc
|
||||||
|
</TitleContent>
|
||||||
|
<DialogContent>
|
||||||
|
@if (this.showInstallPage)
|
||||||
|
{
|
||||||
|
<MudItem Class="pa-6" Style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;">
|
||||||
|
<p>Installationpage</p>
|
||||||
|
</MudItem>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudItem Class="pa-6" Style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;">
|
||||||
|
@if (showSkeleton)
|
||||||
|
{
|
||||||
|
<MudSkeleton SkeletonType="SkeletonType.Circle" Animation="Animation.Pulse" Class="mb-4" Style="width: 4em; height: 4em;"/>
|
||||||
|
<MudSkeleton SkeletonType="SkeletonType.Rectangle" Animation="Animation.Pulse" Width="230px" Height="35px"/>
|
||||||
|
}
|
||||||
|
else if (isPandocAvailable)
|
||||||
|
{
|
||||||
|
<MudIcon Class="mb-2" Style="width: 2.5em; height: 2.5em;" Icon="@Icons.Material.Filled.Check" Color="Color.Success"/>
|
||||||
|
<MudText Typo="Typo.subtitle1" Align="Align.Center">
|
||||||
|
Pandoc ist auf Ihrem System verfügbar
|
||||||
|
</MudText>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudIcon Class="mb-2" Style="width: 2.5em; height: 2.5em;" Icon="@Icons.Material.Filled.Error" Color="Color.Error"/>
|
||||||
|
<MudText Class="mb-2" Typo="Typo.subtitle1" Align="Align.Center">
|
||||||
|
Pandoc ist auf Ihrem System nicht verfügbar
|
||||||
|
</MudText>
|
||||||
|
<MudButton Color="Color.Primary" OnClick="@this.ProceedToInstallation" Variant="Variant.Filled">Proceed to installation</MudButton>
|
||||||
|
}
|
||||||
|
</MudItem>
|
||||||
|
}
|
||||||
|
</DialogContent>
|
||||||
|
<DialogActions>
|
||||||
|
<!-- Hier können Sie bei Bedarf Aktionen hinzufügen -->
|
||||||
|
</DialogActions>
|
||||||
|
</MudDialog>
|
37
app/MindWork AI Studio/Dialogs/PandocDialog.razor.cs
Normal file
37
app/MindWork AI Studio/Dialogs/PandocDialog.razor.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
|
||||||
|
namespace AIStudio.Dialogs;
|
||||||
|
|
||||||
|
public partial class PandocDialog : ComponentBase
|
||||||
|
{
|
||||||
|
[CascadingParameter]
|
||||||
|
private IMudDialogInstance MudDialog { get; set; } = null!;
|
||||||
|
|
||||||
|
private bool isPandocAvailable;
|
||||||
|
private bool showSkeleton;
|
||||||
|
private bool showInstallPage;
|
||||||
|
|
||||||
|
|
||||||
|
#region Overrides of ComponentBase
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
await base.OnInitializedAsync();
|
||||||
|
this.showSkeleton = true;
|
||||||
|
await this.CheckPandocAvailabilityAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private void Cancel() => this.MudDialog.Cancel();
|
||||||
|
|
||||||
|
private async Task CheckPandocAvailabilityAsync()
|
||||||
|
{
|
||||||
|
await Task.Delay(2500);
|
||||||
|
this.isPandocAvailable = await Pandoc.CheckAvailabilityAsync();
|
||||||
|
this.showSkeleton = false;
|
||||||
|
await this.InvokeAsync(this.StateHasChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ProceedToInstallation() => this.showInstallPage = true;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user