mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Remove system dbs from dacfx wizard dropdowns (#11510)
* remove system dbs from dacfx wizard dropdowns * add test for filtering out system dbs
This commit is contained in:
@@ -8,6 +8,8 @@ import * as loc from '../../localizedConstants';
|
||||
import { DacFxDataModel } from './models';
|
||||
import { DataTierApplicationWizard } from '../dataTierApplicationWizard';
|
||||
|
||||
const systemDbs = ['master', 'msdb', 'tempdb', 'model'];
|
||||
|
||||
export abstract class BasePage {
|
||||
protected readonly instance: DataTierApplicationWizard;
|
||||
protected readonly wizardPage: azdata.window.WizardPage;
|
||||
@@ -122,14 +124,17 @@ export abstract class BasePage {
|
||||
protected async getDatabaseValues(): Promise<string[]> {
|
||||
let idx = -1;
|
||||
let count = -1;
|
||||
this.databaseValues = (await azdata.connection.listDatabases(this.model.server.connectionId)).map(db => {
|
||||
count++;
|
||||
if (this.model.database && db === this.model.database) {
|
||||
idx = count;
|
||||
}
|
||||
this.databaseValues = (await azdata.connection.listDatabases(this.model.server.connectionId))
|
||||
// filter out system dbs
|
||||
.filter(db => systemDbs.find(systemdb => db === systemdb) === undefined)
|
||||
.map(db => {
|
||||
count++;
|
||||
if (this.model.database && db === this.model.database) {
|
||||
idx = count;
|
||||
}
|
||||
|
||||
return db;
|
||||
});
|
||||
return db;
|
||||
});
|
||||
|
||||
if (idx >= 0) {
|
||||
let tmp = this.databaseValues[0];
|
||||
|
||||
Reference in New Issue
Block a user