-
-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 🚧 wip * 🔥 pagerduty integration * 🚀 fix build * 🚀 fix build * 🚀 fix build * chore: small improvements * 🧹 --------- Co-authored-by: Maximilian Kaske <[email protected]>
- Loading branch information
1 parent
70cf416
commit efffb8d
Showing
44 changed files
with
671 additions
and
175 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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,41 @@ | ||
--- | ||
title: PagerDuty | ||
--- | ||
|
||
Get Notified on PagerDuty when we create an incident. | ||
|
||
## How to connect PagerDuty | ||
|
||
Go to the Alerts Page . Select `PagerDuty` from the list of available integrations. | ||
|
||
|
||
|
||
<Frame caption="Connect to PagerDuty"> | ||
<img | ||
src="/images/notification/pagerduty/pagerduty-1.png" | ||
alt="Connect to PagerDuty" | ||
/> | ||
</Frame> | ||
|
||
You will be redirected to the PagerDuty website to authorize OpenStatus to send notifications to your account. | ||
|
||
<Frame caption="Connect to PagerDuty"> | ||
<img | ||
src="/images/notification/pagerduty/pagerduty-3.png" | ||
alt="Connect to PagerDuty" | ||
/> | ||
</Frame> | ||
|
||
|
||
Select the service you want to use to send notifications. You can create a new service if you don't have one. | ||
|
||
<Frame caption="Connect to PagerDuty"> | ||
<img | ||
src="/images/notification/pagerduty/pagerduty-2.png" | ||
alt="Connect to PagerDuty" | ||
/> | ||
</Frame> | ||
|
||
You are now connected to PagerDuty. Give your integration a name and save it. | ||
|
||
You will receive some notifications if we detect an incident |
This file contains 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 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 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 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 85 additions & 0 deletions
85
...pp/app/[workspaceSlug]/(dashboard)/notifications/(overview)/_components/channel-table.tsx
This file contains 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,85 @@ | ||
import type { Workspace } from "@openstatus/db/src/schema"; | ||
import { getLimit } from "@openstatus/plans"; | ||
import { Button, Separator } from "@openstatus/ui"; | ||
import Link from "next/link"; | ||
|
||
// FIXME: create a Channel Component within the file to avoid code duplication | ||
|
||
interface ChannelTable { | ||
workspace: Workspace; | ||
disabled?: boolean; | ||
} | ||
|
||
export default function ChannelTable({ workspace, disabled }: ChannelTable) { | ||
const isPagerDutyAllowed = getLimit(workspace.plan, "pagerduty"); | ||
const isSMSAllowed = getLimit(workspace.plan, "sms"); | ||
return ( | ||
<div className="col-span-full w-full rounded-lg border border-border border-dashed bg-background p-8"> | ||
<h2 className="font-cal text-2xl">Channels</h2> | ||
<h3 className="text-muted-foreground">Connect all your channels</h3> | ||
<div className="mt-4 rounded-md border"> | ||
<Channel | ||
title="Discord" | ||
description="Send notifications to discord." | ||
href="./notifications/new/discord" | ||
disabled={disabled} | ||
/> | ||
<Separator /> | ||
<Channel | ||
title="Email" | ||
description="Send notifications by email." | ||
href="./notifications/new/email" | ||
disabled={disabled} | ||
/> | ||
<Separator /> | ||
<Channel | ||
title="PagerDuty" | ||
description="Send notifications to PagerDuty." | ||
href={`https://app.pagerduty.com/install/integration?app_id=PN76M56&redirect_url=${ | ||
process.env.NODE_ENV === "development" // FIXME: This sucks | ||
? "http://localhost:3000" | ||
: "https://www.openstatus.dev" | ||
}/app/${workspace.slug}/notifications/new/pagerduty&version=2`} | ||
disabled={disabled || isPagerDutyAllowed} | ||
/> | ||
<Separator /> | ||
<Channel | ||
title="Slack" | ||
description="Send notifications to Slack." | ||
href="./notifications/new/slack" | ||
disabled={disabled} | ||
/> | ||
<Separator /> | ||
<Channel | ||
title="SMS" | ||
description="Send notifications to your phones." | ||
href="./notifications/new/sms" | ||
disabled={disabled || isSMSAllowed} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
interface ChannelProps { | ||
title: string; | ||
description: string; | ||
href: string; | ||
disabled?: boolean; | ||
} | ||
|
||
function Channel({ title, description, href, disabled }: ChannelProps) { | ||
return ( | ||
<div className="flex items-center gap-4 px-4 py-3"> | ||
<div className="flex-1 space-y-1"> | ||
<p className="font-medium text-sm leading-none">{title}</p> | ||
<p className="text-muted-foreground text-sm">{description}</p> | ||
</div> | ||
<div> | ||
<Button disabled={disabled} asChild={!disabled}> | ||
{disabled ? "Create" : <Link href={href}>Create</Link>} | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains 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 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 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
41 changes: 41 additions & 0 deletions
41
apps/web/src/app/app/[workspaceSlug]/(dashboard)/notifications/new/[channel]/page.tsx
This file contains 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,41 @@ | ||
import { ProFeatureAlert } from "@/components/billing/pro-feature-alert"; | ||
import { NotificationForm } from "@/components/forms/notification-form"; | ||
import { api } from "@/trpc/server"; | ||
import { notificationProviderSchema } from "@openstatus/db/src/schema"; | ||
import { getLimit } from "@openstatus/plans"; | ||
import { notFound } from "next/navigation"; | ||
|
||
export default async function ChannelPage({ | ||
params, | ||
}: { | ||
params: { channel: string }; | ||
}) { | ||
const validation = notificationProviderSchema | ||
.exclude(["pagerduty"]) | ||
.safeParse(params.channel); | ||
|
||
if (!validation.success) notFound(); | ||
|
||
const workspace = await api.workspace.getWorkspace.query(); | ||
|
||
const provider = validation.data; | ||
|
||
const allowed = | ||
provider === "sms" ? getLimit(workspace.plan, provider) : true; | ||
|
||
if (!allowed) return <ProFeatureAlert feature="SMS channel notification" />; | ||
|
||
const isLimitReached = | ||
await api.notification.isNotificationLimitReached.query(); | ||
|
||
if (isLimitReached) | ||
return <ProFeatureAlert feature="More notification channel" />; | ||
|
||
return ( | ||
<NotificationForm | ||
workspacePlan={workspace.plan} | ||
nextUrl="../" | ||
provider={provider} | ||
/> | ||
); | ||
} |
This file contains 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
Oops, something went wrong.