-
Notifications
You must be signed in to change notification settings - Fork 16
feat: support status pages and services [sc-23401] #1039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Antoine-C
merged 11 commits into
main
from
antoinecoutellier/sc-23401/public-api-crud-resources-for-the-cli
Apr 1, 2025
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
11ca62a
feat: support status pages and services
Antoine-C 23d7a7f
refactor: prefer singular StatusPage
sorccu 962bee1
fix: make status page url required and remove non-existing customUrl
sorccu f235c58
chore: remove unused cardsServices
sorccu e1b4f7e
chore: update comments for the new constructs
sorccu ad6759b
feat: add defaultTheme support
sorccu dfea9db
feat: add redirectTo support
sorccu d745e93
fix: make cards required to match backend
sorccu 7f13030
chore: formatting
sorccu bb80c11
feat: add basic e2e test resources for status pages/services
sorccu ae55dd0
Merge branch 'main' into antoinecoutellier/sc-23401/public-api-crud-r…
Antoine-C File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/cli/e2e/__tests__/fixtures/deploy-project/status-page.check.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* eslint-disable no-new */ | ||
|
||
import { StatusPage, StatusPageService } from 'checkly/constructs' | ||
|
||
const fooService = new StatusPageService('foo-service', { | ||
name: 'Foo', | ||
}) | ||
|
||
const barService = new StatusPageService('bar-service', { | ||
name: 'Bar', | ||
}) | ||
|
||
new StatusPage('test-page-1', { | ||
name: 'Test Status Page 1', | ||
url: 'checkly-internal-test-status-page-18671', | ||
cards: [{ | ||
name: 'Card 1', | ||
services: [ | ||
fooService, | ||
barService, | ||
], | ||
}], | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Construct } from './construct' | ||
import { Session } from './project' | ||
|
||
export interface StatusPageServiceProps { | ||
/** | ||
* The name of the service. | ||
*/ | ||
name: string | ||
} | ||
|
||
/** | ||
* Creates a Service for Status Pages | ||
*/ | ||
export class StatusPageService extends Construct { | ||
name: string | ||
|
||
static readonly __checklyType = 'status-page-service' | ||
|
||
/** | ||
* Constructs the Status Page Service instance | ||
* | ||
* @param logicalId unique project-scoped resource name identification | ||
* @param props status page service configuration properties | ||
* | ||
* {@link https://checklyhq.com/docs/cli/constructs-reference/#statuspageservice Read more in the docs} | ||
*/ | ||
constructor (logicalId: string, props: StatusPageServiceProps) { | ||
super(StatusPageService.__checklyType, logicalId) | ||
this.name = props.name | ||
|
||
Session.registerConstruct(this) | ||
} | ||
|
||
synthesize (): any|null { | ||
return { | ||
name: this.name, | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import { Construct } from './construct' | ||
import { Session } from './project' | ||
import { StatusPageService } from './status-page-service' | ||
import { Ref } from './ref' | ||
|
||
export interface StatusPageCardProps { | ||
/** | ||
* The name of the card. | ||
*/ | ||
name: string | ||
/** | ||
* A list of services to include in the card. | ||
*/ | ||
services?: StatusPageService[] | ||
} | ||
|
||
export type StatusPageTheme = 'AUTO' | 'DARK' | 'LIGHT' | ||
|
||
export interface StatusPageProps { | ||
/** | ||
* The name of the status page. | ||
*/ | ||
name: string | ||
/** | ||
* The URL of the status page. | ||
*/ | ||
url: string | ||
/** | ||
* A list of cards to add to your status page. | ||
*/ | ||
cards: StatusPageCardProps[] | ||
/** | ||
* A custom user domain, e.g. "status.example.com". See the docs on updating your DNS and SSL usage. | ||
*/ | ||
customDomain?: string | ||
/** | ||
* A URL pointing to an image file that serves as the logo for the status page. | ||
*/ | ||
logo?: string | ||
/** | ||
* The URL that clicking the logo should redirect the user to. | ||
*/ | ||
redirectTo?: string | ||
/** | ||
* A URL pointing to an image file to be used as the favicon for the status page. | ||
*/ | ||
favicon?: string | ||
/** | ||
* The default theme of the status page. | ||
*/ | ||
defaultTheme?: StatusPageTheme | ||
} | ||
|
||
/** | ||
* Creates a Status Page | ||
*/ | ||
export class StatusPage extends Construct { | ||
name: string | ||
cards: StatusPageCardProps[] | ||
url: string | ||
customDomain?: string | ||
logo?: string | ||
redirectTo?: string | ||
favicon?: string | ||
defaultTheme?: StatusPageTheme | ||
|
||
static readonly __checklyType = 'status-page' | ||
|
||
/** | ||
* Constructs the Status Page instance | ||
* | ||
* @param logicalId unique project-scoped resource name identification | ||
* @param props status page configuration properties | ||
* | ||
* {@link https://checklyhq.com/docs/cli/constructs-reference/#statuspage Read more in the docs} | ||
*/ | ||
constructor (logicalId: string, props: StatusPageProps) { | ||
super(StatusPage.__checklyType, logicalId) | ||
this.name = props.name | ||
this.url = props.url | ||
this.cards = props.cards | ||
this.customDomain = props.customDomain | ||
this.logo = props.logo | ||
this.redirectTo = props.redirectTo | ||
this.favicon = props.favicon | ||
this.defaultTheme = props.defaultTheme | ||
|
||
Session.registerConstruct(this) | ||
} | ||
|
||
synthesize (): any|null { | ||
return { | ||
name: this.name, | ||
url: this.url, | ||
customDomain: this.customDomain, | ||
logo: this.logo, | ||
redirectTo: this.redirectTo, | ||
favicon: this.favicon, | ||
defaultTheme: this.defaultTheme, | ||
cards: this.cards.map(card => ({ | ||
name: card.name, | ||
services: card | ||
.services | ||
?.map((service) => Ref.from(service.logicalId)), | ||
})), | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.