Hide publish sql project to new azure server behind preview setting (#21248)

* hide publish to new Azure server under preview setting

* try adding additional properties instead of replacing everything in configuration

* cleanup and change to adding configuration properties instead of replacing the whole thing

* add more info in comment

* remove extra line
This commit is contained in:
Kim Santiago
2022-11-17 16:05:46 -08:00
committed by GitHub
parent a238d15da2
commit ac494955ac
5 changed files with 57 additions and 21 deletions

View File

@@ -42,5 +42,6 @@
"sqlDatabaseProjects.autorestSqlVersion": "Which version of Autorest.Sql to use from NPM. Latest will be used if not set.",
"sqlDatabaseProjects.collapseProjectNodes": "Whether project nodes start collapsed",
"sqlDatabaseProjects.microsoftBuildSqlVersion": "Which version of Microsoft.Build.Sql SDK to use for building legacy sql projects. Example: 0.1.7-preview",
"sqlDatabaseProjects.enablePreviewFeatures": "Enable preview SQL Database Projects features",
"sqlDatabaseProjects.welcome": "No database projects currently open.\n[New Project](command:sqlDatabaseProjects.new)\n[Open Project](command:sqlDatabaseProjects.open)\n[Create Project From Database](command:sqlDatabaseProjects.importDatabase)"
}

View File

@@ -4,5 +4,17 @@
"extensionDependencies": [
"ms-mssql.mssql",
"ms-mssql.data-workspace-vscode"
]
],
"contributes": {
"configuration": [
{
"properties": {
"sqlDatabaseProjects.enablePreviewFeatures": {
"type": "boolean",
"description": "%sqlDatabaseProjects.enablePreviewFeatures%"
}
}
}
]
}
}

View File

@@ -172,7 +172,7 @@ export function publishToExistingServer(name: string) { return localize('publish
export function publishToDockerContainer(name: string) { return localize('publishToDockerContainer', "Publish to new {0} local development container", name); }
export function publishToDockerContainerPreview(name: string) { return localize('publishToDockerContainerPreview', "Publish to new {0} local development container (Preview)", name); }
export const publishToAzureEmulator = localize('publishToAzureEmulator', "Publish to new Azure SQL Database emulator");
export const publishToNewAzureServer = localize('publishToNewAzureServer', "Publish to new Azure SQL logical server");
export const publishToNewAzureServer = localize('publishToNewAzureServer', "Publish to new Azure SQL logical server (Preview)");
export const azureServerName = localize('azureServerName', "Azure SQL server name");
export const azureSubscription = localize('azureSubscription', "Azure subscription");
export const resourceGroup = localize('resourceGroup', "Resource group");
@@ -626,6 +626,7 @@ export enum PublishTargetType {
// Configuration keys
export const CollapseProjectNodesKey = 'collapseProjectNodes';
export const microsoftBuildSqlVersionKey = 'microsoftBuildSqlVersion';
export const enablePreviewFeaturesKey = 'enablePreviewFeatures';
// httpClient
export const downloadError = localize('downloadError', "Download error");

View File

@@ -12,6 +12,7 @@ import { getDefaultPublishDeploymentOptions, getVscodeMssqlApi } from '../common
import { IConnectionInfo, IFireWallRuleError } from 'vscode-mssql';
import { getPublishServerName } from './utils';
import { ISqlProjectPublishSettings, ISqlProject, SqlTargetPlatform } from 'sqldbproj';
import { DBProjectConfigurationKey } from '../tools/netcoreTool';
/**
* Create flow for Publishing a database using only VS Code-native APIs such as QuickPick
@@ -225,9 +226,19 @@ export async function launchPublishTargetOption(project: Project): Promise<const
const logicalServerName = target === constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlAzure) ? constants.AzureSqlLogicalServerName : constants.SqlServerName;
// Options list based on target
const options = target === constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlAzure) ?
[constants.publishToAzureEmulator, constants.publishToNewAzureServer, constants.publishToExistingServer(logicalServerName)] :
[constants.publishToDockerContainer(name), constants.publishToExistingServer(logicalServerName)];
let options;
if (target === constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlAzure)) {
options = [constants.publishToAzureEmulator, constants.publishToExistingServer(logicalServerName)]
// only show "Publish to New Azure Server" option if preview features are enabled
const enablePreviewFeatures = vscode.workspace.getConfiguration(DBProjectConfigurationKey).get(constants.enablePreviewFeaturesKey);
if (enablePreviewFeatures) {
options.push(constants.publishToNewAzureServer);
}
} else {
options = [constants.publishToDockerContainer(name), constants.publishToExistingServer(logicalServerName)];
}
// Show the options to the user
const publishOption = await vscode.window.showQuickPick(