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
@@ -1,10 +1,17 @@
|
||||
-- name: CreateStatusPage :one
|
||||
INSERT INTO status_pages (org_id, slug, title, description, published, domain_token, theme)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
INSERT INTO status_pages (org_id, slug, title, description, published, show_component_details, domain_token, theme)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
RETURNING *;
|
||||
|
||||
-- name: UpdateStatusPage :one
|
||||
UPDATE status_pages SET slug = $2, title = $3, description = $4, published = $5, theme = $6, updated_at = now()
|
||||
UPDATE status_pages
|
||||
SET slug = $2,
|
||||
title = $3,
|
||||
description = $4,
|
||||
published = $5,
|
||||
show_component_details = $6,
|
||||
theme = $7,
|
||||
updated_at = now()
|
||||
WHERE id = $1
|
||||
RETURNING *;
|
||||
|
||||
@@ -30,7 +37,8 @@ SELECT * FROM status_pages ORDER BY title;
|
||||
DELETE FROM status_pages WHERE id = $1;
|
||||
|
||||
-- name: StatusPageMonitors :many
|
||||
SELECT spm.monitor_id, spm.section, spm.label, spm.position, m.name AS monitor_name, m.enabled
|
||||
SELECT spm.monitor_id, spm.section, spm.group_id, spm.label, spm.position,
|
||||
m.name AS monitor_name, m.enabled, m.group_id AS monitor_group_id
|
||||
FROM status_page_monitors spm
|
||||
JOIN monitors m ON m.id = spm.monitor_id
|
||||
WHERE spm.page_id = $1
|
||||
@@ -40,8 +48,42 @@ ORDER BY spm.position, m.name;
|
||||
DELETE FROM status_page_monitors WHERE page_id = $1;
|
||||
|
||||
-- name: AddStatusPageMonitor :exec
|
||||
INSERT INTO status_page_monitors (page_id, monitor_id, org_id, section, label, position)
|
||||
VALUES ($1, $2, $3, $4, $5, $6);
|
||||
INSERT INTO status_page_monitors (page_id, monitor_id, org_id, section, group_id, label, position)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7);
|
||||
|
||||
-- name: SetStatusPageMonitorGroup :exec
|
||||
UPDATE status_page_monitors SET group_id = $3, section = $4
|
||||
WHERE page_id = $1 AND monitor_id = $2;
|
||||
|
||||
-- name: ListStatusPageGroups :many
|
||||
SELECT * FROM status_page_groups
|
||||
WHERE page_id = $1
|
||||
ORDER BY position, name, id;
|
||||
|
||||
-- name: CreateStatusPageGroup :one
|
||||
INSERT INTO status_page_groups (page_id, org_id, parent_id, name, position)
|
||||
VALUES ($1, $2, $3, $4, $5)
|
||||
RETURNING *;
|
||||
|
||||
-- name: UpdateStatusPageGroup :one
|
||||
UPDATE status_page_groups
|
||||
SET name = $3, parent_id = $4, position = $5, updated_at = now()
|
||||
WHERE id = $1 AND page_id = $2
|
||||
RETURNING *;
|
||||
|
||||
-- name: ReparentStatusPageGroupChildren :exec
|
||||
UPDATE status_page_groups SET parent_id = $3, updated_at = now()
|
||||
WHERE page_id = $1 AND parent_id = $2;
|
||||
|
||||
-- name: ReparentStatusPageGroupMonitors :exec
|
||||
UPDATE status_page_monitors SET group_id = $3
|
||||
WHERE page_id = $1 AND group_id = $2;
|
||||
|
||||
-- name: DeleteStatusPageGroup :execrows
|
||||
DELETE FROM status_page_groups WHERE id = $1 AND page_id = $2;
|
||||
|
||||
-- name: ClearStatusPageGroups :exec
|
||||
DELETE FROM status_page_groups WHERE page_id = $1;
|
||||
|
||||
-- name: FindPublishedPage :one
|
||||
-- System scope: resolves a request to a page by verified custom domain or
|
||||
|
||||
Reference in new issue
Block a user