Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Support form shows if there's any incidents, and hook up everything e2e

Joshen Limb82d388f9170
diff --git a/studio/components/interfaces/Settings/API/ServiceList.tsx b/studio/components/interfaces/Settings/API/ServiceList.tsx
index 9638fecf63e..b3630cc3791 100644
--- a/studio/components/interfaces/Settings/API/ServiceList.tsx
+++ b/studio/components/interfaces/Settings/API/ServiceList.tsx
@@ -1,11 +1,8 @@
-import useSWR from 'swr'
import { FC, useEffect, useRef } from 'react'
import { useRouter } from 'next/router'
import { JwtSecretUpdateError, JwtSecretUpdateStatus } from '@supabase/shared-types/out/events'
import { IconAlertCircle, Input } from 'ui'
-import { API_URL } from 'lib/constants'
-import { get } from 'lib/common/fetch'
import {
useStore,
useProjectSettings,
diff --git a/studio/components/interfaces/Support/SupportForm.tsx b/studio/components/interfaces/Support/SupportForm.tsx
index 55448d9ffdf..888514fd130 100644
--- a/studio/components/interfaces/Support/SupportForm.tsx
+++ b/studio/components/interfaces/Support/SupportForm.tsx
@@ -1,7 +1,18 @@
import { useRouter } from 'next/router'
import { useEffect, useState, FC, ChangeEvent, useRef } from 'react'
import { observer } from 'mobx-react-lite'
-import { Button, IconMail, IconPlus, IconX, Input, Listbox, Form, IconLoader } from 'ui'
+import {
+ Button,
+ IconMail,
+ IconPlus,
+ IconX,
+ Input,
+ Listbox,
+ Form,
+ IconLoader,
+ IconAlertCircle,
+ IconExternalLink,
+} from 'ui'
import { Project } from 'types'
import { useStore, useFlag } from 'hooks'
@@ -16,17 +27,11 @@ import { CATEGORY_OPTIONS, SEVERITY_OPTIONS, SERVICE_OPTIONS } from './Support.c
import DisabledStateForFreeTier from './DisabledStateForFreeTier'
import BestPracticesGuidance from './BestPracticesGuidance'
import ClientLibrariesGuidance from './ClientLibrariesGuidance'
+import InformationBox from 'components/ui/InformationBox'
+import Link from 'next/link'
const MAX_ATTACHMENTS = 5
-// [Joshen] Note to self - need to double check that this will work with the actual ticket submission to Hubspot too
-// Remaining
-// - [x] Github issues link for problems
-// - [x] Github discussions/discord link for best practices
-// - Improve success state of submission
-// - Integrate with API and Hubspot
-// Do a screen grab, get approval from Ant/Jonny
-
interface Props {
setSentCategory: (value: string) => void
}
@@ -89,7 +94,7 @@ const SupportForm: FC<Props> = ({ setSentCategory }) => {
? sortedProjects[0].ref
: 'no-project',
subject: '',
- body: '',
+ message: '',
}
const onFilesUpload = async (event: ChangeEvent<HTMLInputElement>) => {
@@ -122,7 +127,7 @@ const SupportForm: FC<Props> = ({ setSentCategory }) => {
const onValidate = (values: any) => {
const errors: any = {}
if (!values.subject) errors.subject = 'Please add a subject heading'
- if (!values.body) errors.body = 'Please type in a message'
+ if (!values.message) errors.message = 'Please type in a message'
return errors
}
@@ -132,39 +137,36 @@ const SupportForm: FC<Props> = ({ setSentCategory }) => {
uploadedFiles.length > 0 ? await uploadAttachments(values.projectRef, uploadedFiles) : []
const payload = {
...values,
- message: formatMessage(values.body, attachments),
+ message: formatMessage(values.message, attachments),
verified: true,
tags: ['dashboard-support-form'],
siteUrl: '',
additionalRedirectUrls: '',
- affectedServices: selectedServices.map((service) => service.replace(/ /g, '_').toLowerCase()),
+ affectedServices: selectedServices
+ .map((service) => service.replace(/ /g, '_').toLowerCase())
+ .join(';'),
+ }
+
+ if (values.projectRef !== 'no-project') {
+ const URL = `${API_URL}/auth/${values.projectRef}/config`
+ const authConfig = await get(URL)
+ if (!authConfig.error) {
+ payload.siteUrl = authConfig.SITE_URL
+ payload.additionalRedirectUrls = authConfig.URI_ALLOW_LIST
+ }
}
- console.log('payload', payload)
- setSentCategory(values.category)
- return
-
- // [Joshen] Need to test this
- // if (values.projectRef !== 'no-project') {
- // const URL = `${API_URL}/auth/${values.projectRef}/config`
- // const authConfig = await get(URL)
- // if (!authConfig.error) {
- // payload.siteUrl = authConfig.SITE_URL
- // payload.additionalRedirectUrls = authConfig.URI_ALLOW_LIST
- // }
- // }
-
- // const response = await post(`${API_URL}/feedback/send`, payload)
- // if (response.error) {
- // ui.setNotification({
- // category: 'error',
- // message: `Failed to submit support ticket: ${response.error.message}`,
- // })
- // } else {
- // ui.setNotification({ category: 'success', message: 'Support request sent. Thank you!' })
- // setSentCategory(values.category)
- // }
- // setSubmitting(false)
+ const response = await post(`${API_URL}/feedback/send`, payload)
+ if (response.error) {
+ ui.setNotification({
+ category: 'error',
+ message: `Failed to submit support ticket: ${response.error.message}`,
+ })
+ setSubmitting(false)
+ } else {
+ ui.setNotification({ category: 'success', message: 'Support request sent. Thank you!' })
+ setSentCategory(values.category)
+ }
}
return (
@@ -190,6 +192,9 @@ const SupportForm: FC<Props> = ({ setSentCategory }) => {
return (
<div className="space-y-8 w-[620px]">
+ <div className="px-6">
+ <h3 className="text-xl">How can we help?</h3>
+ </div>
<div className="px-6">
<Listbox
id="category"
@@ -251,17 +256,53 @@ const SupportForm: FC<Props> = ({ setSentCategory }) => {
<p className="text-sm text-scale-1000 mt-2">
This project is on the{' '}
<span className="text-scale-1100">
- {planNames[selectedProject?.subscription_tier]} plan
+ {planNames[selectedProject?.subscription_tier]} tier
</span>
</p>
- ) : (
+ ) : selectedProject?.ref !== 'no-project' ? (
<div className="flex items-center space-x-2 mt-2">
<IconLoader size={14} className="animate-spin" />
- <p className="text-sm text-scale-1000">Checking project's plan</p>
+ <p className="text-sm text-scale-1000">Checking project's tier</p>
</div>
+ ) : (
+ <></>
)}
</div>
+ {selectedProject?.subscription_tier === PRICING_TIER_PRODUCT_IDS.FREE && (
+ <div className="px-6">
+ <InformationBox
+ hideCollapse
+ defaultVisibility
+ icon={<IconAlertCircle strokeWidth={2} />}
+ title="Expected response times are based on your project's tier"
+ // description="Upgrade to the Pro tier for guaranteed response times, or ask about SLAs available on our enterprise plan"
+ description={
+ <div className="space-y-4 mb-1">
+ <p>
+ Upgrade to the Pro tier for guaranteed response times, or ask about SLAs
+ available on our enterprise plan
+ </p>
+ <div className="flex items-center space-x-2">
+ <Link href={`/project/${values.projectRef}/settings/billing/update`}>
+ <a>
+ <Button>Upgrade project</Button>
+ </a>
+ </Link>
+ <Link href="https://supabase.com/contact/enterprise">
+ <a target="_blank">
+ <Button type="default" icon={<IconExternalLink size={14} />}>
+ Enquire about Enterprise
+ </Button>
+ </a>
+ </Link>
+ </div>
+ </div>
+ }
+ />
+ </div>
+ )}
+
<Divider light />
{values.category === 'Problem' && (
@@ -301,7 +342,7 @@ const SupportForm: FC<Props> = ({ setSentCategory }) => {
<div className="text-area-text-sm px-6">
<Input.TextArea
- id="body"
+ id="message"
label="Message"
placeholder="Describe the issue you're facing, along with any relevant information. Please be as detailed and specific as possible."
limit={500}
diff --git a/studio/hooks/index.ts b/studio/hooks/index.ts
index 22e133f6a13..dba32d424fa 100644
--- a/studio/hooks/index.ts
+++ b/studio/hooks/index.ts
@@ -2,6 +2,7 @@ export * from './misc/useStore'
export * from './misc/withAuth'
export * from './misc/useOptimisticSqlSnippetCreate'
export * from './misc/useNotifications'
+export * from './misc/usePlatformStatus'
export * from './deprecated'
export * from './queries'
export * from './ui'
diff --git a/studio/hooks/misc/usePlatformStatus.tsx b/studio/hooks/misc/usePlatformStatus.tsx
new file mode 100644
index 00000000000..1fac085769d
--- /dev/null
+++ b/studio/hooks/misc/usePlatformStatus.tsx
@@ -0,0 +1,17 @@
+import useSWR from 'swr'
+import { get } from 'lib/common/fetch'
+import { API_URL } from 'lib/constants'
+
+export const usePlatformStatus = () => {
+ const { data, error, mutate } = useSWR<{ is_healthy: boolean }>(`${API_URL}/status`, get)
+
+ const anyError = (data as any)?.error || error !== undefined
+ const refresh = () => mutate()
+
+ return {
+ isHealthy: anyError ? undefined : data?.is_healthy,
+ isLoading: !anyError && !data,
+ isError: !!anyError,
+ refresh,
+ }
+}
diff --git a/studio/pages/support/new.tsx b/studio/pages/support/new.tsx
index e36d1972cb8..424e7e991ca 100644
--- a/studio/pages/support/new.tsx
+++ b/studio/pages/support/new.tsx
@@ -2,9 +2,10 @@ import SVG from 'react-inlinesvg'
import Link from 'next/link'
import { useState } from 'react'
import { observer } from 'mobx-react-lite'
-import { Button, IconActivity } from 'ui'
+import { Button, IconLoader } from 'ui'
+import * as Tooltip from '@radix-ui/react-tooltip'
-import { withAuth, useFlag } from 'hooks'
+import { withAuth, useFlag, usePlatformStatus } from 'hooks'
import Success from 'components/interfaces/Support/Success'
import SupportForm from 'components/interfaces/Support/SupportForm'
@@ -14,6 +15,8 @@ const SupportPage = () => {
const ongoingIncident = useFlag('ongoingIncident')
const maxHeight = ongoingIncident ? 'calc(100vh - 44px)' : '100vh'
+ const { isHealthy, isLoading } = usePlatformStatus()
+
return (
<div
className="relative flex overflow-y-auto overflow-x-hidden"
@@ -27,13 +30,43 @@ const SupportPage = () => {
<h4 className="m-0 text-lg">Supabase support</h4>
</div>
<div className="flex items-center space-x-3">
- <Link href="https://status.supabase.com/">
- <a target="_blank">
- <Button type="default" icon={<IconActivity />}>
- Supabase Status
- </Button>
- </a>
- </Link>
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Trigger>
+ <Link href="https://status.supabase.com/">
+ <a target="_blank">
+ <Button
+ type="default"
+ icon={
+ isLoading ? (
+ <IconLoader className="animate-spin" />
+ ) : isHealthy ? (
+ <div className="h-2 w-2 bg-brand-900 rounded-full" />
+ ) : (
+ <div className="h-2 w-2 bg-yellow-900 rounded-full" />
+ )
+ }
+ >
+ {isLoading
+ ? 'Checking status'
+ : isHealthy
+ ? 'All systems operational'
+ : 'Active incident ongoing'}
+ </Button>
+ </a>
+ </Link>
+ </Tooltip.Trigger>
+ <Tooltip.Content side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200',
+ ].join(' ')}
+ >
+ <span className="text-xs text-scale-1200">Check Supabase status page</span>
+ </div>
+ </Tooltip.Content>
+ </Tooltip.Root>
</div>
</div>
<div