From 01deb9684102f6a40dcb676d547ffabc43841ae2 Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo Date: Mon, 13 Jun 2022 14:46:40 +0800 Subject: [PATCH] studio: remove publication ALL TABLES toggle --- .../Publications/PublicationsTables.tsx | 62 ++++++++++--------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/studio/components/interfaces/Database/Publications/PublicationsTables.tsx b/studio/components/interfaces/Database/Publications/PublicationsTables.tsx index 27fc0c4a785..03c5a66e319 100644 --- a/studio/components/interfaces/Database/Publications/PublicationsTables.tsx +++ b/studio/components/interfaces/Database/Publications/PublicationsTables.tsx @@ -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 = ({ selectedPublication, onSelectBack, - onPublicationUpdated, + // onPublicationUpdated, }) => { - const { ui, meta } = useStore() + const { + // ui, + meta, + } = useStore() const [filterString, setFilterString] = useState('') const tables = @@ -29,32 +32,32 @@ const PublicationsTables: FC = ({ !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 = ({ Description , + {/* Temporarily disable All tables toggle for publications. See https://github.com/supabase/supabase/pull/7233.
All Tables @@ -101,7 +105,7 @@ const PublicationsTables: FC = ({ checked={enabledForAllTables} onChange={() => toggleReplicationForAllTables(publication, enabledForAllTables)} /> -
+
*/}
, ]} body={tables.map((table: any, i: number) => (