-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from SSchulze1989/develop
v 0.11.11
- Loading branch information
Showing
5 changed files
with
92 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/iRLeagueManager.Web/Components/Results/FetchResultsDialog.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
@namespace iRLeagueManager.Web.Components | ||
@using iRLeagueApiCore.Common.Models | ||
@inject LeagueApiService apiService | ||
@inherits PromptDialog<string> | ||
|
||
<MudDialog> | ||
<DialogContent> | ||
<MudTextField @bind-Value="Value" | ||
Label="@Label" | ||
HelperText="@HelperText" | ||
Variant="Variant" | ||
InputType="InputType.Text" | ||
Placeholder="1234567" | ||
Clearable="true" | ||
Error="hasError" | ||
ErrorText="@errorText"/> | ||
</DialogContent> | ||
<DialogActions> | ||
<PromptDialogButtons OkClick="Submit" OkText="Upload" CancelClick="Cancel"/> | ||
</DialogActions> | ||
</MudDialog> | ||
|
||
@code { | ||
[Parameter] public EventModel Event { get; set; } = default!; | ||
|
||
private bool hasError = false; | ||
private string errorText = string.Empty; | ||
|
||
protected override async Task Submit() | ||
{ | ||
hasError = false; | ||
errorText = string.Empty; | ||
|
||
if (apiService.CurrentLeague is null) | ||
{ | ||
MudDialog.Cancel(); | ||
return; | ||
} | ||
|
||
if (int.TryParse(Value, out int subsessionId) == false) | ||
{ | ||
hasError = true; | ||
errorText = "Subsession id must be a valid number"; | ||
return; | ||
} | ||
|
||
var request = apiService.CurrentLeague | ||
.Events() | ||
.WithId(Event.Id) | ||
.Results() | ||
.Fetch() | ||
.FromIracingSubSession(subsessionId) | ||
.Post(CancellationToken); | ||
var result = await request; | ||
if (result.Success == false) | ||
{ | ||
hasError = true; | ||
errorText = @"Fetching results from iracing api failed. Please check the subsession id and if the league results are available from public. | ||
Please use JSON upload if this does not work"; | ||
} | ||
|
||
MudDialog.Close(Value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters