Skip to content

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

Adjust behaviour of alert error support (#30966)

Joshen Lim9046a7ab180f
diff --git a/apps/studio/components/interfaces/Support/SupportForm.utils.tsx b/apps/studio/components/interfaces/Support/SupportForm.utils.tsx
index c0e6c49b22b..08737d01312 100644
--- a/apps/studio/components/interfaces/Support/SupportForm.utils.tsx
+++ b/apps/studio/components/interfaces/Support/SupportForm.utils.tsx
@@ -56,12 +56,13 @@ export const uploadAttachments = async (ref: string, files: File[]) => {
return data ? data.map((file) => file.signedUrl) : []
}
-export const formatMessage = (message: string, attachments: string[]) => {
+export const formatMessage = (message: string, attachments: string[], error?: string) => {
+ const errorString = error !== undefined ? `\nError: ${error}` : ''
if (attachments.length > 0) {
const attachmentsImg = attachments.map((url) => `\n${url}`)
- return `${message}\n${attachmentsImg.join('')}`
+ return `${message}\n${attachmentsImg.join('')}${errorString}`
} else {
- return message
+ return `${message}${errorString}`
}
}
diff --git a/apps/studio/components/interfaces/Support/SupportFormV2.tsx b/apps/studio/components/interfaces/Support/SupportFormV2.tsx
index 368b614b8e1..26de59605a7 100644
--- a/apps/studio/components/interfaces/Support/SupportFormV2.tsx
+++ b/apps/studio/components/interfaces/Support/SupportFormV2.tsx
@@ -53,6 +53,7 @@ import {
SEVERITY_OPTIONS,
} from './Support.constants'
import { formatMessage, uploadAttachments } from './SupportForm.utils'
+import { Admonition } from 'ui-patterns'
const MAX_ATTACHMENTS = 5
const INCLUDE_DISCUSSIONS = ['Problem', 'Database_unresponsive']
@@ -68,7 +69,14 @@ interface SupportFormV2Props {
export const SupportFormV2 = ({ setSentCategory, setSelectedProject }: SupportFormV2Props) => {
const { profile } = useProfile()
const supabaseClient = useSupabaseClient()
- const { ref, slug, category: urlCategory, subject: urlSubject, message: urlMessage } = useParams()
+ const {
+ ref,
+ slug,
+ category: urlCategory,
+ subject: urlSubject,
+ message: urlMessage,
+ error,
+ } = useParams()
const uploadButtonRef = useRef(null)
const [isSubmitting, setIsSubmitting] = useState(false)
@@ -203,7 +211,7 @@ export const SupportFormV2 = ({ setSentCategory, setSelectedProject }: SupportFo
organizationSlug: values.organizationSlug === 'no-org' ? undefined : values.organizationSlug,
library:
values.category === 'Problem' && selectedLibrary !== undefined ? selectedLibrary.key : '',
- message: formatMessage(values.message, attachments),
+ message: formatMessage(values.message, attachments, error),
verified: true,
tags: ['dashboard-support-form'],
siteUrl: '',
@@ -621,6 +629,15 @@ export const SupportFormV2 = ({ setSentCategory, setSelectedProject }: SupportFo
placeholder="Describe the issue you're facing, along with any relevant information. Please be as detailed and specific as possible."
/>
</FormControl_Shadcn_>
+ {error !== undefined && (
+ <Admonition
+ showIcon={false}
+ type="default"
+ className="mt-2"
+ title="The error that you ran into will be included in your message for reference"
+ description={`Error: ${error}`}
+ />
+ )}
</FormItemLayout>
)}
/>
diff --git a/apps/studio/components/ui/AlertError.tsx b/apps/studio/components/ui/AlertError.tsx
index 95bd6bc6fcf..95abda1deb3 100644
--- a/apps/studio/components/ui/AlertError.tsx
+++ b/apps/studio/components/ui/AlertError.tsx
@@ -26,7 +26,7 @@ const AlertError = ({
if (projectRef) href += `&ref=${projectRef}`
if (subjectString) href += `&subject=${subjectString}`
- if (error) href += `&message=Error:%20${error.message}`
+ if (error) href += `&error=${error.message}`
const formattedErrorMessage = error?.message?.includes('503')
? '503 Service Temporarily Unavailable'