Skip to content

Commit 19a9798

Browse files
committed
Add wasm load percent to device-access layout.
1 parent 0c1847f commit 19a9798

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

ControlR.Web.Client/Components/Layout/DeviceAccess/DeviceAccessLayout.razor

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,18 @@
5757
</MudDrawer>
5858
<MudMainContent Class="h-100">
5959
<ServerAlertDisplay Class="mb-4" />
60-
@if (!RendererInfo.IsInteractive || !string.IsNullOrWhiteSpace(_loadingText))
60+
@if (!RendererInfo.IsInteractive)
6161
{
62-
<LoadingIndicator IsVisible Message="@(_loadingText ?? "Loading")" Class="mt-8" />
62+
<div class="w-100 text-center mt-8">
63+
<MudText Typo="Typo.h4" Color="Color.Info" GutterBottom>
64+
Loading <span id="blazor-load-progress"></span>
65+
</MudText>
66+
<MudProgressCircular Min="0" Max="1" Indeterminate Color="Color.Info" Size="Size.Large" />
67+
</div>
68+
}
69+
else if (_hubConnectionState != HubConnectionState.Connected)
70+
{
71+
<LoadingIndicator IsVisible Message="Connecting" Class="mt-8" />
6372
}
6473
else if (!string.IsNullOrWhiteSpace(_errorText))
6574
{

ControlR.Web.Client/Components/Layout/DeviceAccess/DeviceAccessLayout.razor.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public partial class DeviceAccessLayout : IAsyncDisposable
1818
private HubConnectionState _hubConnectionState = HubConnectionState.Disconnected;
1919
private bool _isAuthenticated;
2020
private bool _isDarkMode = true;
21-
private string? _loadingText = "Loading";
2221
private PersistingComponentStateSubscription _persistingSubscription;
2322
private ThemeMode _themeMode = ThemeMode.Auto;
2423

@@ -106,7 +105,6 @@ protected override async Task OnInitializedAsync()
106105
try
107106
{
108107
await base.OnInitializedAsync();
109-
_loadingText = "Loading";
110108

111109
_isAuthenticated = await AuthState.IsAuthenticated();
112110

@@ -155,13 +153,15 @@ protected override async Task OnInitializedAsync()
155153
var query = HttpUtility.ParseQueryString(uri.Query);
156154
query.Remove("logonToken");
157155
// Rebuild the remaining query string (retain deviceId and any future params).
158-
var remaining = query.HasKeys() ? "?" + string.Join('&', query.AllKeys.Select(k => $"{k}={query[k]}")) : string.Empty;
156+
var remaining = query.HasKeys()
157+
? "?" + string.Join('&', query.AllKeys.Select(k => $"{k}={query[k]}"))
158+
: string.Empty;
159+
159160
NavManager.NavigateTo(basePath + remaining, replace: true);
160161
return;
161162
}
162163

163-
_loadingText = "Connecting";
164-
await InvokeAsync(StateHasChanged);
164+
await GetDeviceInfo();
165165

166166
Messenger.Register<ToastMessage>(this, HandleToastMessage);
167167
Messenger.Register<ThemeChangedMessage>(this, HandleThemeChangedMessage);
@@ -170,7 +170,6 @@ protected override async Task OnInitializedAsync()
170170
Messenger.Register<DtoReceivedMessage<ChatResponseHubDto>>(this, HandleChatResponseReceived);
171171

172172
await HubConnector.Connect<IViewerHub>(AppConstants.ViewerHubPath);
173-
await GetDeviceInfo();
174173
}
175174
catch (Exception ex)
176175
{
@@ -179,7 +178,6 @@ protected override async Task OnInitializedAsync()
179178
}
180179
finally
181180
{
182-
_loadingText = null;
183181
await InvokeAsync(StateHasChanged);
184182
}
185183
}

0 commit comments

Comments
 (0)