added simple debugging page
This commit is contained in:
@@ -36,6 +36,11 @@ public class NotificationServerService
|
|||||||
|
|
||||||
private List<NotificationClientService> connectedClients = new();
|
private List<NotificationClientService> connectedClients = new();
|
||||||
|
|
||||||
|
public List<NotificationClientService> GetConnectedClients()
|
||||||
|
{
|
||||||
|
return connectedClients.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
public List<NotificationClientService> GetConnectedClients(User user)
|
public List<NotificationClientService> GetConnectedClients(User user)
|
||||||
{
|
{
|
||||||
return connectedClients.Where(x => x.User == user).ToList();
|
return connectedClients.Where(x => x.User == user).ToList();
|
||||||
|
|||||||
33
Moonlight/Shared/Views/Admin/Notifications/Debugging.razor
Normal file
33
Moonlight/Shared/Views/Admin/Notifications/Debugging.razor
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
@page "/admin/notifications/debugging"
|
||||||
|
@using Moonlight.App.Services.Notifications
|
||||||
|
|
||||||
|
@inject NotificationServerService NotificationServerService
|
||||||
|
|
||||||
|
<OnlyAdmin>
|
||||||
|
<LazyLoader Load="Load">
|
||||||
|
<h1>Notification Debugging</h1>
|
||||||
|
@foreach (var client in Clients)
|
||||||
|
{
|
||||||
|
<hr/>
|
||||||
|
<div>
|
||||||
|
<p>Id: @client.NotificationClient.Id User: @client.User.Email</p>
|
||||||
|
<button @onclick="async () => await SendSampleNotification(client)"></button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</LazyLoader>
|
||||||
|
</OnlyAdmin>
|
||||||
|
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private List<NotificationClientService> Clients;
|
||||||
|
|
||||||
|
private async Task Load(LazyLoader loader)
|
||||||
|
{
|
||||||
|
Clients = NotificationServerService.GetConnectedClients();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task SendSampleNotification(NotificationClientService client)
|
||||||
|
{
|
||||||
|
await client.SendAction(@"{""action"": ""notify"",""notification"":{""id"":999,""channel"":""Sample Channel"",""content"":""This is a sample Notification"",""title"":""Sample Notification""}}");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user