Ask for confirmation before dropping the database

This commit is contained in:
Sandeep Somavarapu 2017-05-08 23:29:59 +02:00
Родитель 08e79a20e4
Коммит b4565a685c
1 изменённых файлов: 11 добавлений и 6 удалений

Просмотреть файл

@ -106,12 +106,17 @@ function getDatabaseQuickPicks(): Thenable<DatabaseQuickPick[]> {
}
function dropDatabase(database: Database): void {
if (connectedDb && connectedDb.server.id === database.server.id && connectedDb.id === database.id) {
connectedDb = null;
languageClient.disconnect();
vscode.window.setStatusBarMessage('Mongo: Not connected');
}
database.server.dropDb(database);
vscode.window.showInformationMessage('Are you sure you want to drop the database \'' + database.id + '\' and its collections?', { modal: true }, 'Drop')
.then(result => {
if (result === 'Drop') {
if (connectedDb && connectedDb.server.id === database.server.id && connectedDb.id === database.id) {
connectedDb = null;
languageClient.disconnect();
vscode.window.setStatusBarMessage('Mongo: Not connected');
}
database.server.dropDb(database);
}
})
}
function connectToDatabase(database: Database): void {