fix(telemetry): fix typo 'sucess' -> 'success' everywhere
This commit is contained in:
parent
b5960db4f9
commit
7915237622
@ -105,7 +105,7 @@ func (p *PBClient) FetchDashboardData(ctx context.Context, days int) (*Dashboard
|
|||||||
data.TotalInstalls++
|
data.TotalInstalls++
|
||||||
|
|
||||||
switch r.Status {
|
switch r.Status {
|
||||||
case "sucess":
|
case "success":
|
||||||
data.SuccessCount++
|
data.SuccessCount++
|
||||||
case "failed":
|
case "failed":
|
||||||
data.FailedCount++
|
data.FailedCount++
|
||||||
@ -155,7 +155,7 @@ func (p *PBClient) FetchDashboardData(ctx context.Context, days int) (*Dashboard
|
|||||||
// Daily stats (use Created field if available)
|
// Daily stats (use Created field if available)
|
||||||
if r.Created != "" {
|
if r.Created != "" {
|
||||||
date := r.Created[:10] // "2026-02-09"
|
date := r.Created[:10] // "2026-02-09"
|
||||||
if r.Status == "sucess" {
|
if r.Status == "success" {
|
||||||
dailySuccess[date]++
|
dailySuccess[date]++
|
||||||
} else if r.Status == "failed" {
|
} else if r.Status == "failed" {
|
||||||
dailyFailed[date]++
|
dailyFailed[date]++
|
||||||
@ -700,7 +700,7 @@ func DashboardHTML() string {
|
|||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status-badge.sucess { background: rgba(63, 185, 80, 0.2); color: var(--accent-green); }
|
.status-badge.success { background: rgba(63, 185, 80, 0.2); color: var(--accent-green); }
|
||||||
.status-badge.failed { background: rgba(248, 81, 73, 0.2); color: var(--accent-red); }
|
.status-badge.failed { background: rgba(248, 81, 73, 0.2); color: var(--accent-red); }
|
||||||
.status-badge.installing { background: rgba(210, 153, 34, 0.2); color: var(--accent-yellow); }
|
.status-badge.installing { background: rgba(210, 153, 34, 0.2); color: var(--accent-yellow); }
|
||||||
|
|
||||||
@ -1043,7 +1043,7 @@ func DashboardHTML() string {
|
|||||||
<input type="text" id="filterApp" placeholder="Filter by app..." oninput="filterTable()">
|
<input type="text" id="filterApp" placeholder="Filter by app..." oninput="filterTable()">
|
||||||
<select id="filterStatus" onchange="filterTable()">
|
<select id="filterStatus" onchange="filterTable()">
|
||||||
<option value="">All Status</option>
|
<option value="">All Status</option>
|
||||||
<option value="sucess">Success</option>
|
<option value="success">Success</option>
|
||||||
<option value="failed">Failed</option>
|
<option value="failed">Failed</option>
|
||||||
<option value="installing">Installing</option>
|
<option value="installing">Installing</option>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@ -264,12 +264,12 @@ func fetchPage(page, limit int) ([]OldDataModel, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func importRecord(pbURL, collection string, old OldDataModel) error {
|
func importRecord(pbURL, collection string, old OldDataModel) error {
|
||||||
// Map status: "done" -> "sucess" (note the typo in the original schema)
|
// Map status: "done" -> "success"
|
||||||
status := old.Status
|
status := old.Status
|
||||||
switch status {
|
switch status {
|
||||||
case "done":
|
case "done":
|
||||||
status = "sucess" // Note: original schema has typo "sucess" not "success"
|
status = "success"
|
||||||
case "installing", "failed", "unknown", "sucess":
|
case "installing", "failed", "unknown", "success":
|
||||||
// keep as-is
|
// keep as-is
|
||||||
default:
|
default:
|
||||||
status = "unknown"
|
status = "unknown"
|
||||||
|
|||||||
@ -64,7 +64,7 @@ type TelemetryIn struct {
|
|||||||
RandomID string `json:"random_id"` // Session UUID
|
RandomID string `json:"random_id"` // Session UUID
|
||||||
Type string `json:"type"` // "lxc" or "vm"
|
Type string `json:"type"` // "lxc" or "vm"
|
||||||
NSAPP string `json:"nsapp"` // Application name (e.g., "jellyfin")
|
NSAPP string `json:"nsapp"` // Application name (e.g., "jellyfin")
|
||||||
Status string `json:"status"` // "installing", "sucess", "failed", "unknown"
|
Status string `json:"status"` // "installing", "success", "failed", "unknown"
|
||||||
|
|
||||||
// Container/VM specs
|
// Container/VM specs
|
||||||
CTType int `json:"ct_type,omitempty"` // 1=unprivileged, 2=privileged/VM
|
CTType int `json:"ct_type,omitempty"` // 1=unprivileged, 2=privileged/VM
|
||||||
@ -319,7 +319,7 @@ func (p *PBClient) UpsertTelemetry(ctx context.Context, payload TelemetryOut) er
|
|||||||
return p.CreateTelemetry(ctx, payload)
|
return p.CreateTelemetry(ctx, payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
// For status updates (sucess/failed/unknown), find and update existing record
|
// For status updates (success/failed/unknown), find and update existing record
|
||||||
recordID, err := p.FindRecordByRandomID(ctx, payload.RandomID)
|
recordID, err := p.FindRecordByRandomID(ctx, payload.RandomID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Search failed, log and return error
|
// Search failed, log and return error
|
||||||
@ -493,8 +493,8 @@ var (
|
|||||||
// Allowed values for 'type' field
|
// Allowed values for 'type' field
|
||||||
allowedType = map[string]bool{"lxc": true, "vm": true}
|
allowedType = map[string]bool{"lxc": true, "vm": true}
|
||||||
|
|
||||||
// Allowed values for 'status' field (note: "sucess" is intentional, matches PB schema)
|
// Allowed values for 'status' field
|
||||||
allowedStatus = map[string]bool{"installing": true, "sucess": true, "failed": true, "unknown": true}
|
allowedStatus = map[string]bool{"installing": true, "success": true, "failed": true, "unknown": true}
|
||||||
|
|
||||||
// Allowed values for 'os_type' field
|
// Allowed values for 'os_type' field
|
||||||
allowedOsType = map[string]bool{
|
allowedOsType = map[string]bool{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user