diff --git a/packages/api/src/proc/databaseConnectionProcess.js b/packages/api/src/proc/databaseConnectionProcess.js index 702b968d..7ca93323 100644 --- a/packages/api/src/proc/databaseConnectionProcess.js +++ b/packages/api/src/proc/databaseConnectionProcess.js @@ -214,6 +214,7 @@ async function handleDriverDataCore(msgid, callMethod) { } async function handleSchemaList({ msgid }) { + logger.debug('Loading schema list'); return handleDriverDataCore(msgid, driver => driver.listSchemas(dbhan)); } diff --git a/packages/web/src/appobj/DatabaseAppObject.svelte b/packages/web/src/appobj/DatabaseAppObject.svelte index 120577e7..7285f8b6 100644 --- a/packages/web/src/appobj/DatabaseAppObject.svelte +++ b/packages/web/src/appobj/DatabaseAppObject.svelte @@ -262,6 +262,17 @@ }); }; + const handleRefreshSchemas = () => { + const conid = connection._id; + const database = name; + apiCall('database-connections/dispatch-database-changed-event', { + event: 'schema-list-changed', + conid, + database, + }); + loadSchemaList(conid, database); + }; + async function handleConfirmSql(sql) { saveScriptToDatabase({ conid: connection._id, database: name }, sql, false); } @@ -290,6 +301,8 @@ onClick: handleNewPerspective, text: 'Design perspective query', }, + connection.useSeparateSchemas && { onClick: handleRefreshSchemas, text: 'Refresh schemas' }, + { divider: true }, isSqlOrDoc && !connection.isReadOnly && @@ -364,6 +377,7 @@ getCurrentDatabase, getExtensions, getOpenedTabs, + loadingSchemaLists, openedConnections, openedSingleDatabaseConnections, pinnedDatabases, @@ -391,7 +405,7 @@ import hasPermission from '../utility/hasPermission'; import { openImportExportTab } from '../utility/importExportTools'; import newTable from '../tableeditor/newTable'; - import { switchCurrentDatabase } from '../utility/common'; + import { loadSchemaList, switchCurrentDatabase } from '../utility/common'; export let data; export let passProps; @@ -409,6 +423,7 @@ $: isPinned = !!$pinnedDatabases.find(x => x?.name == data.name && x?.connection?._id == data.connection?._id); $: apps = useUsedApps(); + $: isLoadingSchemas = $loadingSchemaLists[`${data?.connection?._id}::${data?.name}`]; x.isNewQuery) .onClick(); }} + statusIcon={isLoadingSchemas ? 'icon loading' : ''} menu={createMenu} showPinnedInsteadOfUnpin={passProps?.showPinnedInsteadOfUnpin} onPin={isPinned ? null : () => pinnedDatabases.update(list => [...list, data])} diff --git a/packages/web/src/impexp/FormSchemaSelect.svelte b/packages/web/src/impexp/FormSchemaSelect.svelte index bcc6c757..049fdad7 100644 --- a/packages/web/src/impexp/FormSchemaSelect.svelte +++ b/packages/web/src/impexp/FormSchemaSelect.svelte @@ -1,4 +1,5 @@