Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/openapi/monitoring-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -22744,9 +22744,9 @@
"format": "int32",
"nullable": true
},
"collapsed": {
"defaultOpen": {
"type": "boolean",
"description": "Whether the group is collapsed by default (default: true)",
"description": "Initial expand/collapse state when a visitor first loads the page; renderer may auto-expand on active incidents (default: true)",
"nullable": true
}
}
Expand Down Expand Up @@ -22816,7 +22816,7 @@
},
"startDate": {
"type": "string",
"description": "Date from which to start showing uptime data",
"description": "Date from which to start showing uptime; defaults to component creation. Set earlier to backdate (e.g. launch day); clamped at the monitor's createdAt for MONITOR-type components",
"format": "date",
"nullable": true
}
Expand Down Expand Up @@ -29659,7 +29659,7 @@
"updatedAt",
"displayOrder",
"pageOrder",
"collapsed"
"defaultOpen"
],
"type": "object",
"properties": {
Expand All @@ -29686,7 +29686,7 @@
"type": "integer",
"format": "int32"
},
"collapsed": {
"defaultOpen": {
"type": "boolean"
},
"components": {
Expand Down Expand Up @@ -32405,9 +32405,9 @@
"format": "int32",
"nullable": true
},
"collapsed": {
"defaultOpen": {
"type": "boolean",
"description": "Whether the group is collapsed by default; null preserves current",
"description": "Initial expand/collapse state on first page load; null preserves current. Renderer may auto-expand on active incidents",
"nullable": true
}
}
Expand Down Expand Up @@ -32458,7 +32458,7 @@
},
"startDate": {
"type": "string",
"description": "Date from which to start showing uptime data; null preserves current",
"description": "Date from which to start showing uptime; null preserves current. Bars never extend earlier than the underlying monitor's createdAt regardless of value",
"format": "date",
"nullable": true
}
Expand Down
7 changes: 5 additions & 2 deletions src/commands/status-pages/groups/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ export default class StatusPagesGroupsCreate extends Command {
...globalFlags,
name: Flags.string({description: 'Group name', required: true}),
description: Flags.string({description: 'Optional group description'}),
collapsed: Flags.boolean({description: 'Whether the group is collapsed by default', allowNo: true}),
'default-open': Flags.boolean({
description: 'Initial expand/collapse state on first page load (default: true). Use --no-default-open to seed collapsed.',
allowNo: true,
}),
'display-order': Flags.integer({description: 'Position in the group list'}),
}

