drop database #384

This commit is contained in:
Jan Prochazka
2022-09-29 09:58:35 +02:00
parent 04d39f6646
commit 833f029ab5
9 changed files with 62 additions and 7 deletions

View File

@@ -77,6 +77,17 @@
);
};
const handleDropDatabase = () => {
showModal(ConfirmModal, {
message: `Really drop database ${name}? All opened sessions with this database will be forcefully closed.`,
onConfirm: () =>
apiCall('server-connections/drop-database', {
conid: connection._id,
name,
}),
});
};
const handleNewCollection = () => {
showModal(InputTextModal, {
value: '',
@@ -233,6 +244,9 @@
{ onClick: handleNewQuery, text: 'New query', isNewQuery: true },
driver?.databaseEngineTypes?.includes('sql') && { onClick: handleNewTable, text: 'New table' },
driver?.databaseEngineTypes?.includes('document') && { onClick: handleNewCollection, text: 'New collection' },
isSqlOrDoc &&
!connection.isReadOnly &&
!connection.singleDatabase && { onClick: handleDropDatabase, text: 'Drop database' },
{ divider: true },
isSqlOrDoc && !connection.isReadOnly && { onClick: handleImport, text: 'Import wizard' },
isSqlOrDoc && { onClick: handleExport, text: 'Export wizard' },