From 7279f05a16d43c441228598da84f2eb8f30c6723 Mon Sep 17 00:00:00 2001 From: Daniel Balk <67603460+Daniel-Balk@users.noreply.github.com> Date: Fri, 16 Jun 2023 20:24:32 +0200 Subject: [PATCH] added simple debugging page --- .../NotificationServerService.cs | 5 +++ .../Views/Admin/Notifications/Debugging.razor | 33 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 Moonlight/Shared/Views/Admin/Notifications/Debugging.razor diff --git a/Moonlight/App/Services/Notifications/NotificationServerService.cs b/Moonlight/App/Services/Notifications/NotificationServerService.cs index 92d76690..d2d41a9f 100644 --- a/Moonlight/App/Services/Notifications/NotificationServerService.cs +++ b/Moonlight/App/Services/Notifications/NotificationServerService.cs @@ -36,6 +36,11 @@ public class NotificationServerService private List connectedClients = new(); + public List GetConnectedClients() + { + return connectedClients.ToList(); + } + public List GetConnectedClients(User user) { return connectedClients.Where(x => x.User == user).ToList(); diff --git a/Moonlight/Shared/Views/Admin/Notifications/Debugging.razor b/Moonlight/Shared/Views/Admin/Notifications/Debugging.razor new file mode 100644 index 00000000..05ea9fdd --- /dev/null +++ b/Moonlight/Shared/Views/Admin/Notifications/Debugging.razor @@ -0,0 +1,33 @@ +@page "/admin/notifications/debugging" +@using Moonlight.App.Services.Notifications + +@inject NotificationServerService NotificationServerService + + + +

Notification Debugging

+ @foreach (var client in Clients) + { +
+
+

Id: @client.NotificationClient.Id User: @client.User.Email

+ +
+ } +
+
+ + +@code { + private List 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""}}"); + } +} \ No newline at end of file