From 2a59e1b7fdbe003c201d4ebb2f2c4bf386122f28 Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Wed, 29 Jun 2022 10:38:24 +0200 Subject: [PATCH] Disable admin logs next button when there are no more logs (#9277) --- .../Administration/UI/Logs/AdminLogsEui.cs | 16 +++++++++++----- .../Administration/Logs/AdminLogsEui.cs | 2 +- .../Administration/Logs/AdminLogsEuiState.cs | 4 +++- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Content.Client/Administration/UI/Logs/AdminLogsEui.cs b/Content.Client/Administration/UI/Logs/AdminLogsEui.cs index ea8e8075c6..0c0c87f6c2 100644 --- a/Content.Client/Administration/UI/Logs/AdminLogsEui.cs +++ b/Content.Client/Administration/UI/Logs/AdminLogsEui.cs @@ -125,11 +125,17 @@ public sealed class AdminLogsEui : BaseEui switch (msg) { - case NewLogs {Replace: true} newLogs: - LogsControl.SetLogs(newLogs.Logs); - break; - case NewLogs {Replace: false} newLogs: - LogsControl.AddLogs(newLogs.Logs); + case NewLogs newLogs: + if (newLogs.Replace) + { + LogsControl.SetLogs(newLogs.Logs); + } + else + { + LogsControl.AddLogs(newLogs.Logs); + } + + LogsControl.NextButton.Disabled = !newLogs.HasNext; break; } } diff --git a/Content.Server/Administration/Logs/AdminLogsEui.cs b/Content.Server/Administration/Logs/AdminLogsEui.cs index d9d700f0f4..1851778131 100644 --- a/Content.Server/Administration/Logs/AdminLogsEui.cs +++ b/Content.Server/Administration/Logs/AdminLogsEui.cs @@ -162,7 +162,7 @@ public sealed class AdminLogsEui : BaseEui _filter.LastLogId = logs[largestId].Id; } - var message = new NewLogs(logs, replace); + var message = new NewLogs(logs, replace, logs.Count >= _filter.Limit); SendMessage(message); diff --git a/Content.Shared/Administration/Logs/AdminLogsEuiState.cs b/Content.Shared/Administration/Logs/AdminLogsEuiState.cs index 3eaa3acd71..67017aca51 100644 --- a/Content.Shared/Administration/Logs/AdminLogsEuiState.cs +++ b/Content.Shared/Administration/Logs/AdminLogsEuiState.cs @@ -30,14 +30,16 @@ public static class AdminLogsEuiMsg [Serializable, NetSerializable] public sealed class NewLogs : EuiMessageBase { - public NewLogs(List logs, bool replace) + public NewLogs(List logs, bool replace, bool hasNext) { Logs = logs; Replace = replace; + HasNext = hasNext; } public List Logs { get; set; } public bool Replace { get; set; } + public bool HasNext { get; set; } } [Serializable, NetSerializable]