mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Finding index is correct array (#23162)
This commit is contained in:
@@ -127,14 +127,13 @@ export async function getPublishDatabaseSettings(project: ISqlProject, promptFor
|
|||||||
// if a publish profile was loaded and had a database name, use that instead of the project file name
|
// if a publish profile was loaded and had a database name, use that instead of the project file name
|
||||||
const dbName = publishProfile?.databaseName || project.projectFileName;
|
const dbName = publishProfile?.databaseName || project.projectFileName;
|
||||||
|
|
||||||
// Ensure the project name or name specified in the publish profile is an option, either adding it if it
|
// Ensure the project name or name specified in the publish profile is an option
|
||||||
// doesn't already exist or moving it to the top if it does
|
const projectNameIndex = dbQuickpicks.findIndex(db => db.label === dbName);
|
||||||
const projectNameIndex = dbs.findIndex(db => db === dbName);
|
if (projectNameIndex === -1) { // add it if it doesn't already exist...
|
||||||
if (projectNameIndex === -1) {
|
|
||||||
dbQuickpicks.unshift({ label: dbName, description: constants.newText });
|
dbQuickpicks.unshift({ label: dbName, description: constants.newText });
|
||||||
} else {
|
} else { // ...or move it to the top if it does
|
||||||
dbQuickpicks.splice(projectNameIndex, 1);
|
const removed = dbQuickpicks.splice(projectNameIndex, 1)[0];
|
||||||
dbQuickpicks.unshift({ label: dbName });
|
dbQuickpicks.unshift(removed);
|
||||||
}
|
}
|
||||||
|
|
||||||
let databaseName: string | undefined = undefined;
|
let databaseName: string | undefined = undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user