-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#264 - Nice UI when signalr connection with the server fails.
- Loading branch information
Showing
9 changed files
with
129 additions
and
23 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
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,27 @@ | ||
@if (State.IsError) | ||
{ | ||
<LayoutView Layout="@typeof(Layouts.Layout)"> | ||
<Title Icon="exclamation-circle" | ||
Main="Network error" | ||
Sub="Background server connection failed" | ||
ButtonIcon="sync-alt" | ||
ButtonText="Reload the page" | ||
ButtonClick="@(async () => await ReloadAsync())" /> | ||
|
||
<p> | ||
We have troubles with background connection to the server. The application can't work corrently. | ||
</p> | ||
<p> | ||
Reload the page (or application) and this problem may disappear. | ||
<br /> | ||
Otherwise, we will be glad if you <a target="_blank" href="@Navigator.UrlMoneyProjectIssueNew("Background connection error")">report the problem</a>. | ||
</p> | ||
<p> | ||
<strong>We are sorry for this inconvenience.</strong> | ||
</p> | ||
</LayoutView> | ||
} | ||
else | ||
{ | ||
@ChildContent | ||
} |
35 changes: 35 additions & 0 deletions
35
src/Money.UI.Blazor/Pages/ApiHubConnectionChecker.razor.cs
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,35 @@ | ||
using Microsoft.AspNetCore.Components; | ||
using Money.Services; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Money.Pages | ||
{ | ||
public partial class ApiHubConnectionChecker : IDisposable | ||
{ | ||
[Inject] | ||
public IApiHubState State { get; set; } | ||
|
||
[Inject] | ||
public Navigator Navigator { get; set; } | ||
|
||
[Parameter] | ||
public RenderFragment ChildContent { get; set; } | ||
|
||
protected override void OnInitialized() | ||
{ | ||
base.OnInitialized(); | ||
State.Changed += StateHasChanged; | ||
} | ||
|
||
protected Task ReloadAsync() | ||
=> Navigator.ReloadAsync(); | ||
|
||
public void Dispose() | ||
=> State.Changed -= StateHasChanged; | ||
} | ||
} |
File renamed without changes.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Money.Services | ||
{ | ||
public interface IApiHubState | ||
{ | ||
bool IsActive { get; } | ||
bool IsError { get; } | ||
|
||
event Action Changed; | ||
} | ||
} |