Add error handling for missing documents in DocumentCheckDialog

This commit is contained in:
Thorsten Sommer 2025-12-30 17:33:24 +01:00
parent 684da62983
commit 7f26c851c3
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -27,48 +27,57 @@
/> />
} }
<MudTabs Elevation="0" Rounded="true" ApplyEffectsToContainer="true" Outlined="true" PanelClass="pa-2" Class="mb-2"> @if (!this.Document?.Exists ?? false)
@if (this.Document?.IsImage ?? false) {
{ <MudAlert Severity="Severity.Error" Variant="Variant.Filled" Class="my-2">
<MudTabPanel Text="@T("Image View")" Icon="@Icons.Material.Filled.Image"> @T("The specified file could not be found. The file have been moved, deleted, renamed, or is otherwise inaccessible.")
<MudImage ObjectFit="ObjectFit.ScaleDown" Style="width: 100%;" Src="@this.Document.FilePathAsUrl"/> </MudAlert>
</MudTabPanel> }
} else
else {
{ <MudTabs Elevation="0" Rounded="true" ApplyEffectsToContainer="true" Outlined="true" PanelClass="pa-2" Class="mb-2">
<MudTabPanel Text="@T("Markdown View")" Icon="@Icons.Material.Filled.TextSnippet"> @if (this.Document?.IsImage ?? false)
<MudField {
Variant="Variant.Outlined" <MudTabPanel Text="@T("Image View")" Icon="@Icons.Material.Filled.Image">
AdornmentIcon="@Icons.Material.Filled.Article" <MudImage ObjectFit="ObjectFit.ScaleDown" Style="width: 100%;" Src="@this.Document.FilePathAsUrl"/>
Adornment="Adornment.Start" </MudTabPanel>
Label="@T("Loaded Content")" }
FullWidth="true" else
Class="ma-2 pe-4" {
HelperText="@T("This is the content we loaded from your file — including headings, lists, and formatting. Use this to verify your file loads as expected.")"> <MudTabPanel Text="@T("Markdown View")" Icon="@Icons.Material.Filled.TextSnippet">
<div style="max-height: 40vh; overflow-y: auto;"> <MudField
<MudMarkdown Value="@this.FileContent" Props="Markdown.DefaultConfig" Styling="@this.MarkdownStyling"/> Variant="Variant.Outlined"
</div> AdornmentIcon="@Icons.Material.Filled.Article"
</MudField> Adornment="Adornment.Start"
</MudTabPanel> Label="@T("Loaded Content")"
<MudTabPanel Text="@T("Simple View")" Icon="@Icons.Material.Filled.Terminal"> FullWidth="true"
<MudTextField Class="ma-2 pe-4"
T="string" HelperText="@T("This is the content we loaded from your file — including headings, lists, and formatting. Use this to verify your file loads as expected.")">
@bind-Text="@this.FileContent" <div style="max-height: 40vh; overflow-y: auto;">
AdornmentIcon="@Icons.Material.Filled.Article" <MudMarkdown Value="@this.FileContent" Props="Markdown.DefaultConfig" Styling="@this.MarkdownStyling"/>
Adornment="Adornment.Start" </div>
Immediate="@true" </MudField>
Label="@T("Loaded Content")" </MudTabPanel>
Variant="Variant.Outlined" <MudTabPanel Text="@T("Simple View")" Icon="@Icons.Material.Filled.Terminal">
Lines="6" <MudTextField
AutoGrow="@true" T="string"
MaxLines="25" @bind-Text="@this.FileContent"
ReadOnly="true" AdornmentIcon="@Icons.Material.Filled.Article"
Class="ma-2" Adornment="Adornment.Start"
HelperText="@T("This is the content we loaded from your file — including headings, lists, and formatting. Use this to verify your file loads as expected.")"/> Immediate="@true"
</MudTabPanel> Label="@T("Loaded Content")"
} Variant="Variant.Outlined"
</MudTabs> Lines="6"
AutoGrow="@true"
MaxLines="25"
ReadOnly="true"
Class="ma-2"
HelperText="@T("This is the content we loaded from your file — including headings, lists, and formatting. Use this to verify your file loads as expected.")"/>
</MudTabPanel>
}
</MudTabs>
}
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
<MudButton OnClick="@this.Close" Variant="Variant.Filled"> <MudButton OnClick="@this.Close" Variant="Variant.Filled">