This commit is contained in:
Jan Prochazka 2021-03-27 08:48:59 +01:00
parent 3f8ff91e2c
commit 218478c128
3 changed files with 20 additions and 3 deletions

View File

@ -38,12 +38,12 @@ export function findObjectLike(
if (!dbinfo) return null;
if (schemaName) {
// @ts-ignore
return dbinfo[objectTypeField].find(
return dbinfo[objectTypeField]?.find(
x => equalStringLike(x.pureName, pureName) && equalStringLike(x.schemaName, schemaName)
);
}
// @ts-ignore
return dbinfo[objectTypeField].find(x => equalStringLike(x.pureName, pureName));
return dbinfo[objectTypeField]?.find(x => equalStringLike(x.pureName, pureName));
}
export function findForeignKeyForColumn(table: TableInfo, column: ColumnInfo) {

View File

@ -19,6 +19,18 @@
onConfirm: () => axiosInstance.post('connections/delete', data),
});
};
const handleCreateDatabase = () => {
showModal(InputTextModal, {
header: 'Create database',
value: 'newdb',
label: 'Database name',
onConfirm: name =>
axiosInstance.post('server-connections/create-database', {
conid: data._id,
name,
}),
});
};
return [
config.runAsPortal == false && [
@ -44,6 +56,10 @@
text: 'Disconnect',
onClick: handleDisconnect,
},
$openedConnections.includes(data._id) && {
text: 'Create database',
onClick: handleCreateDatabase,
},
];
};
@ -60,6 +76,7 @@
import { showModal } from '../modals/modalTools';
import ConnectionModal from '../modals/ConnectionModal.svelte';
import ConfirmModal from '../modals/ConfirmModal.svelte';
import InputTextModal from '../modals/InputTextModal.svelte';
export let data;

View File

@ -20,7 +20,7 @@ window.onunhandledrejection = async e => {
window.location.reload();
}
} else {
if (window.confirm('Sorry, DbGate has crashed.\nPress OK for reload application')) {
if (window.confirm('Sorry, DbGate has crashed.\nPress OK for reload application\nPress Cancel and inspect Console in Developer tools for error details')) {
localStorage.setItem('lastDbGateCrash', JSON.stringify(new Date().getTime()));
window.location.reload();
}