Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docs-lint-v2-scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: 301e0d4b35f8f0c8553b4e93917b8b2685ef2627
key: 6b08233ff8bca855f6a38246b2a8049332219188
- name: install linter
if: steps.cache-cargo.outputs.cache-hit != 'true'
run: cargo install --locked --git https://github.com/supabase-community/supa-mdx-lint --rev 301e0d4b35f8f0c8553b4e93917b8b2685ef2627
run: cargo install --locked --git https://github.com/supabase-community/supa-mdx-lint --rev 6b08233ff8bca855f6a38246b2a8049332219188
- name: run linter
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs-lint-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ jobs:
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: 301e0d4b35f8f0c8553b4e93917b8b2685ef2627
key: 6b08233ff8bca855f6a38246b2a8049332219188
- name: install linter
if: steps.filter.outputs.docs == 'true' && steps.cache-cargo.outputs.cache-hit != 'true'
run: cargo install --locked --git https://github.com/supabase-community/supa-mdx-lint --rev 301e0d4b35f8f0c8553b4e93917b8b2685ef2627
run: cargo install --locked --git https://github.com/supabase-community/supa-mdx-lint --rev 6b08233ff8bca855f6a38246b2a8049332219188
- name: install reviewdog
if: steps.filter.outputs.docs == 'true'
uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.0
Expand Down
47 changes: 31 additions & 16 deletions .github/workflows/studio-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ on:
- 'pnpm-lock.yaml'
pull_request:
branches: [master, studio]
paths:
- 'apps/studio/**'
- 'pnpm-lock.yaml'

# Cancel old builds on new commit for same workflow + branch/PR
concurrency:
Expand All @@ -30,49 +27,67 @@ jobs:
strategy:
matrix:
test_number: [1]
outputs:
tests_ran: ${{ steps.filter.outputs.relevant }}

steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
sparse-checkout: |
apps/studio
packages
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
relevant:
- 'apps/studio/**'
- 'pnpm-lock.yaml'
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
if: steps.filter.outputs.relevant == 'true'
name: Install pnpm
with:
run_install: false
- name: Use Node.js
if: steps.filter.outputs.relevant == 'true'
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install deps
if: steps.filter.outputs.relevant == 'true'
run: pnpm install --frozen-lockfile
working-directory: ./
- name: Run Tests
if: steps.filter.outputs.relevant == 'true'
env:
# Default is 2 GB, increase to have less frequent OOM errors
NODE_OPTIONS: '--max_old_space_size=3072'
run: pnpm run test:ci
working-directory: ./apps/studio

- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
- name: Upload coverage artifact
if: steps.filter.outputs.relevant == 'true'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
parallel: true
flag-name: studio-tests
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./apps/studio/coverage/lcov.info
base-path: './apps/studio'
fail-on-error: false
name: studio-coverage
path: ./apps/studio/coverage/lcov.info
retention-days: 1

finish:
coveralls:
needs: test
if: ${{ always() }}
if: ${{ always() && needs.test.result == 'success' && needs.test.outputs.tests_ran == 'true' }}
continue-on-error: true
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Coveralls Finished
- name: Download coverage artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: studio-coverage
path: ./coverage
- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
with:
parallel-finished: true
flag-name: studio-tests
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.info
base-path: './apps/studio'
45 changes: 31 additions & 14 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: UI Tests
on:
pull_request:
branches: [master]
paths:
- 'packages/ui/**'

# Cancel old builds on new commit for same workflow + branch/PR
concurrency:
Expand All @@ -20,47 +18,66 @@ jobs:
strategy:
matrix:
test_number: [1]
outputs:
tests_ran: ${{ steps.filter.outputs.relevant }}

steps:
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
relevant:
- 'packages/ui/**'
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
if: steps.filter.outputs.relevant == 'true'
with:
sparse-checkout: |
packages

- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
if: steps.filter.outputs.relevant == 'true'
name: Install pnpm
with:
run_install: false

- name: Use Node.js
if: steps.filter.outputs.relevant == 'true'
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: '.nvmrc'
cache: 'pnpm'

- name: Install deps
if: steps.filter.outputs.relevant == 'true'
run: pnpm install --frozen-lockfile

- name: Run tests
if: steps.filter.outputs.relevant == 'true'
run: pnpm run test:ci
working-directory: ./packages/ui

- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
- name: Upload coverage artifact
if: steps.filter.outputs.relevant == 'true'
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
parallel: true
flag-name: ui-tests
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./packages/ui/coverage/lcov.info
base-path: './packages/ui'
name: ui-coverage
path: ./packages/ui/coverage/lcov.info
retention-days: 1

