mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 18:05:11 +03:00
* Moved sync status admonition to the settings page. * The **Install integration** and **Uninstall integration** buttons now show loading states during installation/uninstallation. * Made the content of the `StripeSyncChangesCard` dynamic based on the installation status. * Fixed a bug in which the comment on the stripe schema was not parsed correctly. Screenshots for each state: **Not installed** <img width="897" height="884" alt="image" src="https://github.com/user-attachments/assets/be567059-1deb-47d1-86df-af9f1c3b4fde" /> **Installing** <img width="897" height="884" alt="image" src="https://github.com/user-attachments/assets/664af71e-9407-4236-b4e5-1e7170a2f31f" /> **Install Error** <img width="897" height="933" alt="image" src="https://github.com/user-attachments/assets/0d6e4fbd-107a-4f95-8a5e-6bd1a1d6a1be" /> **Installed** <img width="897" height="901" alt="image" src="https://github.com/user-attachments/assets/e686e050-b3d2-42d0-bd3c-11d81540433a" /> **Uninstalling** <img width="897" height="901" alt="image" src="https://github.com/user-attachments/assets/7cd90d1c-ff83-4e7d-884e-4e340a1dcc75" /> **Uninstall Error** <img width="897" height="938" alt="image" src="https://github.com/user-attachments/assets/de0c1bc8-11c5-4c3f-a0ca-00b1f9e32ed3" /> **Settings Page (Sync Done)** <img width="897" height="572" alt="image" src="https://github.com/user-attachments/assets/ec5dd2a3-d183-42e1-8953-13bcf70082f5" /> **Settings Page (Sync in Progress)** <img width="897" height="572" alt="image" src="https://github.com/user-attachments/assets/7400c479-3e4f-4490-8857-414a93ebdc51" /> The idea behind these changes is that in future: * We allow users to configure sync interval from the settings page. * The overview page is mainly for the install/uninstall behaviour only, rest everything goes to the settings page. * We can show more granular progress during install/uninstall by showing what is being installed/uninstalled: migrations are running, edge functions are being deployed and so on. * We can show more accurate error messages: migrations succeeded but edge functions could not be deployed. This helps users troubleshoot and in the worst case recover via manual actions. --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
115 lines
2.8 KiB
TypeScript
115 lines
2.8 KiB
TypeScript
import { SupportCategories } from '@supabase/shared-types/out/constants'
|
|
import { SupportLink } from 'components/interfaces/Support/SupportLink'
|
|
import { useTrack } from 'lib/telemetry/track'
|
|
import { PropsWithChildren, useEffect, useRef } from 'react'
|
|
import { Button } from 'ui'
|
|
import { Admonition } from 'ui-patterns/admonition'
|
|
|
|
export interface AlertErrorProps {
|
|
projectRef?: string
|
|
subject?: string
|
|
error?: { message: string } | null
|
|
layout?: 'vertical' | 'horizontal' | 'responsive'
|
|
className?: string
|
|
showIcon?: boolean
|
|
showInstructions?: boolean
|
|
showErrorPrefix?: boolean
|
|
additionalActions?: React.ReactNode
|
|
}
|
|
|
|
export const ContactSupportButton = ({
|
|
projectRef,
|
|
subject,
|
|
error,
|
|
}: {
|
|
projectRef?: string
|
|
subject?: string
|
|
error?: { message: string } | null
|
|
}) => {
|
|
return (
|
|
<Button asChild type="default" className="w-min">
|
|
<SupportLink
|
|
queryParams={{
|
|
category: SupportCategories.DASHBOARD_BUG,
|
|
projectRef,
|
|
subject,
|
|
error: error?.message,
|
|
}}
|
|
>
|
|
Contact support
|
|
</SupportLink>
|
|
</Button>
|
|
)
|
|
}
|
|
|
|
// [Joshen] To standardize the language for all error UIs
|
|
export const AlertError = ({
|
|
projectRef,
|
|
subject,
|
|
error,
|
|
className,
|
|
showIcon = true,
|
|
layout = 'responsive',
|
|
showInstructions = true,
|
|
showErrorPrefix = true,
|
|
children,
|
|
additionalActions,
|
|
}: PropsWithChildren<AlertErrorProps>) => {
|
|
const track = useTrack()
|
|
const hasTrackedRef = useRef(false)
|
|
|
|
const formattedErrorMessage = error?.message?.includes('503')
|
|
? '503 Service Temporarily Unavailable'
|
|
: error?.message
|
|
|
|
useEffect(() => {
|
|
if (!hasTrackedRef.current) {
|
|
hasTrackedRef.current = true
|
|
if (Math.random() < 0.1) {
|
|
track('dashboard_error_created', {
|
|
source: 'admonition',
|
|
})
|
|
}
|
|
}
|
|
}, [track])
|
|
|
|
return (
|
|
<Admonition
|
|
type="warning"
|
|
layout={additionalActions ? 'vertical' : layout}
|
|
showIcon={showIcon}
|
|
title={subject}
|
|
description={
|
|
<>
|
|
{error?.message && (
|
|
<p>
|
|
{showErrorPrefix && 'Error: '}
|
|
{formattedErrorMessage}
|
|
</p>
|
|
)}
|
|
{showInstructions && (
|
|
<p>
|
|
Try refreshing your browser, but if the issue persists for more than a few minutes,
|
|
please reach out to us via support.
|
|
</p>
|
|
)}
|
|
{children}
|
|
</>
|
|
}
|
|
actions={
|
|
additionalActions ? (
|
|
<>
|
|
{additionalActions}
|
|
<ContactSupportButton projectRef={projectRef} subject={subject} error={error} />
|
|
</>
|
|
) : (
|
|
<ContactSupportButton projectRef={projectRef} subject={subject} error={error} />
|
|
)
|
|
}
|
|
className={className}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export default AlertError
|