The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Midway oauth apps crud
Joshen Lima656f767054b
diff --git a/studio/components/interfaces/App/CommandMenuWrapper.tsx b/studio/components/interfaces/App/CommandMenuWrapper.tsxindex c45cae8447f..1dc441e77c3 100644--- a/studio/components/interfaces/App/CommandMenuWrapper.tsx+++ b/studio/components/interfaces/App/CommandMenuWrapper.tsx@@ -1,20 +1,18 @@-import remarkGfm from 'remark-gfm'-import ReactMarkdown from 'react-markdown'-import { PropsWithChildren, useMemo } from 'react'+import { PermissionAction } from '@supabase/shared-types/out/constants'import { useParams } from 'common'-import { CommandMenuProvider, markdownComponents } from 'ui'import { observer } from 'mobx-react-lite'-import { PermissionAction } from '@supabase/shared-types/out/constants'+import { PropsWithChildren, useMemo } from 'react'+import { CommandMenuProvider } from 'ui'-import { uuidv4 } from 'lib/helpers'-import { checkPermissions, useFlag, useStore } from 'hooks'-import { createSqlSnippetSkeleton } from '../SQLEditor/SQLEditor.utils'-import { useSqlEditorStateSnapshot } from 'state/sql-editor'import { codeBlock } from 'common-tags'-import { SqlSnippet } from 'data/content/sql-snippets-query'import { useProjectApiQuery } from 'data/config/project-api-query'+import { SqlSnippet } from 'data/content/sql-snippets-query'import { useEntityDefinitionsQuery } from 'data/database/entity-definitions-query'import { useProfileQuery } from 'data/profile/profile-query'+import { checkPermissions, useFlag, useStore } from 'hooks'+import { uuidv4 } from 'lib/helpers'+import { useSqlEditorStateSnapshot } from 'state/sql-editor'+import { createSqlSnippetSkeleton } from '../SQLEditor/SQLEditor.utils'const CommandMenuWrapper = observer(({ children }: PropsWithChildren<{}>) => {const { ref } = useParams()diff --git a/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx b/studio/components/interfaces/Database/Hooks/EditHookPanel.tsxindex 4525d36feeb..eaf98d64956 100644--- a/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx+++ b/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx@@ -5,9 +5,8 @@ import { Button, SidePanel, Form, Input, Listbox, Checkbox, Radio, Badge, Modalimport { useStore } from 'hooks'import { useParams } from 'common/hooks'-import { tryParseJson, uuidv4 } from 'lib/helpers'+import { tryParseJson, uuidv4, isValidHttpUrl } from 'lib/helpers'import HTTPRequestFields from './HTTPRequestFields'-import { isValidHttpUrl } from './Hooks.utils'import { AVAILABLE_WEBHOOK_TYPES, HOOK_EVENTS } from './Hooks.constants'import ConfirmationModal from 'components/ui/ConfirmationModal'import { FormSection, FormSectionLabel, FormSectionContent } from 'components/ui/Forms'diff --git a/studio/components/interfaces/Database/Hooks/Hooks.utils.ts b/studio/components/interfaces/Database/Hooks/Hooks.utils.tsindex 75f0d78c39a..43e8a40c57d 100644--- a/studio/components/interfaces/Database/Hooks/Hooks.utils.ts+++ b/studio/components/interfaces/Database/Hooks/Hooks.utils.ts@@ -28,13 +28,3 @@ export const convertKeyValue = (value: string) => {export const hasWhitespace = (value: string) => {return /\s/.test(value)}--export const isValidHttpUrl = (value: string) => {- let url: URL- try {- url = new URL(value)- } catch (_) {- return false- }- return url.protocol === 'http:' || url.protocol === 'https:'-}diff --git a/studio/components/interfaces/Organization/OAuthApps/DeleteAppModal.tsx b/studio/components/interfaces/Organization/OAuthApps/DeleteAppModal.tsxnew file mode 100644index 00000000000..47b86307c06--- /dev/null+++ b/studio/components/interfaces/Organization/OAuthApps/DeleteAppModal.tsx@@ -0,0 +1,5 @@+const DeleteAppModal = () => {+ return <div></div>+}++export default DeleteAppModaldiff --git a/studio/components/interfaces/Organization/OAuthApps/OAuthApps.tsx b/studio/components/interfaces/Organization/OAuthApps/OAuthApps.tsxnew file mode 100644index 00000000000..1006b4e7f42--- /dev/null+++ b/studio/components/interfaces/Organization/OAuthApps/OAuthApps.tsx@@ -0,0 +1,121 @@+import { useParams } from 'common'+import Table from 'components/to-be-cleaned/Table'+import { useOAuthAppsQuery } from 'data/oauth/oauth-apps-query'+import { useState } from 'react'+import { Button, Form, IconEdit, IconTrash, IconTrash2, Input, Modal } from 'ui'+import PublishAppModal from './PublishAppModal'++// [Joshen] Just FYI need to relook at the copy writing at the end+// - Loading state+// - Error state++const OAuthApps = () => {+ const { slug } = useParams()+ const [showPublishModal, setShowPublishModal] = useState(false)+ const [selectedAppToUpdate, setSelectedAppToUpdate] = useState()+ const [selectedAppToDelete, setSelectedAppToDelete] = useState()++ const { data: publishedApps, isLoading: isLoadingPublishedApps } = useOAuthAppsQuery({+ slug,+ type: 'published',+ })++ console.log({ publishedApps })++ return (+ <>+ <div className="container my-4 max-w-4xl space-y-8">+ <div>+ <p>Published Apps</p>+ <p className="text-scale-1000 text-sm">+ Build on top of the Supabase platform by using OAuth to gain access to your+ organization's settings and projects+ </p>++ <div className="mt-4">+ {(publishedApps?.length ?? 0) === 0 ? (+ <div className="bg-scale-100 dark:bg-scale-300 border rounded p-4 flex items-center justify-between">+ <p className="prose text-sm">You do not have any published applications yet</p>+ <Button type="primary" onClick={() => setShowPublishModal(true)}>+ Publish a new application+ </Button>+ </div>+ ) : (+ <Table+ className="mt-4"+ head={[+ <Table.th key="name">Name</Table.th>,+ <Table.th key="client-id">Client ID</Table.th>,+ <Table.th key="client-secret">Client Secret</Table.th>,+ <Table.th key="delete-action"></Table.th>,+ ]}+ body={+ publishedApps?.map((app) => (+ <Table.tr key={app.id}>+ <Table.td>{app.name}</Table.td>+ <Table.td>{app.client_id}</Table.td>+ <Table.td>{app.client_secret_alias}</Table.td>+ <Table.td align="right">+ <div className="space-x-2">+ <Button+ type="default"+ title="Delete app"+ icon={<IconEdit />}+ className="px-1"+ />+ <Button+ type="default"+ title="Delete app"+ icon={<IconTrash />}+ className="px-1"+ />+ </div>+ </Table.td>+ </Table.tr>+ )) ?? []+ }+ />+ )}+ </div>+ </div>++ {/* <div>+ <p>Authorized Apps</p>+ <p className="text-scale-1000 text-sm">+ Applications that have access to your organization's settings and projects+ </p>++ <div className="mt-4">+ {(authorizedApps?.length ?? 0) === 0 ? (+ <div className="bg-scale-100 dark:bg-scale-300 border rounded p-4 flex items-center justify-between">+ <p className="prose text-sm">You do not have any authorized applications yet</p>+ </div>+ ) : (+ <Table+ className="mt-4"+ head={[+ <Table.th key="name">Name</Table.th>,+ <Table.th key="clientId">Client ID</Table.th>,+ <Table.th key="clientSecret">Client Secret</Table.th>,+ ]}+ body={+ publishedApps?.map((app) => (+ <Table.tr key={app.id}>+ <Table.td>{app.name}</Table.td>+ <Table.td>{app.name}</Table.td>+ <Table.td>{app.name}</Table.td>+ </Table.tr>+ )) ?? []+ }+ />+ )}+ </div>+ </div> */}+ </div>++ <PublishAppModal visible={showPublishModal} onClose={() => setShowPublishModal(false)} />+ </>+ )+}++export default OAuthAppsdiff --git a/studio/components/interfaces/Organization/OAuthApps/PublishAppModal.tsx b/studio/components/interfaces/Organization/OAuthApps/PublishAppModal.tsxnew file mode 100644index 00000000000..ae87ab31265--- /dev/null+++ b/studio/components/interfaces/Organization/OAuthApps/PublishAppModal.tsx@@ -0,0 +1,172 @@+import { useEffect, useState } from 'react'++import { useOAuthAppCreateMutation } from 'data/oauth/oauth-app-create-mutation'+import { isValidHttpUrl, uuidv4 } from 'lib/helpers'+import { Button, Form, IconUpload, Input, Modal } from 'ui'+import clsx from 'clsx'+import { useStore } from 'hooks'+import { useParams } from 'common'++// [Joshen TODO] Support uploading of icon++export interface PublishAppModalProps {+ visible: boolean+ onClose: () => void+}++const PublishAppModal = ({ visible, onClose }: PublishAppModalProps) => {+ const { ui } = useStore()+ const { slug } = useParams()+ const { mutateAsync: createOAuthApp } = useOAuthAppCreateMutation()+ const [errors, setErrors] = useState<{ [key: string]: string }>({})+ const [urls, setUrls] = useState<{ id: string; value: string }[]>([{ id: uuidv4(), value: '' }])++ useEffect(() => {+ if (visible) {+ // Reset field+ setUrls([{ id: uuidv4(), value: '' }])+ setErrors({})+ }+ }, [visible])++ const onUpdateUrl = (id: string, value: string) => {+ const updatedUrls = urls.map((url) => {+ if (url.id === id) return { id, value }+ else return url+ })+ setUrls(updatedUrls)+ setErrors({})+ }++ const removeUrl = (id: string) => {+ const updatedUrls = urls.filter((url) => url.id !== id)+ setUrls(updatedUrls)+ }++ const validate = (values: any) => {+ const errors: any = {}+ if (!values.name) errors.name = 'Please provide a name for your application'+ if (!values.website) errors.website = 'Please provide a URL for your site'+ if (!isValidHttpUrl(values.website)) errors.website = 'Please provide a valid URL for your site'+ return errors+ }++ const onSubmit = async (values: any, { setSubmitting }: any) => {+ if (!slug) return console.error('Slug is required')++ const redirect_uris = urls.filter((url) => url.value.length > 0).map((url) => url.value)+ if (redirect_uris.length === 0) {+ setSubmitting(false)+ setErrors({ urls: 'Please provide at least one URL' })+ return+ } else {+ setErrors({})+ }++ try {+ const { name, website } = values+ const res = await createOAuthApp({ slug, name, website, redirect_uris })+ console.log({ res })+ ui.setNotification({+ category: 'success',+ message: `Successfully created OAuth app "${name}"!`,+ })+ onClose()+ } catch (error: any) {+ setSubmitting(false)+ ui.setNotification({+ category: 'error',+ message: `Failed to create OAuth app: ${error.message}`,+ })+ }+ }++ return (+ <Modal+ hideFooter+ visible={visible}+ header="Publish a new OAuth application"+ onCancel={() => onClose()}+ >+ <Form+ validateOnBlur+ initialValues={{ name: '', website: '' }}+ validate={validate}+ onSubmit={onSubmit}+ >+ {({ isSubmitting }: { isSubmitting: boolean }) => (+ <div>+ <Modal.Content>+ <div className="py-4 flex items-start justify-between gap-10">+ <div className="space-y-4 w-full">+ <Input id="name" label="Application name"></Input>+ <Input+ id="website"+ label="Website URL"+ placeholder="https://my-website.com"+ ></Input>+ </div>+ <div>+ <div+ className={clsx(+ 'border border-scale-700 transition opacity-75 hover:opacity-100',+ 'mt-4 mr-4 space-y-2 rounded-full h-[120px] w-[120px] flex flex-col items-center justify-center cursor-pointer'+ )}+ >+ <IconUpload size={18} strokeWidth={1.5} className="text-scale-1200" />+ <p className="text-xs text-scale-1100">Upload logo</p>+ </div>+ </div>+ </div>+ </Modal.Content>+ <Modal.Separator />+ <Modal.Content>+ <div className="mb-2 flex items-center justify-between">+ <div>+ <p className="prose text-sm">Allowed URLs</p>+ <p className="text-sm text-scale-1000">+ All URLs must use HTTPS, except for localhost+ </p>+ </div>+ <Button onClick={() => setUrls(urls.concat({ id: uuidv4(), value: '' }))}>+ Add URL+ </Button>+ </div>+ <div className="space-y-2 pb-2">+ {urls.map((url) => (+ <Input+ key={url.id}+ value={url.value}+ onChange={(event) => onUpdateUrl(url.id, event.target.value)}+ placeholder="e.g https://my-website.com"+ actions={[+ urls.length > 1 ? (+ <Button key="remove-url" type="default" onClick={() => removeUrl(url.id)}>+ Remove+ </Button>+ ) : null,+ ]}+ />+ ))}+ {errors.urls && <p className="text-red-900 text-sm">{errors.urls}</p>}+ </div>+ </Modal.Content>+ <Modal.Separator />+ <Modal.Content>+ <div className="pt-2 pb-3 flex items-center space-x-2 justify-end">+ <Button type="default" disabled={isSubmitting} onClick={() => onClose()}>+ Cancel+ </Button>+ <Button htmlType="submit" loading={isSubmitting} disabled={isSubmitting}>+ Confirm+ </Button>+ </div>+ </Modal.Content>+ </div>+ )}+ </Form>+ </Modal>+ )+}++export default PublishAppModaldiff --git a/studio/components/interfaces/Organization/index.ts b/studio/components/interfaces/Organization/index.tsindex beee07cbc43..2c02467f0f9 100644--- a/studio/components/interfaces/Organization/index.ts+++ b/studio/components/interfaces/Organization/index.ts@@ -3,5 +3,6 @@ import TeamSettings from './TeamSettings/TeamSettings'import BillingSettings from './BillingSettings/BillingSettings'import InvoicesSettings from './InvoicesSettings/InvoicesSettings'import NewOrgForm from './NewOrg/NewOrgForm'+import OAuthApps from './OAuthApps/OAuthApps'-export { GeneralSettings, TeamSettings, BillingSettings, InvoicesSettings, NewOrgForm }+export { GeneralSettings, TeamSettings, BillingSettings, InvoicesSettings, NewOrgForm, OAuthApps }diff --git a/studio/components/to-be-cleaned/Table.tsx b/studio/components/to-be-cleaned/Table.tsxindex dc3c37f83ce..85e395dcae4 100644--- a/studio/components/to-be-cleaned/Table.tsx+++ b/studio/components/to-be-cleaned/Table.tsx@@ -79,6 +79,7 @@ type TdProps = {colSpan?: numberclassName?: stringstyle?: React.CSSProperties+ align?: 'right' | 'left' | 'center'} & React.HTMLProps<HTMLTableCellElement>const Td: React.FC<TdProps> = ({ children, colSpan, className, style, ...rest }) => {return (diff --git a/studio/data/oauth/keys.ts b/studio/data/oauth/keys.tsnew file mode 100644index 00000000000..8f37c6edff0--- /dev/null+++ b/studio/data/oauth/keys.ts@@ -0,0 +1,4 @@+export const oauthAppKeys = {+ list: (slug: string | undefined, type: 'published' | 'authorized' | undefined) =>+ ['oauth-apps', slug, type] as const,+}diff --git a/studio/data/oauth/oauth-app-create-mutation.ts b/studio/data/oauth/oauth-app-create-mutation.tsnew file mode 100644index 00000000000..3303c4e51f1--- /dev/null+++ b/studio/data/oauth/oauth-app-create-mutation.ts@@ -0,0 +1,57 @@+import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'+import { post } from 'lib/common/fetch'+import { API_ADMIN_URL } from 'lib/constants'+import { oauthAppKeys } from './keys'++export type OAuthAppCreateVariables = {+ slug: string+ name: string+ website: string+ icon?: string+ redirect_uris: string[]+}++export async function createOAuthApp({+ slug,+ name,+ website,+ icon,+ redirect_uris,+}: OAuthAppCreateVariables) {+ if (!slug) throw new Error('Organization slug is required')+ if (!name) throw new Error('OAuth app name is required')+ if (!website) throw new Error('OAuth app URL is required')++ const response = await post(`${API_ADMIN_URL}/organizations/${slug}/oauth/apps`, {+ name,+ website,+ icon,+ redirect_uris,+ })+ if (response.error) throw response.error+ return response+}++type OAuthAppCreateData = Awaited<ReturnType<typeof createOAuthApp>>++export const useOAuthAppCreateMutation = ({+ onSuccess,+ ...options+}: Omit<+ UseMutationOptions<OAuthAppCreateData, unknown, OAuthAppCreateVariables>,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<OAuthAppCreateData, unknown, OAuthAppCreateVariables>(+ (vars) => createOAuthApp(vars),+ {+ async onSuccess(data, variables, context) {+ const { slug } = variables+ await queryClient.invalidateQueries(oauthAppKeys.list(slug, 'published'))+ await onSuccess?.(data, variables, context)+ },+ ...options,+ }+ )+}diff --git a/studio/data/oauth/oauth-app-delete-mutation.ts b/studio/data/oauth/oauth-app-delete-mutation.tsnew file mode 100644index 00000000000..2446d609546--- /dev/null+++ b/studio/data/oauth/oauth-app-delete-mutation.ts@@ -0,0 +1,42 @@+import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'+import { delete_ } from 'lib/common/fetch'+import { API_ADMIN_URL } from 'lib/constants'+import { oauthAppKeys } from './keys'++export type OAuthAppDeleteVariables = {+ id: string+ slug: string+}++export async function deleteOAuthApp({ id, slug }: OAuthAppDeleteVariables) {+ if (!id) throw new Error('OAuth app ID is required')+ if (!slug) throw new Error('Organization slug is required')++ const response = await delete_(`${API_ADMIN_URL}/organizations/${slug}/oauth/apps`)+ if (response.error) throw response.error+ return response+}++type OAuthAppDeleteData = Awaited<ReturnType<typeof deleteOAuthApp>>++export const useOAuthAppDeleteMutation = ({+ onSuccess,+ ...options+}: Omit<+ UseMutationOptions<OAuthAppDeleteData, unknown, OAuthAppDeleteVariables>,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<OAuthAppDeleteData, unknown, OAuthAppDeleteVariables>(+ (vars) => deleteOAuthApp(vars),+ {+ async onSuccess(data, variables, context) {+ const { slug } = variables+ await queryClient.invalidateQueries(oauthAppKeys.list(slug, 'published'))+ await onSuccess?.(data, variables, context)+ },+ ...options,+ }+ )+}diff --git a/studio/data/oauth/oauth-app-update-mutation.ts b/studio/data/oauth/oauth-app-update-mutation.tsnew file mode 100644index 00000000000..672755cca0c--- /dev/null+++ b/studio/data/oauth/oauth-app-update-mutation.ts@@ -0,0 +1,61 @@+import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query'+import { put } from 'lib/common/fetch'+import { API_ADMIN_URL } from 'lib/constants'+import { oauthAppKeys } from './keys'++export type OAuthAppUpdateVariables = {+ id: string+ slug: string+ name: string+ website: string+ icon?: string+ redirect_uris: string[]+}++export async function updateOAuthApp({+ id,+ slug,+ name,+ website,+ icon,+ redirect_uris,+}: OAuthAppUpdateVariables) {+ if (!id) throw new Error('OAuth app ID is required')+ if (!slug) throw new Error('Organization slug is required')+ if (!name) throw new Error('OAuth app name is required')+ if (!website) throw new Error('OAuth app URL is required')+ if (!redirect_uris || redirect_uris.length === 0) throw new Error('Redirect URIs are required')++ const response = await put(`${API_ADMIN_URL}/organizations/${slug}/oauth/apps/${id}`, {+ name,+ website,+ icon,+ redirect_uris,+ })+ if (response.error) throw response.error+ return response+}++type OAuthAppUpdateData = Awaited<ReturnType<typeof updateOAuthApp>>++export const useOAuthAppUpdateMutation = ({+ onSuccess,+ ...options+}: Omit<+ UseMutationOptions<OAuthAppUpdateData, unknown, OAuthAppUpdateVariables>,+ 'mutationFn'+> = {}) => {+ const queryClient = useQueryClient()++ return useMutation<OAuthAppUpdateData, unknown, OAuthAppUpdateVariables>(+ (vars) => updateOAuthApp(vars),+ {+ async onSuccess(data, variables, context) {+ const { slug } = variables+ await queryClient.invalidateQueries(oauthAppKeys.list(slug, 'published'))+ await onSuccess?.(data, variables, context)+ },+ ...options,+ }+ )+}diff --git a/studio/data/oauth/oauth-apps-query.ts b/studio/data/oauth/oauth-apps-query.tsnew file mode 100644index 00000000000..9b57b598f67--- /dev/null+++ b/studio/data/oauth/oauth-apps-query.ts@@ -0,0 +1,60 @@+import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query'+import { get } from 'lib/common/fetch'+import { API_ADMIN_URL } from 'lib/constants'+import { useCallback } from 'react'+import { oauthAppKeys } from './keys'+import { ResponseError } from 'types'++export type OAuthAppsVariables = {+ slug?: string+ type?: 'published' | 'authorized'+}++export type OAuthApp = {+ id: string+ client_id: string+ client_secret_alias: string+ created_at: string+ name: string+ website: string+ redirect_uris: string+}++export async function getOAuthApps({ slug, type }: OAuthAppsVariables, signal?: AbortSignal) {+ if (!slug) throw new Error('Organization slug is required')+ if (!type) throw new Error('App type is required')++ const response = await get(`${API_ADMIN_URL}/organizations/${slug}/oauth/apps?type=${type}`, {+ signal,+ })+ if (response.error) throw response.error+ return response as OAuthApp[]+}++export type OAuthAppsData = Awaited<ReturnType<typeof getOAuthApps>>+export type OAuthAppsError = ResponseError++export const useOAuthAppsQuery = <TData = OAuthAppsData>(+ { slug, type }: OAuthAppsVariables,+ { enabled = true, ...options }: UseQueryOptions<OAuthAppsData, OAuthAppsError, TData> = {}+) =>+ useQuery<OAuthAppsData, OAuthAppsError, TData>(+ oauthAppKeys.list(slug, type),+ ({ signal }) => getOAuthApps({ slug, type }, signal),+ {+ enabled: enabled && typeof slug !== 'undefined' && typeof type !== 'undefined',+ ...options,+ }+ )++export const useOAuthAppsPrefetch = ({ slug, type }: OAuthAppsVariables) => {+ const client = useQueryClient()++ return useCallback(() => {+ if (slug && type) {+ client.prefetchQuery(oauthAppKeys.list(slug, type), ({ signal }) =>+ getOAuthApps({ slug, type }, signal)+ )+ }+ }, [slug])+}diff --git a/studio/lib/helpers.ts b/studio/lib/helpers.tsindex cc98c0d2b48..b7fe45d9f2f 100644--- a/studio/lib/helpers.ts+++ b/studio/lib/helpers.ts@@ -249,3 +249,13 @@ export const detectOS = () => {return undefined}}++export const isValidHttpUrl = (value: string) => {+ let url: URL+ try {+ url = new URL(value)+ } catch (_) {+ return false+ }+ return url.protocol === 'http:' || url.protocol === 'https:'+}diff --git a/studio/pages/org/[slug]/apps.tsx b/studio/pages/org/[slug]/apps.tsxnew file mode 100644index 00000000000..95b26ceb47e--- /dev/null+++ b/studio/pages/org/[slug]/apps.tsx@@ -0,0 +1,57 @@+import { useRouter } from 'next/router'+import { observer } from 'mobx-react-lite'+import { Tabs } from 'ui'++import { NextPageWithLayout } from 'types'+import { useStore } from 'hooks'+import { useParams } from 'common/hooks'+import Loading from 'components/ui/Loading'+import { OrganizationLayout } from 'components/layouts'+import { OAuthApps } from 'components/interfaces/Organization'++const OrgOAuthApps: NextPageWithLayout = () => {+ const { ui } = useStore()+ const { slug } = useParams()+ const router = useRouter()++ return (+ <>+ {ui.selectedOrganization === undefined && (ui?.permissions ?? []).length === 0 ? (+ <Loading />+ ) : (+ <div className="p-4 pt-0">+ <div className="space-y-3">+ <section className="mt-4">+ <h1 className="text-3xl">+ {ui.selectedOrganization?.name ?? 'Organization'} settings+ </h1>+ </section>+ <nav>+ <Tabs+ size="small"+ type="underlined"+ activeId="apps"+ onChange={(id: any) => {+ if (id !== 'apps') router.push(`/org/${slug}/${id}`)+ }}+ >+ <Tabs.Panel id="general" label="General" />+ <Tabs.Panel id="team" label="Team" />+ <Tabs.Panel id="billing" label="Billing" />+ <Tabs.Panel id="invoices" label="Invoices" />+ <Tabs.Panel id="apps" label="OAuth Apps" />+ </Tabs>+ </nav>+ </div>++ <div className="mb-8">+ <OAuthApps />+ </div>+ </div>+ )}+ </>+ )+}++OrgOAuthApps.getLayout = (page) => <OrganizationLayout>{page}</OrganizationLayout>+export default observer(OrgOAuthApps)diff --git a/studio/pages/org/[slug]/billing.tsx b/studio/pages/org/[slug]/billing.tsxindex 83c44735b40..a589c4511ab 100644--- a/studio/pages/org/[slug]/billing.tsx+++ b/studio/pages/org/[slug]/billing.tsx@@ -39,6 +39,7 @@ const OrgBillingSettings: NextPageWithLayout = () => {<Tabs.Panel id="team" label="Team" /><Tabs.Panel id="billing" label="Billing" /><Tabs.Panel id="invoices" label="Invoices" />+ <Tabs.Panel id="apps" label="OAuth Apps" /></Tabs></nav></div>diff --git a/studio/pages/org/[slug]/general.tsx b/studio/pages/org/[slug]/general.tsxindex f07415ba47e..050f7b28867 100644--- a/studio/pages/org/[slug]/general.tsx+++ b/studio/pages/org/[slug]/general.tsx@@ -39,6 +39,7 @@ const OrgGeneralSettings: NextPageWithLayout = () => {<Tabs.Panel id="team" label="Team" /><Tabs.Panel id="billing" label="Billing" /><Tabs.Panel id="invoices" label="Invoices" />+ <Tabs.Panel id="apps" label="OAuth Apps" /></Tabs></nav></div>diff --git a/studio/pages/org/[slug]/invoices.tsx b/studio/pages/org/[slug]/invoices.tsxindex 5ccf1ebc825..2ba89148616 100644--- a/studio/pages/org/[slug]/invoices.tsx+++ b/studio/pages/org/[slug]/invoices.tsx@@ -39,6 +39,7 @@ const OrgInvoices: NextPageWithLayout = () => {<Tabs.Panel id="team" label="Team" /><Tabs.Panel id="billing" label="Billing" /><Tabs.Panel id="invoices" label="Invoices" />+ <Tabs.Panel id="apps" label="OAuth Apps" /></Tabs></nav></div>diff --git a/studio/pages/org/[slug]/team.tsx b/studio/pages/org/[slug]/team.tsxindex 7f96623cd61..4f623255f64 100644--- a/studio/pages/org/[slug]/team.tsx+++ b/studio/pages/org/[slug]/team.tsx@@ -39,6 +39,7 @@ const OrgTeamSettings: NextPageWithLayout = () => {<Tabs.Panel id="team" label="Team" /><Tabs.Panel id="billing" label="Billing" /><Tabs.Panel id="invoices" label="Invoices" />+ <Tabs.Panel id="apps" label="OAuth Apps" /></Tabs></nav></div>