Skip to content

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

Add empty search results UI to replications

Joshen Lim1da507682de9
diff --git a/studio/components/interfaces/Database/Publications/PublicationsList.tsx b/studio/components/interfaces/Database/Publications/PublicationsList.tsx
index 600e3d36851..e911d25ea05 100644
--- a/studio/components/interfaces/Database/Publications/PublicationsList.tsx
+++ b/studio/components/interfaces/Database/Publications/PublicationsList.tsx
@@ -5,6 +5,7 @@ import { Button, Input, Toggle, IconSearch } from '@supabase/ui'
import { useStore } from 'hooks'
import { confirmAlert } from 'components/to-be-cleaned/ModalsDeprecated/ConfirmModal'
import Table from 'components/to-be-cleaned/Table'
+import NoSearchResults from 'components/to-be-cleaned/NoSearchResults'
interface Props {
onSelectPublication: (id: number) => void
@@ -63,92 +64,96 @@ const PublicationsList: FC<Props> = ({ onSelectPublication = () => {} }) => {
<div className=""></div>
</div>
</div>
- <div className="overflow-hidden rounded">
- <Table
- head={[
- <Table.th key="header.name">Name</Table.th>,
- <Table.th key="header.id" className="hidden lg:table-cell">
- System ID
- </Table.th>,
- <Table.th key="header.insert" className="text-center">
- Insert
- </Table.th>,
- <Table.th key="header.update" className="text-center">
- Update
- </Table.th>,
- <Table.th key="header.delete" className="text-center">
- Delete
- </Table.th>,
- <Table.th key="header.truncate" className="text-center">
- Truncate
- </Table.th>,
- <Table.th key="header.source" className="text-right">
- Source
- </Table.th>,
- ]}
- body={publications.map((x: any, i: number) => (
- <Table.tr className="border-t " key={x.name}>
- <Table.td className="px-4 py-3" style={{ width: '25%' }}>
- {x.name}
- </Table.td>
- <Table.td className="hidden lg:table-cell" style={{ width: '25%' }}>
- {x.id}
- </Table.td>
- <Table.td>
- <div className="flex justify-center">
- <Toggle
- size="tiny"
- checked={x.publish_insert}
- onChange={() => toggleListenEvent(x, 'insert', x.publish_insert)}
- />
- </div>
- </Table.td>
- <Table.td>
- <div className="flex justify-center">
- <Toggle
- size="tiny"
- checked={x.publish_update}
- onChange={() => toggleListenEvent(x, 'update', x.publish_update)}
- />
- </div>
- </Table.td>
- <Table.td>
- <div className="flex justify-center">
- <Toggle
- size="tiny"
- checked={x.publish_delete}
- onChange={() => toggleListenEvent(x, 'delete', x.publish_delete)}
- />
- </div>
- </Table.td>
- <Table.td>
- <div className="flex justify-center">
- <Toggle
- size="tiny"
- checked={x.publish_truncate}
- onChange={() => toggleListenEvent(x, 'truncate', x.publish_truncate)}
- />
- </div>
- </Table.td>
- <Table.td className="px-4 py-3 pr-2">
- <div className="flex justify-end gap-2">
- <Button
- type="default"
- style={{ paddingTop: 3, paddingBottom: 3 }}
- onClick={() => onSelectPublication(x.id)}
- >
- {x.tables == null
- ? 'All tables'
- : `${x.tables.length} ${
- x.tables.length > 1 || x.tables.length == 0 ? 'tables' : 'table'
- }`}
- </Button>
- </div>
- </Table.td>
- </Table.tr>
- ))}
- />
- </div>
+ {publications.length === 0 ? (
+ <NoSearchResults />
+ ) : (
+ <div className="overflow-hidden rounded">
+ <Table
+ head={[
+ <Table.th key="header.name">Name</Table.th>,
+ <Table.th key="header.id" className="hidden lg:table-cell">
+ System ID
+ </Table.th>,
+ <Table.th key="header.insert" className="text-center">
+ Insert
+ </Table.th>,
+ <Table.th key="header.update" className="text-center">
+ Update
+ </Table.th>,
+ <Table.th key="header.delete" className="text-center">
+ Delete
+ </Table.th>,
+ <Table.th key="header.truncate" className="text-center">
+ Truncate
+ </Table.th>,
+ <Table.th key="header.source" className="text-right">
+ Source
+ </Table.th>,
+ ]}
+ body={publications.map((x: any, i: number) => (
+ <Table.tr className="border-t " key={x.name}>
+ <Table.td className="px-4 py-3" style={{ width: '25%' }}>
+ {x.name}
+ </Table.td>
+ <Table.td className="hidden lg:table-cell" style={{ width: '25%' }}>
+ {x.id}
+ </Table.td>
+ <Table.td>
+ <div className="flex justify-center">
+ <Toggle
+ size="tiny"
+ checked={x.publish_insert}
+ onChange={() => toggleListenEvent(x, 'insert', x.publish_insert)}
+ />
+ </div>
+ </Table.td>
+ <Table.td>
+ <div className="flex justify-center">
+ <Toggle
+ size="tiny"
+ checked={x.publish_update}
+ onChange={() => toggleListenEvent(x, 'update', x.publish_update)}
+ />
+ </div>
+ </Table.td>
+ <Table.td>
+ <div className="flex justify-center">
+ <Toggle
+ size="tiny"
+ checked={x.publish_delete}
+ onChange={() => toggleListenEvent(x, 'delete', x.publish_delete)}
+ />
+ </div>
+ </Table.td>
+ <Table.td>
+ <div className="flex justify-center">
+ <Toggle
+ size="tiny"
+ checked={x.publish_truncate}
+ onChange={() => toggleListenEvent(x, 'truncate', x.publish_truncate)}
+ />
+ </div>
+ </Table.td>
+ <Table.td className="px-4 py-3 pr-2">
+ <div className="flex justify-end gap-2">
+ <Button
+ type="default"
+ style={{ paddingTop: 3, paddingBottom: 3 }}
+ onClick={() => onSelectPublication(x.id)}
+ >
+ {x.tables == null
+ ? 'All tables'
+ : `${x.tables.length} ${
+ x.tables.length > 1 || x.tables.length == 0 ? 'tables' : 'table'
+ }`}
+ </Button>
+ </div>
+ </Table.td>
+ </Table.tr>
+ ))}
+ />
+ </div>
+ )}
</>
)
}
diff --git a/studio/components/interfaces/Database/Publications/PublicationsTables.tsx b/studio/components/interfaces/Database/Publications/PublicationsTables.tsx
index 1ad2eaa2818..6ce5ac36a12 100644
--- a/studio/components/interfaces/Database/Publications/PublicationsTables.tsx
+++ b/studio/components/interfaces/Database/Publications/PublicationsTables.tsx
@@ -6,6 +6,7 @@ import { PostgresPublication } from '@supabase/postgres-meta'
import { useStore } from 'hooks'
import PublicationsTableItem from './PublicationsTableItem'
import Table from 'components/to-be-cleaned/Table'
+import NoSearchResults from 'components/to-be-cleaned/NoSearchResults'
interface Props {
selectedPublication: PostgresPublication
@@ -75,16 +76,19 @@ const PublicationsTables: FC<Props> = ({ selectedPublication, onSelectBack }) =>
<div className=""></div>
</div>
</div>
- <div>
- <Table
- head={[
- <Table.th key="header-name">Name</Table.th>,
- <Table.th key="header-schema">Schema</Table.th>,
- <Table.th key="header-desc" className="hidden text-left lg:table-cell">
- Description
- </Table.th>,
- <Table.th key="header-all">
- {/* Temporarily disable All tables toggle for publications. See https://github.com/supabase/supabase/pull/7233.
+ {tables.length === 0 ? (
+ <NoSearchResults />
+ ) : (
+ <div>
+ <Table
+ head={[
+ <Table.th key="header-name">Name</Table.th>,
+ <Table.th key="header-schema">Schema</Table.th>,
+ <Table.th key="header-desc" className="hidden text-left lg:table-cell">
+ Description
+ </Table.th>,
+ <Table.th key="header-all">
+ {/* Temporarily disable All tables toggle for publications. See https://github.com/supabase/supabase/pull/7233.
<div className="flex flex-row space-x-3 items-center justify-end">
<div className="text-xs leading-4 font-medium text-gray-400 text-right ">
All Tables
@@ -98,17 +102,18 @@ const PublicationsTables: FC<Props> = ({ selectedPublication, onSelectBack }) =>
onChange={() => toggleReplicationForAllTables(publication, enabledForAllTables)}
/>
</div> */}
- </Table.th>,
- ]}
- body={tables.map((table: any, i: number) => (
- <PublicationsTableItem
- key={table.id}
- table={table}
- selectedPublication={selectedPublication}
- />
- ))}
- />
- </div>
+ </Table.th>,
+ ]}
+ body={tables.map((table: any, i: number) => (
+ <PublicationsTableItem
+ key={table.id}
+ table={table}
+ selectedPublication={selectedPublication}
+ />
+ ))}
+ />
+ </div>
+ )}
</>
)
}
diff --git a/studio/components/to-be-cleaned/NoSearchResults.tsx b/studio/components/to-be-cleaned/NoSearchResults.tsx
index 1714344e15c..1a14a9d7b3f 100644
--- a/studio/components/to-be-cleaned/NoSearchResults.tsx
+++ b/studio/components/to-be-cleaned/NoSearchResults.tsx
@@ -1,18 +1,17 @@
import SVG from 'react-inlinesvg'
-import { Typography } from '@supabase/ui'
export const NoSearchResults = () => {
return (
- <div className="flex flex-col items-center justify-center h-64">
+ <div className="flex h-64 flex-col items-center justify-center">
<SVG
src="/img/no-search-results.svg"
preProcessor={(code) =>
code.replace(/svg/, 'svg className="mb-2 w-16 h-16 text-color-inherit"')
}
/>
- <Typography.Text className="text-sm w-64 text-center opacity-50">
+ <p className="w-64 text-center text-sm opacity-50">
Hmm, we couldn't find any results that matches your query. Try another?
- </Typography.Text>
+ </p>
</div>
)
}