Skip to content

Commit

Permalink
fixup! fixup! fixup! status: show new status page
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicatoscani committed Aug 2, 2023
1 parent 7d3f2a3 commit 3048490
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pkg/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ type Service struct {
IncidentType *IncidentType `json:"current_incident_type,omitempty"`

// Each product available in the zone
Children *[]Service `json:"children,omitempty"`
Children []Service `json:"children,omitempty"`
}

type Incident struct {
Id *int `json:"id,omitempty"`
Title *string `json:"title,omitempty"`
// The time at which the incident/maintenance started(UTC).
StartsAt string `json:"starts_at"`
StartsAt *string `json:"starts_at"`
// Type of current incident (major, minor, scheduled)
Type IncidentType `json:"type"`
Type *IncidentType `json:"type"`
// Services impacted (only id and name)
Services []Service `json:"services"`
}
Expand Down Expand Up @@ -146,7 +146,7 @@ func (s Services) getServiceNamebyId(id int) (string, error) {
return *parentService.Name, nil
}
// Try to find the Service Id in the child services
for _, childService := range *parentService.Children {
for _, childService := range parentService.Children {
// In this case, we returen the Parent and the Child names
if *childService.Id == id {
return *parentService.Name + " " + *childService.Name, nil
Expand Down Expand Up @@ -175,18 +175,18 @@ func (s StatusPalStatus) GetIncidents() ([][]string, [][]string, error) {
if err != nil {
return nil, nil, err
}
started, err := time.Parse(dateLayout, event.StartsAt)
started, err := time.Parse(dateLayout, *event.StartsAt)
if err != nil {
return nil, nil, err
}
startTimeUTC := started.Format(time.RFC822)
eventDetails := []string{svcName, *event.Title}
if event.Type == IncidentTypeScheduled {
if *event.Type == IncidentTypeScheduled {
eventDetails = append(eventDetails, "scheduled at "+startTimeUTC)
maintenances = append(maintenances, eventDetails)
} else {

eventDetails = append(eventDetails, fmt.Sprint(event.Type), "since "+startTimeUTC)
eventDetails = append(eventDetails, fmt.Sprint(*event.Type), "since "+startTimeUTC)
incidents = append(incidents, eventDetails)
}
}
Expand Down

0 comments on commit 3048490

Please sign in to comment.