mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-15 01:25:36 -05:00
SQL Project Deploy to docker container - Adding a UI for user to select docker image tag (#19297)
This commit is contained in:
@@ -275,7 +275,8 @@ export async function launchCreateAzureServerQuickPick(project: Project, azureSq
|
||||
* Create flow for publishing a database to docker container using only VS Code-native APIs such as QuickPick
|
||||
*/
|
||||
export async function launchPublishToDockerContainerQuickpick(project: Project): Promise<ILocalDbDeployProfile | undefined> {
|
||||
const name = uiUtils.getPublishServerName(project.getProjectTargetVersion());
|
||||
const target = project.getProjectTargetVersion();
|
||||
const name = uiUtils.getPublishServerName(target);
|
||||
let localDbSetting: ILocalDbSetting | undefined;
|
||||
// Deploy to docker selected
|
||||
let portNumber = await vscode.window.showInputBox({
|
||||
@@ -321,10 +322,10 @@ export async function launchPublishToDockerContainerQuickpick(project: Project):
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const baseImages = uiUtils.getDockerBaseImages(project.getProjectTargetVersion());
|
||||
const baseImages = uiUtils.getDockerBaseImages(target);
|
||||
const baseImage = await vscode.window.showQuickPick(
|
||||
baseImages.map(x => x.displayName),
|
||||
{ title: constants.selectBaseImage(name), ignoreFocusOut: true });
|
||||
{ title: constants.selectBaseImage(name), ignoreFocusOut: true, placeHolder: uiUtils.getDockerImagePlaceHolder(target) });
|
||||
|
||||
// Return when user hits escape
|
||||
if (!baseImage) {
|
||||
@@ -332,19 +333,50 @@ export async function launchPublishToDockerContainerQuickpick(project: Project):
|
||||
}
|
||||
|
||||
const imageInfo = baseImages.find(x => x.displayName === baseImage);
|
||||
|
||||
if (!imageInfo) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const eulaAccepted = await launchEulaQuickPick(imageInfo);
|
||||
if (!eulaAccepted) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let imageTags = await uiUtils.getImageTags(imageInfo, target);
|
||||
let imageTagsItems: vscode.QuickPickItem[] = imageTags.map(tag => { return { label: tag }; });
|
||||
|
||||
if (imageInfo.defaultTag) {
|
||||
// move the default to be the first one in the list
|
||||
const defaultIndex = imageTagsItems.findIndex(i => i.label === imageInfo.defaultTag);
|
||||
if (defaultIndex > -1) {
|
||||
imageTagsItems.splice(defaultIndex, 1);
|
||||
}
|
||||
// add default next to the default value
|
||||
imageTagsItems.unshift({ label: imageInfo.defaultTag, description: constants.defaultQuickPickItem });
|
||||
}
|
||||
const imageTag = await vscode.window.showQuickPick(
|
||||
imageTagsItems,
|
||||
{ title: constants.selectImageTag(name), ignoreFocusOut: true });
|
||||
|
||||
if (!imageTag) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Add the image tag if it's not the latest
|
||||
let imageName = imageInfo.name;
|
||||
if (imageTag && imageTag.label !== constants.dockerImageDefaultTag) {
|
||||
imageName = `${imageName}:${imageTag.label}`;
|
||||
}
|
||||
|
||||
localDbSetting = {
|
||||
serverName: constants.defaultLocalServerName,
|
||||
userName: constants.defaultLocalServerAdminName,
|
||||
dbName: project.projectFileName,
|
||||
password: password,
|
||||
port: +portNumber,
|
||||
dockerBaseImage: imageInfo?.name || '',
|
||||
dockerBaseImageEula: imageInfo?.agreementInfo?.link?.url || ''
|
||||
dockerBaseImage: imageName,
|
||||
dockerBaseImageEula: imageInfo.agreementInfo.link.url
|
||||
};
|
||||
|
||||
let deploySettings = await getPublishDatabaseSettings(project, false);
|
||||
@@ -360,7 +392,6 @@ export async function launchPublishToDockerContainerQuickpick(project: Project):
|
||||
// Get the database name from deploy settings
|
||||
localDbSetting.dbName = deploySettings.databaseName;
|
||||
|
||||
|
||||
return {
|
||||
localDbSetting: localDbSetting,
|
||||
deploySettings: deploySettings,
|
||||
|
||||
Reference in New Issue
Block a user