mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
List databases for publish quickpick (#16368)
* List databases for publish quickpick * missed word
This commit is contained in:
@@ -69,14 +69,26 @@ export async function launchPublishDatabaseQuickpick(project: Project): Promise<
|
|||||||
// so exit the flow.
|
// so exit the flow.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
quickPick.hide(); // Hide the quickpick immediately so it isn't showing while the API loads
|
||||||
|
|
||||||
// 2. Select connection
|
// 2. Select connection
|
||||||
const api = await getVscodeMssqlApi();
|
const vscodeMssqlApi = await getVscodeMssqlApi();
|
||||||
const connectionProfile = await api.promptForConnection();
|
let dbs: string[] | undefined = undefined;
|
||||||
if (!connectionProfile) {
|
while (!dbs) {
|
||||||
return;
|
const connectionProfile = await vscodeMssqlApi.promptForConnection(true);
|
||||||
|
if (!connectionProfile) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Get the list of databases now to validate that the connection is valid and re-prompt them if it isn't
|
||||||
|
try {
|
||||||
|
dbs = await vscodeMssqlApi.listDatabases(connectionProfile);
|
||||||
|
} catch (err) {
|
||||||
|
// no-op, the mssql extension handles showing the error to the user. We'll just go
|
||||||
|
// back and prompt the user for a connection again
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const dbs = ['db1', 'db2'];
|
|
||||||
|
// 3. Select database
|
||||||
const dbQuickpicks = dbs.map(db => {
|
const dbQuickpicks = dbs.map(db => {
|
||||||
return {
|
return {
|
||||||
label: db,
|
label: db,
|
||||||
@@ -93,10 +105,9 @@ export async function launchPublishDatabaseQuickpick(project: Project): Promise<
|
|||||||
}
|
}
|
||||||
|
|
||||||
dbQuickpicks.push({ label: constants.createNew, dbName: '', isCreateNew: true });
|
dbQuickpicks.push({ label: constants.createNew, dbName: '', isCreateNew: true });
|
||||||
// 3. Select database
|
|
||||||
// TODO@chgagnon: Hook up to MSSQL
|
let databaseName: string | undefined = undefined;
|
||||||
let databaseName = '';
|
while (!databaseName) {
|
||||||
while (databaseName === '') {
|
|
||||||
const selectedDatabase = await vscode.window.showQuickPick(
|
const selectedDatabase = await vscode.window.showQuickPick(
|
||||||
dbQuickpicks,
|
dbQuickpicks,
|
||||||
{ title: constants.selectDatabase, ignoreFocusOut: true });
|
{ title: constants.selectDatabase, ignoreFocusOut: true });
|
||||||
@@ -117,7 +128,6 @@ export async function launchPublishDatabaseQuickpick(project: Project): Promise<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 4. Modify sqlcmd vars
|
// 4. Modify sqlcmd vars
|
||||||
// If a publish profile is provided then the values from there will overwrite the ones in the
|
// If a publish profile is provided then the values from there will overwrite the ones in the
|
||||||
// project file (if they exist)
|
// project file (if they exist)
|
||||||
|
|||||||
@@ -28,8 +28,16 @@ declare module 'vscode-mssql' {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Prompts the user to select an existing connection or create a new one, and then returns the result
|
* Prompts the user to select an existing connection or create a new one, and then returns the result
|
||||||
|
* @param ignoreFocusOut Whether the quickpick prompt ignores focus out (default false)
|
||||||
*/
|
*/
|
||||||
promptForConnection(): Promise<IConnectionInfo | undefined>
|
promptForConnection(ignoreFocusOut?: boolean): Promise<IConnectionInfo | undefined>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists the databases for a given connection. An error is thrown and displayed to the user if an
|
||||||
|
* error occurs while connecting
|
||||||
|
* @param connection The connection to list the databases for
|
||||||
|
*/
|
||||||
|
listDatabases(connection: IConnectionInfo): Promise<string[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user