* fix: update Permission params * fix: upgrade check permission hook to support project level role * fix: usePermissionsLoaded * fix: Permission params can be undefined * Scaffold new access management UI * Add validation * Update roles view * Add tooltip * Add button to apply role to all projects * Update UI to select projects first instead of roles * Merge master update UI * Midway trying to implementation project level perms API * First pass implementating updating project level permissions * Add client side validation for assigning/removing roles * Midway implementing new invites * Integrate most of the project level permissions functionality * fix: filter out org-level permissions before checking * Add relevant UI guards in org level pages for project role POV * Minor refactors * Small refactors * More fixes * Moar refactors * More fixes * More fixes * Refactor update role logic and smack some test cases on it * Fixes * Fix type issue * Fix type * more fixes, refactors, adding checks... * MORE fixes * Add perms checking for replicas * Add ButtonTooltip component and use them to prevent repetition of pointer events auto for buttons with tooltips * Convert all buttons with tooltips to use ButtonTooltip * refactor * PRettier * Small fix * Remove commented out code in organization-invitation-accept-mutation * fix: switch to use the platform oauth authorizations routes * Add perms checking for org audit logs and org oauth apps * PRettier * Fix incorrect URL for oauth app flow * Fix incorrect URL for oauth app flow * Fix * Add perms checking for warehouse related UI * Update roles helper icon * remove unused lib * Update package lock... again * Update package lock... again * Smalllll update * Update some checks * Add gate for project level permissions * Last fix * update codegen * Update warehouse endpoint routes * Fix --------- Co-authored-by: phamhieu <phamhieu1998@gmail.com> Co-authored-by: Alaister Young <a@alaisteryoung.com>
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
import Link from 'next/link'
|
|
|
|
import type { ResponseError } from 'types'
|
|
import { AlertDescription_Shadcn_, AlertTitle_Shadcn_, Alert_Shadcn_, Button } from 'ui'
|
|
import { WarningIcon } from 'ui-patterns/Icons/StatusIcons'
|
|
|
|
export interface AlertErrorProps {
|
|
projectRef?: string
|
|
subject?: string
|
|
error?: ResponseError | null
|
|
className?: string
|
|
}
|
|
|
|
// [Joshen] To standardize the language for all error UIs
|
|
|
|
const AlertError = ({ projectRef, subject, error, className }: AlertErrorProps) => {
|
|
const subjectString = subject?.replace(/ /g, '%20')
|
|
let href = `/support/new?category=dashboard_bug`
|
|
|
|
if (projectRef) href += `&ref=${projectRef}`
|
|
if (subjectString) href += `&subject=${subjectString}`
|
|
if (error) href += `&message=Error:%20${error.message}`
|
|
|
|
const formattedErrorMessage = error?.message?.includes('503')
|
|
? '503 Service Temporarily Unavailable'
|
|
: error?.message
|
|
|
|
return (
|
|
<Alert_Shadcn_ className={className} variant="warning" title={subject}>
|
|
<WarningIcon className="h-4 w-4" strokeWidth={2} />
|
|
<AlertTitle_Shadcn_>{subject}</AlertTitle_Shadcn_>
|
|
<AlertDescription_Shadcn_ className="flex flex-col gap-3 break-words">
|
|
<div>
|
|
{error?.message && <p className="text-left">Error: {formattedErrorMessage}</p>}
|
|
<p className="text-left">
|
|
Try refreshing your browser, but if the issue persists, please reach out to us via
|
|
support.
|
|
</p>
|
|
</div>
|
|
<div>
|
|
<Button asChild type="warning">
|
|
<Link href={href}>Contact support</Link>
|
|
</Button>
|
|
</div>
|
|
</AlertDescription_Shadcn_>
|
|
</Alert_Shadcn_>
|
|
)
|
|
}
|
|
|
|
export default AlertError
|