Compare commits
2 Commits
335b39893f
...
96eb660b29
| Author | SHA1 | Date | |
|---|---|---|---|
| 96eb660b29 | |||
|
c471a72ff5
|
@@ -0,0 +1,50 @@
|
|||||||
|
name: Bug Report
|
||||||
|
about: Something isn't working as expected
|
||||||
|
labels:
|
||||||
|
- bug
|
||||||
|
body:
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Description
|
||||||
|
description: What happened?
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: reproduction
|
||||||
|
attributes:
|
||||||
|
label: Steps to Reproduce
|
||||||
|
description: Minimal steps to trigger the bug.
|
||||||
|
placeholder: |
|
||||||
|
1. Run `uptop serve`
|
||||||
|
2. Navigate to ...
|
||||||
|
3. See error
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: expected
|
||||||
|
attributes:
|
||||||
|
label: Expected Behavior
|
||||||
|
description: What should have happened instead?
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: environment
|
||||||
|
attributes:
|
||||||
|
label: Environment
|
||||||
|
description: OS, Go version, uptop version, terminal emulator.
|
||||||
|
placeholder: |
|
||||||
|
- OS: Debian 13
|
||||||
|
- Go: 1.26
|
||||||
|
- uptop: 2026.06.1
|
||||||
|
- Terminal: Ghostty
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
- type: textarea
|
||||||
|
id: logs
|
||||||
|
attributes:
|
||||||
|
label: Relevant Logs
|
||||||
|
description: Paste any error output or logs.
|
||||||
|
render: shell
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
name: Feature Request
|
||||||
|
about: Suggest a new feature or enhancement
|
||||||
|
labels:
|
||||||
|
- feature
|
||||||
|
body:
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Description
|
||||||
|
description: What do you want and why?
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: motivation
|
||||||
|
attributes:
|
||||||
|
label: Motivation
|
||||||
|
description: What problem does this solve? What workflow does it improve?
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: acceptance
|
||||||
|
attributes:
|
||||||
|
label: Acceptance Criteria
|
||||||
|
description: How do we know this is done?
|
||||||
|
placeholder: |
|
||||||
|
- [ ] Criterion 1
|
||||||
|
- [ ] Criterion 2
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
- type: dropdown
|
||||||
|
id: scope
|
||||||
|
attributes:
|
||||||
|
label: Area
|
||||||
|
options:
|
||||||
|
- TUI
|
||||||
|
- API / Server
|
||||||
|
- Monitoring Engine
|
||||||
|
- Alerts
|
||||||
|
- Distribution / Packaging
|
||||||
|
- Documentation
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
@@ -127,8 +127,7 @@ func ComputeSLA(changes []models.StateChange, currentStatus string, window time.
|
|||||||
return report
|
return report
|
||||||
}
|
}
|
||||||
|
|
||||||
func ComputeDailyBreakdown(changes []models.StateChange, currentStatus string, days int) []DayReport {
|
func ComputeDailyBreakdown(changes []models.StateChange, currentStatus string, days int, now time.Time) []DayReport {
|
||||||
now := time.Now()
|
|
||||||
reports := make([]DayReport, days)
|
reports := make([]DayReport, days)
|
||||||
|
|
||||||
for i := 0; i < days; i++ {
|
for i := 0; i < days; i++ {
|
||||||
|
|||||||
@@ -118,13 +118,14 @@ func TestComputeSLA_LateNotDown(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestComputeDailyBreakdown(t *testing.T) {
|
func TestComputeDailyBreakdown(t *testing.T) {
|
||||||
now := time.Now()
|
// Use a fixed time well past midnight so the outage always falls within today's window.
|
||||||
|
now := time.Date(2026, 6, 4, 15, 0, 0, 0, time.UTC)
|
||||||
changes := []models.StateChange{
|
changes := []models.StateChange{
|
||||||
{ToStatus: "UP", ChangedAt: now.Add(-1 * time.Hour)},
|
{ToStatus: "UP", ChangedAt: now.Add(-1 * time.Hour)},
|
||||||
{ToStatus: "DOWN", FromStatus: "UP", ChangedAt: now.Add(-2 * time.Hour)},
|
{ToStatus: "DOWN", FromStatus: "UP", ChangedAt: now.Add(-2 * time.Hour)},
|
||||||
}
|
}
|
||||||
|
|
||||||
days := ComputeDailyBreakdown(changes, "UP", 7)
|
days := ComputeDailyBreakdown(changes, "UP", 7, now)
|
||||||
|
|
||||||
if len(days) != 7 {
|
if len(days) != 7 {
|
||||||
t.Fatalf("expected 7 days, got %d", len(days))
|
t.Fatalf("expected 7 days, got %d", len(days))
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ func (m *Model) recomputeSLA() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m.slaReport = monitor.ComputeSLA(changes, currentStatus, period.duration)
|
m.slaReport = monitor.ComputeSLA(changes, currentStatus, period.duration)
|
||||||
m.slaDailyBreakdown = monitor.ComputeDailyBreakdown(changes, currentStatus, period.days)
|
m.slaDailyBreakdown = monitor.ComputeDailyBreakdown(changes, currentStatus, period.days, time.Now())
|
||||||
|
|
||||||
m.slaViewport = viewport.New(
|
m.slaViewport = viewport.New(
|
||||||
m.termWidth-chromePadH,
|
m.termWidth-chromePadH,
|
||||||
|
|||||||
Reference in New Issue
Block a user