Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: empty page updates

Jonathan Summers-Muircfac5e53787c
diff --git a/studio/pages/project/[ref]/functions/[id]/invocations.tsx b/studio/pages/project/[ref]/functions/[id]/invocations.tsx
index 03d57ea3ee4..e5137b72771 100644
--- a/studio/pages/project/[ref]/functions/[id]/invocations.tsx
+++ b/studio/pages/project/[ref]/functions/[id]/invocations.tsx
@@ -20,7 +20,11 @@ export const LogPage: NextPage = () => {
return (
<FunctionLayout title={title}>
- <LogsPreviewer projectRef={ref as string} queryType={'fn_edge'} />
+ <LogsPreviewer
+ projectRef={ref as string}
+ queryType={'fn_edge'}
+ override={{ key: 'function_id', value: id }}
+ />
</FunctionLayout>
)
}
diff --git a/studio/pages/project/[ref]/functions/index.tsx b/studio/pages/project/[ref]/functions/index.tsx
index ed882f1269a..cbcc605d869 100644
--- a/studio/pages/project/[ref]/functions/index.tsx
+++ b/studio/pages/project/[ref]/functions/index.tsx
@@ -8,6 +8,7 @@ import {
IconExternalLink,
IconGlobe,
IconSearch,
+ IconTerminal,
Input,
Loading,
} from '@supabase/ui'
@@ -23,30 +24,98 @@ import { useProjectFunctionsStore } from 'stores/projectFunctionsStore'
import { toJS } from 'mobx'
const EmptyFunctions = () => {
+ const router = useRouter()
+ const { ref } = router.query
+
+ interface Commands {
+ command: string
+ description: string
+ }
+ const commands: Commands[] = [
+ {
+ command: 'supabase init',
+ description: "Needed if the project hasen't been inited before",
+ },
+ {
+ command: 'supabase login',
+ description: "Writes the user's API token to disk",
+ },
+ {
+ command: `sudo supabase link --ref ${ref}`,
+ description: `Sets the Supabase project to be associated with your project ${ref}`,
+ },
+ {
+ command: 'supabase functions new hello',
+ description: ' creates a function stub at ./functions/hello.ts',
+ },
+ {
+ command: 'supabase functions deploy hello',
+ description: 'Deploys function at ./functions/hello.ts',
+ },
+ ]
return (
<>
- <p className="text-scale-1200 text-base max-w-lg">
- Scalable pay-as-you-go functions as a service (FaaS) to run your code with zero server
- management.
- </p>
- <p className="text-scale-1100 text-sm max-w-lg">
- No servers to provision, manage, or upgrade Automatically scale based on the load Integrated
- monitoring, logging, and debugging capability Built-in security at role and per function
- level based on the principle of least privilege Key networking capabilities for hybrid and
- multi-cloud scenarios
- </p>
- <div className="flex gap-2">
- <Button iconRight={<IconChevronRight />}>Get started</Button>
- <Button type="link" iconRight={<IconExternalLink />}>
- Documentation
- </Button>
- </div>
- <div className="bg-scale-300 rounded px-10 py-8 flex flex-col gap-8">
- <h2 className="text-sm text-scale-1100">Function examples</h2>
- <div className="grid lg:grid-cols-3 gap-8">
- <div className="flex flex-col gap-3">
- <div
- className="
+ <div className="grid grid-cols-2 gap-8 max-w-7xl">
+ <div className="space-y-4">
+ <p className="text-scale-1200 text-base max-w-lg">
+ Scalable pay-as-you-go functions as a service (FaaS) to run your code with zero server
+ management.
+ </p>
+ <p className="text-scale-1100 text-sm max-w-lg">
+ No servers to provision, manage, or upgrade Automatically scale based on the load
+ Integrated monitoring, logging, and debugging capability Built-in security at role and
+ per function level based on the principle of least privilege Key networking capabilities
+ for hybrid and multi-cloud scenarios
+ </p>
+ <div className="flex gap-2">
+ <Button iconRight={<IconChevronRight />}>Get started</Button>
+ <Button type="link" iconRight={<IconExternalLink />}>
+ Documentation
+ </Button>
+ </div>
+ </div>
+ <div
+ className="
+ bg-scale-100 dark:bg-scale-300 px-5 py-4
+ shadow
+ max-w-lg
+ border rounded
+ space-y-8"
+ >
+ <div className="flex items-center gap-3">
+ <div className="border p-2 flex items-center justify-center w-8 h-8 bg-scale-100 rounded">
+ <IconTerminal strokeWidth={2} />
+ </div>
+ <h4>Terminal instructions</h4>
+ </div>
+ <div className="space-y-4">
+ {commands.map((item: Commands) => {
+ return (
+ <>
+ <Input
+ size="small"
+ readOnly
+ value={item.command}
+ copy
+ icon={'$'}
+ descriptionText={item.description}
+ />
+ {/* <p className="text-sm text-scale-900">{item.description}</p> */}
+ </>
+ )
+ })}
+ </div>
+ </div>
+ <div
+ className="
+ col-span-2
+ bg-scale-300 rounded px-10 py-8 flex flex-col gap-8"
+ >
+ <h2 className="text-sm text-scale-1100">Function examples</h2>
+ <div className="grid lg:grid-cols-3 gap-8">
+ <div className="flex flex-col gap-3">
+ <div
+ className="
h-10 w-10
bg-indigo-900
bordershadow-indigo-900
@@ -54,19 +123,19 @@ const EmptyFunctions = () => {
text-scale-fixed-100
flex items-center justify-center
"
- >
- <IconGlobe />
+ >
+ <IconGlobe />
+ </div>
+ <div className="">
+ <h3 className="text-scale-1200">Stripe payments</h3>
+ <p className="text-scale-1100">
+ Charge a payment credit card when a database event occurs
+ </p>
+ </div>
</div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
- </div>
- </div>
- <div className="flex flex-col gap-3">
- <div
- className="
+ <div className="flex flex-col gap-3">
+ <div
+ className="
h-10 w-10
bg-indigo-900
bordershadow-indigo-900
@@ -74,19 +143,19 @@ const EmptyFunctions = () => {
text-scale-fixed-100
flex items-center justify-center
"
- >
- <IconGlobe />
+ >
+ <IconGlobe />
+ </div>
+ <div className="">
+ <h3 className="text-scale-1200">Stripe payments</h3>
+ <p className="text-scale-1100">
+ Charge a payment credit card when a database event occurs
+ </p>
+ </div>
</div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
- </div>
- </div>
- <div className="flex flex-col gap-3">
- <div
- className="
+ <div className="flex flex-col gap-3">
+ <div
+ className="
h-10 w-10
bg-indigo-900
bordershadow-indigo-900
@@ -94,14 +163,15 @@ const EmptyFunctions = () => {
text-scale-fixed-100
flex items-center justify-center
"
- >
- <IconGlobe />
- </div>
- <div className="">
- <h3 className="text-scale-1200">Stripe payments</h3>
- <p className="text-scale-1100">
- Charge a payment credit card when a database event occurs
- </p>
+ >
+ <IconGlobe />
+ </div>
+ <div className="">
+ <h3 className="text-scale-1200">Stripe payments</h3>
+ <p className="text-scale-1100">
+ Charge a payment credit card when a database event occurs
+ </p>
+ </div>
</div>
</div>
</div>
@@ -211,7 +281,7 @@ const PageLayout = () => {
</FunctionsLayout>
)
- if (pageState === 'empty') {
+ if (functions.list().length <= 0) {
return (
<FunctionsLayout>
<EmptyFunctions />
diff --git a/studio/pages/project/[ref]/functions/interfaces/FunctionsLayout.tsx b/studio/pages/project/[ref]/functions/interfaces/FunctionsLayout.tsx
index 0b419a890c6..363157631da 100644
--- a/studio/pages/project/[ref]/functions/interfaces/FunctionsLayout.tsx
+++ b/studio/pages/project/[ref]/functions/interfaces/FunctionsLayout.tsx
@@ -1,12 +1,30 @@
import BaseLayout from 'components/layouts'
import { observer } from 'mobx-react-lite'
import { useStore, withAuth } from 'hooks'
-import { IconCode, IconSlash, Tabs } from '@supabase/ui'
+import { IconCode, IconSlash, Loading, Tabs } from '@supabase/ui'
import { Tab } from '@headlessui/react'
import FunctionsNav from '../interfaces/FunctionsNav'
-import React from 'react'
+import React, { useEffect } from 'react'
+import { useRouter } from 'next/router'
const PageLayout = ({ children }: { children?: React.ReactNode }) => {
+ const { functions, ui } = useStore()
+
+ const router = useRouter()
+ const { id } = router.query
+
+ useEffect(() => {
+ functions.load()
+ }, [ui.selectedProject])
+
+ if (!functions.isInitialized) {
+ return (
+ <BaseLayout>
+ <Loading active={true}>loading</Loading>
+ </BaseLayout>
+ )
+ }
+
return (
<BaseLayout>
<div
diff --git a/studio/styles/react-data-grid-logs.scss b/studio/styles/react-data-grid-logs.scss
index d2c9abae737..a41a2473be7 100644
--- a/studio/styles/react-data-grid-logs.scss
+++ b/studio/styles/react-data-grid-logs.scss
@@ -45,32 +45,23 @@
}
.logs-shimmering-loader {
- animation: logsShimmer 2s infinite linear;
+ animation: shimmer 1.5s infinite linear;
background: linear-gradient(
to right,
- var(--colors-brand3) 4%,
+ var(--colors-scale2) 0%,
var(--colors-brand9) 25%,
- var(--colors-brand3) 36%
+ var(--colors-brand4) 35%,
+ var(--colors-scale2) 45%,
+ var(--colors-scale3) 75%
);
- background-size: 1000px 100%;
-}
-
-.dark .logs-shimmering-loader {
- animation: logsShimmer 2s infinite linear;
- background: linear-gradient(
- to right,
- var(--colors-brand9) 0%,
- var(--colors-brand4) 33%,
- var(--colors-brand9) 100%
- );
- background-size: 1000px 100%;
+ background-size: 3000px 100%;
}
@keyframes logsShimmer {
0% {
background-position: -1000px 0;
}
- 100% {
+ 50% {
background-position: 1000px 0;
}
}