mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
studio: remove publication ALL TABLES toggle
This commit is contained in:
1 parent
31c611307c
commit
01deb96841
1 file changed
+33
-29
@@ -5,7 +5,7 @@ import { Button, Toggle, Input, IconChevronLeft, IconSearch } from '@supabase/ui
|
||||
import { useStore } from 'hooks'
|
||||
import PublicationsTableItem from './PublicationsTableItem'
|
||||
import Table from 'components/to-be-cleaned/Table'
|
||||
import { confirmAlert } from 'components/to-be-cleaned/ModalsDeprecated/ConfirmModal'
|
||||
// import { confirmAlert } from 'components/to-be-cleaned/ModalsDeprecated/ConfirmModal'
|
||||
|
||||
interface Props {
|
||||
selectedPublication: any
|
||||
@@ -16,9 +16,12 @@ interface Props {
|
||||
const PublicationsTables: FC<Props> = ({
|
||||
selectedPublication,
|
||||
onSelectBack,
|
||||
onPublicationUpdated,
|
||||
// onPublicationUpdated,
|
||||
}) => {
|
||||
const { ui, meta } = useStore()
|
||||
const {
|
||||
// ui,
|
||||
meta,
|
||||
} = useStore()
|
||||
const [filterString, setFilterString] = useState<string>('')
|
||||
|
||||
const tables =
|
||||
@@ -29,32 +32,32 @@ const PublicationsTables: FC<Props> = ({
|
||||
!meta.excludedSchemas.includes(table.schema) && table.name.includes(filterString)
|
||||
)
|
||||
|
||||
const publication = selectedPublication
|
||||
const enabledForAllTables = publication.tables == null
|
||||
// const publication = selectedPublication
|
||||
// const enabledForAllTables = publication.tables == null
|
||||
|
||||
const toggleReplicationForAllTables = async (publication: any, disable: boolean) => {
|
||||
const toggle = disable ? 'disable' : 'enable'
|
||||
confirmAlert({
|
||||
title: 'Confirm',
|
||||
type: 'warn',
|
||||
message: `Are you sure you want to ${toggle} replication for all tables in ${publication.name}?`,
|
||||
onAsyncConfirm: async () => {
|
||||
try {
|
||||
const res: any = await meta.publications.recreate(publication.id)
|
||||
if (res.error) {
|
||||
throw res.error
|
||||
} else {
|
||||
onPublicationUpdated(res)
|
||||
}
|
||||
} catch (error: any) {
|
||||
ui.setNotification({
|
||||
category: 'error',
|
||||
message: `Failed to toggle replication for all tables: ${error.message}`,
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
// const toggleReplicationForAllTables = async (publication: any, disable: boolean) => {
|
||||
// const toggle = disable ? 'disable' : 'enable'
|
||||
// confirmAlert({
|
||||
// title: 'Confirm',
|
||||
// type: 'warn',
|
||||
// message: `Are you sure you want to ${toggle} replication for all tables in ${publication.name}?`,
|
||||
// onAsyncConfirm: async () => {
|
||||
// try {
|
||||
// const res: any = await meta.publications.recreate(publication.id)
|
||||
// if (res.error) {
|
||||
// throw res.error
|
||||
// } else {
|
||||
// onPublicationUpdated(res)
|
||||
// }
|
||||
// } catch (error: any) {
|
||||
// ui.setNotification({
|
||||
// category: 'error',
|
||||
// message: `Failed to toggle replication for all tables: ${error.message}`,
|
||||
// })
|
||||
// }
|
||||
// },
|
||||
// })
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -89,6 +92,7 @@ const PublicationsTables: FC<Props> = ({
|
||||
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
|
||||
@@ -101,7 +105,7 @@ const PublicationsTables: FC<Props> = ({
|
||||
checked={enabledForAllTables}
|
||||
onChange={() => toggleReplicationForAllTables(publication, enabledForAllTables)}
|
||||
/>
|
||||
</div>
|
||||
</div> */}
|
||||
</Table.th>,
|
||||
]}
|
||||
body={tables.map((table: any, i: number) => (
|
||||
|
||||
Reference in new issue
Block a user