Expand All @@ -20,7 +23,7 @@ export default class StatusPagesGroupsCreate extends Command {
const client = buildClient(flags)
const body: Record<string, unknown> = {name: flags.name}
if (flags.description) body.description = flags.description
if (flags.collapsed !== undefined) body.collapsed = flags.collapsed
if (flags['default-open'] !== undefined) body.defaultOpen = flags['default-open']
if (flags['display-order'] !== undefined) body.displayOrder = flags['display-order']
const resp = await apiPost(client, `/api/v1/status-pages/${args.id}/groups`, body)
display(this, unwrapData(resp), flags.output)
Expand Down
7 changes: 5 additions & 2 deletions src/commands/status-pages/groups/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ export default class StatusPagesGroupsUpdate extends Command {
...globalFlags,
name: Flags.string({description: 'Group name'}),
description: Flags.string({description: 'Group description'}),
collapsed: Flags.boolean({description: 'Whether the group is collapsed', allowNo: true}),
'default-open': Flags.boolean({
description: 'Initial expand/collapse state on first page load. Use --no-default-open to seed collapsed.',
allowNo: true,
}),
'display-order': Flags.integer({description: 'Position in the group list'}),
}

Expand All @@ -24,7 +27,7 @@ export default class StatusPagesGroupsUpdate extends Command {
const body: Record<string, unknown> = {}
if (flags.name) body.name = flags.name
if (flags.description !== undefined) body.description = flags.description
if (flags.collapsed !== undefined) body.collapsed = flags.collapsed
if (flags['default-open'] !== undefined) body.defaultOpen = flags['default-open']
if (flags['display-order'] !== undefined) body.displayOrder = flags['display-order']
const resp = await apiPut(client, `/api/v1/status-pages/${args.id}/groups/${args['group-id']}`, body)
display(this, unwrapData(resp), flags.output)
Expand Down
6 changes: 3 additions & 3 deletions src/lib/api-zod.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1082,15 +1082,15 @@ const CreateStatusPageComponentGroupRequest = z
name: z.string().min(0).max(255),
description: z.string().min(0).max(500).nullish(),
displayOrder: z.number().int().nullish(),
collapsed: z.boolean().nullish(),
defaultOpen: z.boolean().nullish(),
})
.strict();
const UpdateStatusPageComponentGroupRequest = z
.object({
name: z.string().min(0).max(255).nullable(),
description: z.string().min(0).max(500).nullable(),
displayOrder: z.number().int().nullable(),
collapsed: z.boolean().nullable(),
defaultOpen: z.boolean().nullable(),
})
.partial()
.strict();
Expand Down Expand Up @@ -2666,7 +2666,7 @@ const StatusPageComponentGroupDto = z
description: z.string().nullish(),
displayOrder: z.number().int(),
pageOrder: z.number().int(),
collapsed: z.boolean(),
defaultOpen: z.boolean(),
components: z.array(StatusPageComponentDto).nullish(),
createdAt: z.string().datetime({ offset: true }),
updatedAt: z.string().datetime({ offset: true }),
Expand Down
14 changes: 7 additions & 7 deletions src/lib/api.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3163,8 +3163,8 @@ export interface components {
* @description Position in the group list
*/
displayOrder?: number | null;
/** @description Whether the group is collapsed by default (default: true) */
collapsed?: boolean | null;
/** @description Initial expand/collapse state when a visitor first loads the page; renderer may auto-expand on active incidents (default: true) */
defaultOpen?: boolean | null;
};
CreateStatusPageComponentRequest: {
/** @description Component display name */
Expand Down Expand Up @@ -3202,7 +3202,7 @@ export interface components {
excludeFromOverall?: boolean | null;
/**
* Format: date
* @description Date from which to start showing uptime data
* @description Date from which to start showing uptime; defaults to component creation. Set earlier to backdate (e.g. launch day); clamped at the monitor's createdAt for MONITOR-type components
*/
startDate?: string | null;
};
Expand Down Expand Up @@ -6110,7 +6110,7 @@ export interface components {
displayOrder: number;
/** Format: int32 */
pageOrder: number;
collapsed: boolean;
defaultOpen: boolean;
components?: components["schemas"]["StatusPageComponentDto"][] | null;
/** Format: date-time */
createdAt: string;
Expand Down Expand Up @@ -6974,8 +6974,8 @@ export interface components {
* @description New position in the group list; null preserves current
*/
displayOrder?: number | null;
/** @description Whether the group is collapsed by default; null preserves current */
collapsed?: boolean | null;
/** @description Initial expand/collapse state on first page load; null preserves current. Renderer may auto-expand on active incidents */
defaultOpen?: boolean | null;
};
UpdateStatusPageComponentRequest: {
/** @description New component name; null preserves current */
Expand All @@ -7000,7 +7000,7 @@ export interface components {
excludeFromOverall?: boolean | null;
/**
* Format: date
* @description Date from which to start showing uptime data; null preserves current
* @description Date from which to start showing uptime; null preserves current. Bars never extend earlier than the underlying monitor's createdAt regardless of value
*/
startDate?: string | null;
};
Expand Down
8 changes: 4 additions & 4 deletions src/lib/yaml/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ export function statusPageGroupDesiredSnapshot(
return {
name: yaml.name,
description: yaml.description ?? null,
collapsed: yaml.collapsed ?? true,
defaultOpen: yaml.defaultOpen ?? true,
}
}

Expand Down Expand Up @@ -938,18 +938,18 @@ function makeGroupCollectionDef(
toCurrentSnapshot: (api) => ({
name: api.name ?? '',
description: api.description ?? null,
collapsed: api.collapsed ?? true,
defaultOpen: api.defaultOpen ?? true,
}),
async applyCreate(parentId, yaml, index) {
const resp = (await apiPost(
client, `/api/v1/status-pages/${parentId}/groups`,
{name: yaml.name, description: yaml.description ?? null, displayOrder: index, collapsed: yaml.collapsed ?? true},
{name: yaml.name, description: yaml.description ?? null, displayOrder: index, defaultOpen: yaml.defaultOpen ?? true},
)) as {data?: Schemas['StatusPageComponentGroupDto']}
return String(resp.data?.id ?? '')
},
async applyUpdate(parentId, childId, yaml, index) {
await apiPut(client, `/api/v1/status-pages/${parentId}/groups/${childId}`,
{name: yaml.name, description: yaml.description ?? null, displayOrder: index, collapsed: yaml.collapsed ?? true},
{name: yaml.name, description: yaml.description ?? null, displayOrder: index, defaultOpen: yaml.defaultOpen ?? true},
)
},
async applyDelete(parentId, childId) {
Expand Down
7 changes: 6 additions & 1 deletion src/lib/yaml/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,12 @@ export interface YamlStatusPageBranding {
export interface YamlStatusPageComponentGroup {
name: string
description?: string
collapsed?: boolean
/**
* Initial expand/collapse state when a visitor first loads the page.
* Defaults to `true` (group renders expanded). Renderer may auto-expand
* a collapsed group on active incidents.
*/
defaultOpen?: boolean
}

export interface YamlStatusPageComponent {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/yaml/zod-schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ const StatusPageBrandingSchema = z.object({
const StatusPageComponentGroupSchema = z.object({
name: z.string(),
description: z.string().optional(),
collapsed: z.boolean().optional(),
defaultOpen: z.boolean().optional(),
}).strict()

const StatusPageComponentSchema = z.object({
Expand Down
10 changes: 5 additions & 5 deletions test/yaml/partial-failure-convergence.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ interface FakeStatusPageGroup {
name: string
description: string | null
displayOrder: number
collapsed: boolean
defaultOpen: boolean
}

interface FakeStatusPageComponent {
Expand Down Expand Up @@ -320,11 +320,11 @@ class FakeApi {
const pageGroupsMatch = path.match(/^\/api\/v1\/status-pages\/([^/]+)\/groups$/)
if (pageGroupsMatch) {
const pageId = pageGroupsMatch[1]
const reqBody = body as {name: string; description?: string | null; displayOrder: number; collapsed?: boolean}
const reqBody = body as {name: string; description?: string | null; displayOrder: number; defaultOpen?: boolean}
const id = this.nextId('spg')
const dto: FakeStatusPageGroup = {
id, name: reqBody.name, description: reqBody.description ?? null,
displayOrder: reqBody.displayOrder, collapsed: reqBody.collapsed ?? true,
displayOrder: reqBody.displayOrder, defaultOpen: reqBody.defaultOpen ?? true,
}
this.statusPageGroups.get(pageId)!.set(id, dto)
return {data: dto}
Expand Down Expand Up @@ -372,11 +372,11 @@ class FakeApi {
if (groupPut) {
const group = this.statusPageGroups.get(groupPut[1])?.get(groupPut[2])
if (!group) throw new Error(`fake api: group ${groupPut[2]} not found`)
const reqBody = body as {name?: string; description?: string | null; displayOrder?: number; collapsed?: boolean}
const reqBody = body as {name?: string; description?: string | null; displayOrder?: number; defaultOpen?: boolean}
if (reqBody.name !== undefined) group.name = reqBody.name
if (reqBody.description !== undefined) group.description = reqBody.description ?? null
if (reqBody.displayOrder !== undefined) group.displayOrder = reqBody.displayOrder
if (reqBody.collapsed !== undefined) group.collapsed = reqBody.collapsed
if (reqBody.defaultOpen !== undefined) group.defaultOpen = reqBody.defaultOpen
return {data: group}
}
const compPut = path.match(/^\/api\/v1\/status-pages\/([^/]+)\/components\/([^/]+)$/)
Expand Down
2 changes: 1 addition & 1 deletion test/yaml/spec-field-parity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ const SNAPSHOT_COMPONENT_DTO_ONLY = [
'displayOrder', 'pageOrder', 'currentStatus', 'createdAt', 'updatedAt',
]

const SNAPSHOT_GROUP_FIELDS = ['name', 'description', 'collapsed']
const SNAPSHOT_GROUP_FIELDS = ['name', 'description', 'defaultOpen']

const SNAPSHOT_GROUP_DTO_ONLY = [
'id', 'statusPageId', 'displayOrder', 'pageOrder',
Expand Down
Loading