Fix initialization of archive uploader

dhcp-server
Pat Hartl 2023-09-03 12:13:39 -05:00
parent 38142c9129
commit 2e8885e69c
1 changed files with 17 additions and 6 deletions

View File

@ -30,7 +30,7 @@
<FormItem> <FormItem>
<Space Direction="DirectionVHType.Horizontal"> <Space Direction="DirectionVHType.Horizontal">
<SpaceItem> <SpaceItem>
<InputFile id="FileInput" OnChange="FileSelected" hidden /> <InputFile @ref="FileInput" id="FileInput" OnChange="FileSelected" hidden />
<Upload Name="files" FileList="FileList"> <Upload Name="files" FileList="FileList">
<label class="ant-btn" for="FileInput"> <label class="ant-btn" for="FileInput">
<Icon Type="upload" /> <Icon Type="upload" />
@ -66,6 +66,7 @@
Archive Archive; Archive Archive;
InputFile FileInput;
IBrowserFile File { get; set; } IBrowserFile File { get; set; }
List<UploadFileItem> FileList = new List<UploadFileItem>(); List<UploadFileItem> FileList = new List<UploadFileItem>();
@ -120,14 +121,24 @@
await InvokeAsync(StateHasChanged); await InvokeAsync(StateHasChanged);
await Task.Delay(500); var i = 0;
if (!String.IsNullOrWhiteSpace(archive.ObjectKey) && archive.ObjectKey != Guid.Empty.ToString()) // Check every 10 seconds to see if the file input is available
await JS.InvokeVoidAsync("Uploader.Init", "FileInput", archive.ObjectKey.ToString()); while (i < 20)
else {
await JS.InvokeVoidAsync("Uploader.Init", "FileInput", ""); if (FileInput != null)
{
if (!String.IsNullOrWhiteSpace(archive.ObjectKey) && archive.ObjectKey != Guid.Empty.ToString())
await JS.InvokeVoidAsync("Uploader.Init", "FileInput", archive.ObjectKey.ToString());
else
await JS.InvokeVoidAsync("Uploader.Init", "FileInput", "");
break;
}
i++;
await Task.Delay(500);
}
} }
private async Task UploadArchiveJS() private async Task UploadArchiveJS()