From 42e91cc5d52caeb5acbdf9013bc7c7aad4991cde Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Tue, 19 Sep 2023 17:05:58 +0800 Subject: [PATCH] Link edge functions secrets from edge functions page --- .../EdgeFunctionSecrets.tsx | 14 ++- studio/components/layouts/FunctionsLayout.tsx | 37 ++---- .../pages/project/[ref]/functions/index.tsx | 108 ++++++++++++------ 3 files changed, 90 insertions(+), 69 deletions(-) diff --git a/studio/components/interfaces/Functions/EdgeFunctionSecrets/EdgeFunctionSecrets.tsx b/studio/components/interfaces/Functions/EdgeFunctionSecrets/EdgeFunctionSecrets.tsx index 42b04c840fc..c2d9dfc012d 100644 --- a/studio/components/interfaces/Functions/EdgeFunctionSecrets/EdgeFunctionSecrets.tsx +++ b/studio/components/interfaces/Functions/EdgeFunctionSecrets/EdgeFunctionSecrets.tsx @@ -1,6 +1,7 @@ import { useParams } from 'common' +import Link from 'next/link' import { useState } from 'react' -import { Button, IconSearch, Input, Modal } from 'ui' +import { Button, IconExternalLink, IconSearch, Input, Modal } from 'ui' import Table from 'components/to-be-cleaned/Table' import AlertError from 'components/ui/AlertError' @@ -63,7 +64,16 @@ const EdgeFunctionSecrets = () => { onChange={(e: any) => setSearchString(e.target.value)} icon={} /> - +
+ + + + + + +
) => { const { functionSlug, ref } = useParams() - const [showTerminalInstructions, setShowTerminalInstructions] = useState(false) const { data: functions, isLoading } = useEdgeFunctionsQuery({ projectRef: ref }) const { data: selectedFunction } = useEdgeFunctionQuery({ projectRef: ref, slug: functionSlug }) @@ -109,17 +107,16 @@ const FunctionsLayout = ({ title, children }: PropsWithChildren
- + + + + +
)} - - setShowTerminalInstructions(false)} - header={

Deploying an edge function to your project

} - customFooter={ -
- -
- } - > -
- -
-
) } diff --git a/studio/pages/project/[ref]/functions/index.tsx b/studio/pages/project/[ref]/functions/index.tsx index 5f0e6b87fba..4b180f754a6 100644 --- a/studio/pages/project/[ref]/functions/index.tsx +++ b/studio/pages/project/[ref]/functions/index.tsx @@ -1,7 +1,13 @@ import { useParams } from 'common' import { observer } from 'mobx-react-lite' +import { useState } from 'react' +import { Button, Modal } from 'ui' -import { EdgeFunctionsListItem, FunctionsEmptyState } from 'components/interfaces/Functions' +import { + EdgeFunctionsListItem, + FunctionsEmptyState, + TerminalInstructions, +} from 'components/interfaces/Functions' import FunctionsLayout from 'components/layouts/FunctionsLayout' import Table from 'components/to-be-cleaned/Table' import AlertError from 'components/ui/AlertError' @@ -11,6 +17,8 @@ import { NextPageWithLayout } from 'types' const PageLayout: NextPageWithLayout = () => { const { ref } = useParams() + const [showTerminalInstructions, setShowTerminalInstructions] = useState(false) + const { data: functions, error, @@ -22,44 +30,68 @@ const PageLayout: NextPageWithLayout = () => { const hasFunctions = (functions ?? []).length > 0 return ( -
- {isLoading && } - {isError && } - {isSuccess && ( - <> - {hasFunctions ? ( -
-
- {`${functions.length} function${ - functions.length > 1 ? 's' : '' - } deployed`} + <> +
+ {isLoading && } + + {isError && } + + {isSuccess && ( + <> + {hasFunctions ? ( +
+
+ {`${functions.length} function${ + functions.length > 1 ? 's' : '' + } deployed`} + +
+
+ Name + URL + Created + Last updated + Deployments + + } + body={ + <> + {functions.length > 0 && + functions.map((item) => ( + + ))} + + } + /> -
- Name - URL - Created - Last updated - Deployments - - } - body={ - <> - {functions.length > 0 && - functions.map((item) => ( - - ))} - - } - /> - - ) : ( - - )} - - )} - + ) : ( + + )} + + )} + + setShowTerminalInstructions(false)} + header={

Deploying an edge function to your project

} + customFooter={ +
+ +
+ } + > +
+ +
+
+ ) }