mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
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:
@@ -40,8 +40,8 @@ const formatFiles = (some) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
return gulp.src(some, {
|
return gulp.src(some, {
|
||||||
base: '.'
|
base: '.'
|
||||||
})
|
})
|
||||||
.pipe(filter(f => !f.stat.isDirectory()))
|
.pipe(filter(f => !f.stat.isDirectory()))
|
||||||
.pipe(formatting);
|
.pipe(formatting);
|
||||||
|
|
||||||
@@ -102,19 +102,19 @@ gulp.task('package-external-extensions', task.series(
|
|||||||
const extensionName = path.basename(extensionPath);
|
const extensionName = path.basename(extensionPath);
|
||||||
return { name: extensionName, path: extensionPath };
|
return { name: extensionName, path: extensionPath };
|
||||||
})
|
})
|
||||||
.filter(element => ext.vscodeExternalExtensions.indexOf(element.name) === -1) // VS Code external extensions are bundled into ADS so no need to create a normal VSIX for them
|
.filter(element => ext.vscodeExternalExtensions.indexOf(element.name) === -1) // VS Code external extensions are bundled into ADS so no need to create a normal VSIX for them
|
||||||
.map(element => {
|
.map(element => {
|
||||||
const pkgJson = require(path.join(element.path, 'package.json'));
|
const pkgJson = require(path.join(element.path, 'package.json'));
|
||||||
const vsixDirectory = path.join(root, '.build', 'extensions');
|
const vsixDirectory = path.join(root, '.build', 'extensions');
|
||||||
mkdirp.sync(vsixDirectory);
|
mkdirp.sync(vsixDirectory);
|
||||||
const packagePath = path.join(vsixDirectory, `${pkgJson.name}-${pkgJson.version}.vsix`);
|
const packagePath = path.join(vsixDirectory, `${pkgJson.name}-${pkgJson.version}.vsix`);
|
||||||
console.info('Creating vsix for ' + element.path + ' result:' + packagePath);
|
console.info('Creating vsix for ' + element.path + ' result:' + packagePath);
|
||||||
return vsce.createVSIX({
|
return vsce.createVSIX({
|
||||||
cwd: element.path,
|
cwd: element.path,
|
||||||
packagePath: packagePath,
|
packagePath: packagePath,
|
||||||
useYarn: true
|
useYarn: true
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
// Wait for all the initial VSIXes to be completed before making the VS Code ones since we'll be overwriting
|
// Wait for all the initial VSIXes to be completed before making the VS Code ones since we'll be overwriting
|
||||||
// values in the package.json for those.
|
// values in the package.json for those.
|
||||||
await Promise.all(vsixes);
|
await Promise.all(vsixes);
|
||||||
@@ -133,15 +133,26 @@ gulp.task('package-external-extensions', task.series(
|
|||||||
// And now use gulp-json-editor to modify the contents
|
// And now use gulp-json-editor to modify the contents
|
||||||
const updateData = JSON.parse(fs.readFileSync(vscodeManifestFullPath)); // Read in the set of values to replace from package.vscode.json
|
const updateData = JSON.parse(fs.readFileSync(vscodeManifestFullPath)); // Read in the set of values to replace from package.vscode.json
|
||||||
Object.keys(updateData).forEach(key => {
|
Object.keys(updateData).forEach(key => {
|
||||||
data[key] = updateData[key];
|
if (key !== 'contributes') {
|
||||||
|
data[key] = updateData[key];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if(data.contributes?.menus){
|
if (data.contributes?.menus) {
|
||||||
// Remove ADS-only menus. This is a subset of the menus listed in https://github.com/microsoft/azuredatastudio/blob/main/src/vs/workbench/api/common/menusExtensionPoint.ts
|
// Remove ADS-only menus. This is a subset of the menus listed in https://github.com/microsoft/azuredatastudio/blob/main/src/vs/workbench/api/common/menusExtensionPoint.ts
|
||||||
// More can be added to the list as needed.
|
// More can be added to the list as needed.
|
||||||
['objectExplorer/item/context', 'dataExplorer/context', 'dashboard/toolbar'].forEach(menu => {
|
['objectExplorer/item/context', 'dataExplorer/context', 'dashboard/toolbar'].forEach(menu => {
|
||||||
delete data.contributes.menus[menu];
|
delete data.contributes.menus[menu];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add any configuration properties from the package.vscode.json
|
||||||
|
// Currently only supports bringing over properties in the first config object found and doesn't support modifying the title
|
||||||
|
if (updateData.contributes?.configuration[0]?.properties) {
|
||||||
|
Object.keys(updateData.contributes.configuration[0].properties).forEach(key => {
|
||||||
|
data.contributes.configuration[0].properties[key] = updateData.contributes.configuration[0].properties[key];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}, { beautify: false }))
|
}, { beautify: false }))
|
||||||
.pipe(gulp.dest(packageDir));
|
.pipe(gulp.dest(packageDir));
|
||||||
|
|||||||
@@ -42,5 +42,6 @@
|
|||||||
"sqlDatabaseProjects.autorestSqlVersion": "Which version of Autorest.Sql to use from NPM. Latest will be used if not set.",
|
"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.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.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)"
|
"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)"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,17 @@
|
|||||||
"extensionDependencies": [
|
"extensionDependencies": [
|
||||||
"ms-mssql.mssql",
|
"ms-mssql.mssql",
|
||||||
"ms-mssql.data-workspace-vscode"
|
"ms-mssql.data-workspace-vscode"
|
||||||
]
|
],
|
||||||
|
"contributes": {
|
||||||
|
"configuration": [
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"sqlDatabaseProjects.enablePreviewFeatures": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "%sqlDatabaseProjects.enablePreviewFeatures%"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 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 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 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 azureServerName = localize('azureServerName', "Azure SQL server name");
|
||||||
export const azureSubscription = localize('azureSubscription', "Azure subscription");
|
export const azureSubscription = localize('azureSubscription', "Azure subscription");
|
||||||
export const resourceGroup = localize('resourceGroup', "Resource group");
|
export const resourceGroup = localize('resourceGroup', "Resource group");
|
||||||
@@ -626,6 +626,7 @@ export enum PublishTargetType {
|
|||||||
// Configuration keys
|
// Configuration keys
|
||||||
export const CollapseProjectNodesKey = 'collapseProjectNodes';
|
export const CollapseProjectNodesKey = 'collapseProjectNodes';
|
||||||
export const microsoftBuildSqlVersionKey = 'microsoftBuildSqlVersion';
|
export const microsoftBuildSqlVersionKey = 'microsoftBuildSqlVersion';
|
||||||
|
export const enablePreviewFeaturesKey = 'enablePreviewFeatures';
|
||||||
|
|
||||||
// httpClient
|
// httpClient
|
||||||
export const downloadError = localize('downloadError', "Download error");
|
export const downloadError = localize('downloadError', "Download error");
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { getDefaultPublishDeploymentOptions, getVscodeMssqlApi } from '../common
|
|||||||
import { IConnectionInfo, IFireWallRuleError } from 'vscode-mssql';
|
import { IConnectionInfo, IFireWallRuleError } from 'vscode-mssql';
|
||||||
import { getPublishServerName } from './utils';
|
import { getPublishServerName } from './utils';
|
||||||
import { ISqlProjectPublishSettings, ISqlProject, SqlTargetPlatform } from 'sqldbproj';
|
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
|
* 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;
|
const logicalServerName = target === constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlAzure) ? constants.AzureSqlLogicalServerName : constants.SqlServerName;
|
||||||
|
|
||||||
// Options list based on target
|
// Options list based on target
|
||||||
const options = target === constants.targetPlatformToVersion.get(SqlTargetPlatform.sqlAzure) ?
|
let options;
|
||||||
[constants.publishToAzureEmulator, constants.publishToNewAzureServer, constants.publishToExistingServer(logicalServerName)] :
|
|
||||||
[constants.publishToDockerContainer(name), constants.publishToExistingServer(logicalServerName)];
|
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
|
// Show the options to the user
|
||||||
const publishOption = await vscode.window.showQuickPick(
|
const publishOption = await vscode.window.showQuickPick(
|
||||||
|
|||||||
Reference in New Issue
Block a user