new collection refactor

This commit is contained in:
Jan Prochazka
2024-08-22 11:48:34 +02:00
parent 7ad8edcdae
commit ccb28783a2
6 changed files with 110 additions and 53 deletions

View File

@@ -294,24 +294,7 @@ registerCommand({
showModal(NewCollectionModal, {
driver,
onConfirm: async values => {
// await apiCall('database-connections/run-script', { ...dbid, sql: `db.createCollection('${newCollection}')` });
const resp = await apiCall('database-connections/run-operation', {
...dbid,
operation: {
type: 'createCollection',
collection: values,
},
});
const { errorMessage } = resp || {};
if (errorMessage) {
showModal(ErrorMessageModal, { title: 'Error when executing operation', message: errorMessage });
} else {
showSnackbarSuccess('Saved to database');
apiCall('database-connections/sync-model', dbid);
}
},
dbid,
});
},
});