feat(statuspage): add nested status page groups and optional component details
This commit is contained in:
1 parent
1c31003baf
commit
9b26b4150e
26 files changed
+4566
-760
No files matched your search
+29
-13
@@ -279,19 +279,22 @@ type exportChannel struct {
|
||||
}
|
||||
|
||||
type exportStatusPage struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Slug string `json:"slug"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Published bool `json:"published"`
|
||||
CustomDomain *string `json:"custom_domain"`
|
||||
Monitors []exportPageMember `json:"monitors"`
|
||||
ID uuid.UUID `json:"id"`
|
||||
Slug string `json:"slug"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Published bool `json:"published"`
|
||||
ShowComponentDetails bool `json:"show_component_details"`
|
||||
CustomDomain *string `json:"custom_domain"`
|
||||
Groups []pageGroupView `json:"groups"`
|
||||
Monitors []exportPageMember `json:"monitors"`
|
||||
}
|
||||
|
||||
type exportPageMember struct {
|
||||
MonitorID uuid.UUID `json:"monitor_id"`
|
||||
Section string `json:"section"`
|
||||
Label string `json:"label"`
|
||||
MonitorID uuid.UUID `json:"monitor_id"`
|
||||
GroupID *uuid.UUID `json:"group_id"`
|
||||
Section string `json:"section"`
|
||||
Label string `json:"label"`
|
||||
}
|
||||
|
||||
type exportSSO struct {
|
||||
@@ -449,17 +452,30 @@ func (s *Server) buildOrgExport(ctx context.Context, p *principal) (orgExport, e
|
||||
}
|
||||
x.StatusPages = []exportStatusPage{}
|
||||
for _, pg := range pages {
|
||||
pgGroups, err := q.ListStatusPageGroups(ctx, pg.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
exportedGroups := []pageGroupView{}
|
||||
newPageGroupTree(pgGroups).walk(func(g store.StatusPageGroup, _ int) {
|
||||
exportedGroups = append(exportedGroups, pageGroupView{
|
||||
ID: g.ID, Name: g.Name, ParentID: g.ParentID, Position: g.Position,
|
||||
})
|
||||
})
|
||||
pm, err := q.StatusPageMonitors(ctx, pg.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
members := []exportPageMember{}
|
||||
for _, m := range pm {
|
||||
members = append(members, exportPageMember{MonitorID: m.MonitorID, Section: m.Section, Label: m.Label})
|
||||
members = append(members, exportPageMember{
|
||||
MonitorID: m.MonitorID, GroupID: m.GroupID, Section: m.Section, Label: m.Label,
|
||||
})
|
||||
}
|
||||
x.StatusPages = append(x.StatusPages, exportStatusPage{
|
||||
ID: pg.ID, Slug: pg.Slug, Title: pg.Title, Description: pg.Description, Published: pg.Published,
|
||||
CustomDomain: pg.CustomDomain, Monitors: members,
|
||||
ID: pg.ID, Slug: pg.Slug, Title: pg.Title, Description: pg.Description,
|
||||
Published: pg.Published, ShowComponentDetails: pg.ShowComponentDetails,
|
||||
CustomDomain: pg.CustomDomain, Groups: exportedGroups, Monitors: members,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user