This is an automated email from the ASF dual-hosted git repository.
Aias00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hertzbeat.git
The following commit(s) were added to refs/heads/master by this push:
new b279d27345 feat: extend status page history up to 365 days (#4333)
b279d27345 is described below
commit b279d27345c94ccf03afc98ea820c431077da978
Author: NekoPunch <[email protected]>
AuthorDate: Sat Aug 22 20:38:47 2026 -0700
feat: extend status page history up to 365 days (#4333)
Co-authored-by: aias00 <[email protected]>
---
.../hertzbeat/manager/service/impl/StatusPageServiceImpl.java | 8 ++++----
.../manager/service/impl/StatusPageServiceImplTimeTest.java | 8 ++++++++
web-app/src/app/routes/status-public/status-public.component.html | 5 +++--
web-app/src/app/routes/status-public/status-public.component.ts | 2 +-
4 files changed, 16 insertions(+), 7 deletions(-)
diff --git
a/hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/service/impl/StatusPageServiceImpl.java
b/hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/service/impl/StatusPageServiceImpl.java
index 87dd8f56ad..4eca8d297a 100644
---
a/hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/service/impl/StatusPageServiceImpl.java
+++
b/hertzbeat-manager/src/main/java/org/apache/hertzbeat/manager/service/impl/StatusPageServiceImpl.java
@@ -125,8 +125,8 @@ public class StatusPageServiceImpl implements
StatusPageService {
@Override
public List<ComponentStatus> queryComponentsStatus(int days) {
- if (days < 1 || days > 90) {
- throw new IllegalArgumentException("days must be between 1 and
90");
+ if (days < 1 || days > 365) {
+ throw new IllegalArgumentException("days must be between 1 and
365");
}
int historySpanDays = days - 1;
@@ -246,8 +246,8 @@ public class StatusPageServiceImpl implements
StatusPageService {
@Override
public ComponentStatus queryComponentStatus(long id, int days) {
- if (days < 1 || days > 90) {
- throw new IllegalArgumentException("days must be between 1 and
90");
+ if (days < 1 || days > 365) {
+ throw new IllegalArgumentException("days must be between 1 and
365");
}
int historySpanDays = days - 1;
diff --git
a/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/service/impl/StatusPageServiceImplTimeTest.java
b/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/service/impl/StatusPageServiceImplTimeTest.java
index a8663886a1..e9b168b9f8 100644
---
a/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/service/impl/StatusPageServiceImplTimeTest.java
+++
b/hertzbeat-manager/src/test/java/org/apache/hertzbeat/manager/service/impl/StatusPageServiceImplTimeTest.java
@@ -18,6 +18,7 @@
package org.apache.hertzbeat.manager.service.impl;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.when;
@@ -102,6 +103,13 @@ class StatusPageServiceImplTimeTest {
assertEquals(30,
service.queryComponentsStatus(30).get(0).getHistory().size());
assertEquals(1,
service.queryComponentsStatus(1).get(0).getHistory().size());
assertEquals(90,
service.queryComponentsStatus(90).get(0).getHistory().size());
+ assertEquals(365,
service.queryComponentsStatus(365).get(0).getHistory().size());
+ }
+
+ @Test
+ void testDaysRangeValidation() {
+ assertThrows(IllegalArgumentException.class, () ->
service.queryComponentsStatus(0));
+ assertThrows(IllegalArgumentException.class, () ->
service.queryComponentsStatus(366));
}
@Test
diff --git a/web-app/src/app/routes/status-public/status-public.component.html
b/web-app/src/app/routes/status-public/status-public.component.html
index 18d58c6d84..c23b657abd 100755
--- a/web-app/src/app/routes/status-public/status-public.component.html
+++ b/web-app/src/app/routes/status-public/status-public.component.html
@@ -124,10 +124,11 @@
<span nz-icon style="margin-left: 5px" nzType="stop"
nzTheme="outline"></span>
</div>
</div>
- <div style="margin-left: 10px; margin-top: 10px; margin-bottom: 10px;
display: flex; gap: 2px">
+ <div style="margin-left: 10px; margin-top: 10px; margin-bottom: 10px;
display: flex" [style.gap.px]="historyDays > 90 ? 0 : 2">
<div
*ngFor="let historyItem of component.history"
- class="history-block br-8"
+ class="history-block"
+ [class.br-8]="historyDays <= 90"
[style]="'background:' + calculateHistoryBlockRgb(historyItem)"
nz-popover
[nzPopoverContent]="contentTemplate"
diff --git a/web-app/src/app/routes/status-public/status-public.component.ts
b/web-app/src/app/routes/status-public/status-public.component.ts
index 20cd255ff5..4901034879 100644
--- a/web-app/src/app/routes/status-public/status-public.component.ts
+++ b/web-app/src/app/routes/status-public/status-public.component.ts
@@ -52,7 +52,7 @@ export class StatusPublicComponent implements OnInit {
showMode: string = 'component';
historyDays: number = 30;
- historyDaysOptions: number[] = [1, 7, 30, 90];
+ historyDaysOptions: number[] = [1, 7, 30, 60, 90, 180, 365];
pageIndex: number = 1;
pageSize: number = 9999;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]