mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-14 22:01:36 +00:00
Improvement of the ReviewAttachmentsDialog: add delete function and check for existence of the file
This commit is contained in:
parent
a3deec9e5c
commit
ca141e3ebd
@ -7,10 +7,35 @@
|
|||||||
<DialogContent>
|
<DialogContent>
|
||||||
@foreach (var filePath in this.DocumentPaths)
|
@foreach (var filePath in this.DocumentPaths)
|
||||||
{
|
{
|
||||||
<MudMenuItem
|
@if (File.Exists(filePath))
|
||||||
Icon="@Icons.Material.Filled.AttachFile"
|
{
|
||||||
Label="@Path.GetFileName(filePath)">
|
<MudStack Row Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center" Class="mb-2">
|
||||||
</MudMenuItem>
|
<MudIcon Icon="@Icons.Material.Filled.AttachFile" Class="mr-2"/>
|
||||||
|
|
||||||
|
<MudText Class="flex-grow-1 overflow-hidden text-ellipsis" Style="white-space: nowrap;">
|
||||||
|
@Path.GetFileName(filePath)
|
||||||
|
</MudText>
|
||||||
|
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.Delete"
|
||||||
|
Color="Color.Error"
|
||||||
|
Class="ml-2"
|
||||||
|
OnClick="@(() => DeleteAttachment(filePath))"/>
|
||||||
|
</MudStack>
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<MudStack Row Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center" Class="mb-2">
|
||||||
|
<MudText Class="flex-grow-1 overflow-hidden text-ellipsis" Style="white-space: nowrap;">
|
||||||
|
<s>@Path.GetFileName(filePath)</s>
|
||||||
|
</MudText>
|
||||||
|
|
||||||
|
<MudIconButton Icon="@Icons.Material.Filled.Delete"
|
||||||
|
Color="Color.Error"
|
||||||
|
Class="ml-2"
|
||||||
|
OnClick="@(() => DeleteAttachment(filePath))"/>
|
||||||
|
</MudStack>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
|
|||||||
@ -33,4 +33,12 @@ public partial class ReviewAttachmentsDialog : MSGComponentBase
|
|||||||
|
|
||||||
return dialogResult.Data as HashSet<string> ?? documentPaths;
|
return dialogResult.Data as HashSet<string> ?? documentPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DeleteAttachment(string filePath)
|
||||||
|
{
|
||||||
|
if (this.DocumentPaths.Remove(filePath))
|
||||||
|
{
|
||||||
|
this.StateHasChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user