Skip to content

Commit 8f1ed3b

Browse files
authored
Add callouts on suggestions for certain support issues (supabase#38998)
* Add callouts on suggestions for certain support issues * Nit refactor
1 parent 54e7745 commit 8f1ed3b

File tree

4 files changed

+75
-13
lines changed

4 files changed

+75
-13
lines changed

apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureActivity.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const NON_DEDICATED_IO_RESOURCES = [
4747
'ci_2xlarge',
4848
]
4949

50-
const InfrastructureActivity = () => {
50+
export const InfrastructureActivity = () => {
5151
const { ref: projectRef } = useParams()
5252
const { data: project } = useSelectedProjectQuery()
5353
const { data: organization } = useSelectedOrganizationQuery()
@@ -65,7 +65,7 @@ const InfrastructureActivity = () => {
6565
const { data: addons } = useProjectAddonsQuery({ projectRef })
6666
const selectedAddons = addons?.selected_addons ?? []
6767

68-
const { showNewReplicaPanel, setShowNewReplicaPanel } = useShowNewReplicaPanel()
68+
const { setShowNewReplicaPanel } = useShowNewReplicaPanel()
6969

7070
const { computeInstance } = getAddons(selectedAddons)
7171
const hasDedicatedIOResources =
@@ -202,7 +202,7 @@ const InfrastructureActivity = () => {
202202

203203
return (
204204
<>
205-
<ScaffoldContainer>
205+
<ScaffoldContainer id="infrastructure-activity">
206206
<div className="mx-auto flex flex-col gap-10 pt-6">
207207
<div>
208208
<p className="text-xl">Infrastructure Activity</p>
@@ -447,5 +447,3 @@ const InfrastructureActivity = () => {
447447
</>
448448
)
449449
}
450-
451-
export default InfrastructureActivity
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { SupportCategories } from '@supabase/shared-types/out/constants'
2+
import { InlineLink } from 'components/ui/InlineLink'
3+
import { Admonition } from 'ui-patterns'
4+
5+
const className = 'col-span-2 mb-0'
6+
7+
export const IssueSuggestion = ({
8+
category,
9+
projectRef,
10+
}: {
11+
category: string
12+
projectRef?: string
13+
}) => {
14+
const baseUrl = `/project/${projectRef === 'no-project' ? '_' : projectRef}`
15+
16+
if (category === SupportCategories.PROBLEM) {
17+
return (
18+
<Admonition
19+
type="default"
20+
className={className}
21+
title="Have you checked your project's logs?"
22+
>
23+
Logs can help you identify errors that you might be running into when using your project's
24+
API or client libraries. View logs for each product{' '}
25+
<InlineLink href={`${baseUrl}/logs/edge-logs`}>here</InlineLink>.
26+
</Admonition>
27+
)
28+
}
29+
30+
if (category === SupportCategories.DATABASE_UNRESPONSIVE) {
31+
return (
32+
<Admonition
33+
type="default"
34+
className={className}
35+
title="Have you checked your project's infrastructure activity?"
36+
>
37+
High memory or low disk IO bandwidth may be slowing down your database. Verify by checking
38+
the infrastructure activity of your project{' '}
39+
<InlineLink href={`${baseUrl}/settings/infrastructure#infrastructure-activity`}>
40+
here
41+
</InlineLink>
42+
.
43+
</Admonition>
44+
)
45+
}
46+
47+
if (category === SupportCategories.PERFORMANCE_ISSUES) {
48+
return (
49+
<Admonition
50+
type="default"
51+
className={className}
52+
title="Have you checked the Query Performance Advisor?"
53+
>
54+
Identify slow running queries and get actionable insights on how to optimize them with the
55+
Query Performance Advisor{' '}
56+
<InlineLink href={`${baseUrl}/settings/infrastructure#infrastructure-activity`}>
57+
here
58+
</InlineLink>
59+
.
60+
</Admonition>
61+
)
62+
}
63+
64+
return null
65+
}

apps/studio/components/interfaces/Support/SupportFormV2.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ import { OrganizationProjectSelector } from 'components/ui/OrganizationProjectSe
2424
import { getProjectAuthConfig } from 'data/auth/auth-config-query'
2525
import { useSendSupportTicketMutation } from 'data/feedback/support-ticket-send'
2626
import { useOrganizationsQuery } from 'data/organizations/organizations-query'
27-
import type { Project } from 'data/projects/project-detail-query'
2827
import { useProjectsQuery } from 'data/projects/projects-query'
2928
import { useSendEventMutation } from 'data/telemetry/send-event-mutation'
3029
import { detectBrowser } from 'lib/helpers'
3130
import { useProfile } from 'lib/profile'
31+
import { useRouter } from 'next/router'
3232
import {
3333
Badge,
3434
Button,
@@ -57,6 +57,7 @@ import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
5757
import { MultiSelectV2 } from 'ui-patterns/MultiSelectDeprecated/MultiSelectV2'
5858
import ShimmeringLoader from 'ui-patterns/ShimmeringLoader'
5959
import { IPV4SuggestionAlert } from './IPV4SuggestionAlert'
60+
import { IssueSuggestion } from './IssueSuggestions'
6061
import { LibrarySuggestions } from './LibrarySuggestions'
6162
import { PlanExpectationInfoBox } from './PlanExpectationInfoBox'
6263
import {
@@ -66,7 +67,6 @@ import {
6667
SEVERITY_OPTIONS,
6768
} from './Support.constants'
6869
import { formatMessage, uploadAttachments } from './SupportForm.utils'
69-
import { useRouter } from 'next/router'
7070

7171
const MAX_ATTACHMENTS = 5
7272
const INCLUDE_DISCUSSIONS = ['Problem', 'Database_unresponsive']
@@ -158,7 +158,7 @@ export const SupportFormV2 = ({
158158
() => organizations?.find((org) => org.slug === organizationSlug),
159159
[organizationSlug, organizations]
160160
)
161-
const { data, isLoading: isLoadingProjects, isSuccess: isSuccessProjects } = useProjectsQuery()
161+
const { data, isSuccess: isSuccessProjects } = useProjectsQuery()
162162
const allProjects = data?.projects ?? []
163163

164164
const { mutate: sendEvent } = useSendEventMutation()
@@ -189,10 +189,6 @@ export const SupportFormV2 = ({
189189
const respondToEmail = profile?.primary_email ?? 'your email'
190190
const subscriptionPlanId = selectedOrganization?.plan.id
191191

192-
const projects = [
193-
...(allProjects ?? []).filter((project) => project.organization_slug === organizationSlug),
194-
{ ref: 'no-project', name: 'No specific project' } as Partial<Project>,
195-
]
196192
const hasResults =
197193
state.status === 'fullResults' ||
198194
state.status === 'partialResults' ||
@@ -539,6 +535,9 @@ export const SupportFormV2 = ({
539535
</FormItemLayout>
540536
)}
541537
/>
538+
539+
<IssueSuggestion category={category} projectRef={projectRef} />
540+
542541
{(severity === 'Urgent' || severity === 'High') && (
543542
<p className="text-sm text-foreground-light mt-2 sm:col-span-2">
544543
We do our best to respond to everyone as quickly as possible; however, prioritization

apps/studio/pages/project/[ref]/settings/infrastructure.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import InfrastructureActivity from 'components/interfaces/Settings/Infrastructure/InfrastructureActivity'
1+
import { InfrastructureActivity } from 'components/interfaces/Settings/Infrastructure/InfrastructureActivity'
22
import InfrastructureInfo from 'components/interfaces/Settings/Infrastructure/InfrastructureInfo'
33
import DefaultLayout from 'components/layouts/DefaultLayout'
44
import SettingsLayout from 'components/layouts/ProjectSettingsLayout/SettingsLayout'

0 commit comments

Comments
 (0)