finish:
coveralls:
needs: test
if: ${{ always() }}
if: ${{ always() && needs.test.result == 'success' && needs.test.outputs.tests_ran == 'true' }}
continue-on-error: true
runs-on: blacksmith-4vcpu-ubuntu-2404
steps:
- name: Coveralls Finished
- name: Download coverage artifact
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ui-coverage
path: ./coverage
- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
with:
parallel-finished: true
flag-name: ui-tests
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.info
base-path: './packages/ui'
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"@graphql-codegen/cli": "5.0.5",
"@graphql-codegen/typescript": "4.1.6",
"@graphql-codegen/typescript-resolvers": "4.5.0",
"@supabase/supa-mdx-lint": "0.3.1",
"@supabase/supa-mdx-lint": "0.3.2",
"@testing-library/react": "^16.0.0",
"@types/common-tags": "^1.8.4",
"@types/estree": "1.0.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export const OverviewMetrics = ({ metrics, isLoading, error }: OverviewMetricsPr
<ChartTitle>Auth API Errors</ChartTitle>
</ChartHeader>
<ChartContent
className="p-0"
className="!p-0"
isEmpty={responseErrors.length === 0}
emptyState={
<div className="p-6">
Expand Down Expand Up @@ -372,7 +372,7 @@ export const OverviewMetrics = ({ metrics, isLoading, error }: OverviewMetricsPr
<ChartActions actions={errorCodesActions} />
</ChartHeader>
<ChartContent
className="p-0"
className="!p-0"
isEmpty={errorCodes.length === 0}
emptyState={
<div className="p-6">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { Search } from 'lucide-react'
import { useState } from 'react'

import { SupportCategories } from '@supabase/shared-types/out/constants'
import { SupportLink } from 'components/interfaces/Support/SupportLink'
import CodeEditor from 'components/ui/CodeEditor/CodeEditor'
Expand All @@ -9,6 +6,8 @@ import { DatabaseMigration, useMigrationsQuery } from 'data/database/migrations-
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { DOCS_URL } from 'lib/constants'
import { parseMigrationVersion } from 'lib/migration-utils'
import { Search } from 'lucide-react'
import { useState } from 'react'
import {
Button,
Card,
Expand All @@ -24,9 +23,10 @@ import {
TooltipContent,
TooltipTrigger,
} from 'ui'
import { Admonition } from 'ui-patterns'
import { Admonition, TimestampInfo } from 'ui-patterns'
import { Input } from 'ui-patterns/DataInputs/Input'
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'

import { MigrationsEmptyState } from './MigrationsEmptyState'

const Migrations = () => {
Expand Down Expand Up @@ -119,9 +119,10 @@ const Migrations = () => {
{migrations.length > 0 ? (
migrations.map((migration) => {
const versionDayjs = parseMigrationVersion(migration.version)
const insertedAt = versionDayjs
const label = versionDayjs
? versionDayjs.format('DD MMM YYYY, HH:mm:ss')
: undefined
: 'Unknown'
const insertedAt = versionDayjs ? versionDayjs.toISOString() : undefined

return (
<TableRow key={migration.version}>
Expand All @@ -133,9 +134,19 @@ const Migrations = () => {
>
{migration?.name ?? 'Name not available'}
</TableCell>
<TableCell className={cn(!insertedAt && 'text-foreground-lighter')}>
<TableCell>
<Tooltip>
<TooltipTrigger>{insertedAt ?? 'Unknown'}</TooltipTrigger>
<TooltipTrigger>
{!!insertedAt ? (
<TimestampInfo
className="text-sm"
label={label}
utcTimestamp={insertedAt}
/>
) : (
<p className="text-foreground-lighter">Unknown</p>
)}
</TooltipTrigger>
{!insertedAt && (
<TooltipContent side="right" className="w-64 text-center">
This migration was not generated via the{' '}
Expand Down
33 changes: 8 additions & 25 deletions apps/studio/components/interfaces/HomeNew/ActivityStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import { useBackupsQuery } from 'data/database/backups-query'
import { DatabaseMigration, useMigrationsQuery } from 'data/database/migrations-query'
import dayjs from 'dayjs'
import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { parseMigrationVersion } from 'lib/migration-utils'
import { Archive, Database, GitBranch } from 'lucide-react'
import { useMemo } from 'react'
import { cn, Skeleton } from 'ui'
import { TimestampInfo } from 'ui-patterns'

import { ServiceStatus } from './ServiceStatus'
import { EMPTY_ARR } from '@/lib/void'

export const ActivityStats = () => {
const { ref } = useParams()
Expand All @@ -37,14 +37,16 @@ export const ActivityStats = () => {
)[0]
}, [branchesData])

const { data: migrationsData, isPending: isLoadingMigrations } = useMigrationsQuery({
const { data: migrationsData = EMPTY_ARR, isPending: isLoadingMigrations } = useMigrationsQuery({
projectRef: project?.ref,
connectionString: project?.connectionString,
})
const latestMigration = useMemo<DatabaseMigration | undefined>(
() => (migrationsData ?? [])[0],
() => migrationsData[0],
[migrationsData]
)
const migrationLabelText =
migrationsData.length === 0 ? 'No migrations' : latestMigration?.name ?? 'Unknown'

const { data: backupsData, isPending: isLoadingBackups } = useBackupsQuery({
projectRef: project?.ref,
Expand All @@ -57,21 +59,6 @@ export const ActivityStats = () => {
.sort((a, b) => new Date(b.inserted_at).valueOf() - new Date(a.inserted_at).valueOf())[0]
}, [backupsData])

const [versionLabel, versionTimestamp] = useMemo(() => {
const version = latestMigration?.version

const versionDayjs = parseMigrationVersion(version)
if (versionDayjs) {
return [versionDayjs.fromNow(), versionDayjs.toISOString()]
}

return [undefined, undefined]
}, [latestMigration])

const hasValidVersion = versionLabel && versionTimestamp

const versionLabelText = migrationsData && migrationsData.length > 0 ? 'Unknown' : 'No migrations'

return (
<div className="@container">
<div className="grid grid-cols-1 @md:grid-cols-2 gap-2 @md:gap-6 flex-wrap">
Expand All @@ -88,14 +75,10 @@ export const ActivityStats = () => {
value={
isLoadingMigrations ? (
<Skeleton className="h-6 w-24" />
) : hasValidVersion ? (
<TimestampInfo
className="text-base"
label={versionLabel}
utcTimestamp={versionTimestamp}
/>
) : (
<p className="text-foreground-lighter">{versionLabelText}</p>
<p className={!!latestMigration ? 'text-foreground' : 'text-foreground-lighter'}>
{migrationLabelText}
</p>
)
}
/>
Expand Down
Loading
Loading