mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 17:22:48 -05:00
Add target platform dropdown to new project dialog (#16091)
* add target platform as an option in create project api * move constant * WIP * show versions in dialog and create project with selected version * validate version * add error messages * add test * change version to target platform * cleanup * more cleanup * use withProps
This commit is contained in:
@@ -225,6 +225,9 @@ export function notValidVariableName(name: string) { return localize('notValidVa
|
||||
export function cantAddCircularProjectReference(project: string) { return localize('cantAddCircularProjectReference', "A reference to project '{0}' cannot be added. Adding this project as a reference would cause a circular dependency", project); }
|
||||
export function unableToFindSqlCmdVariable(variableName: string) { return localize('unableToFindSqlCmdVariable', "Unable to find SQLCMD variable '{0}'", variableName); }
|
||||
export function unableToFindDatabaseReference(reference: string) { return localize('unableToFindReference', "Unable to find database reference {0}", reference); }
|
||||
export function invalidGuid(guid: string) { return localize('invalidGuid', "Specified GUID is invalid: {0}", guid); }
|
||||
export function invalidTargetPlatform(targetPlatform: string, supportedTargetPlatforms: string[]) { return localize('invalidTargetPlatform', "Invalid target platform: {0}. Supported target platforms: {1}", targetPlatform, supportedTargetPlatforms.toString()); }
|
||||
|
||||
|
||||
// Action types
|
||||
export const deleteAction = localize('deleteAction', 'Delete');
|
||||
@@ -348,6 +351,7 @@ export const sameDatabaseExampleUsage = 'SELECT * FROM [Schema1].[Table1]';
|
||||
export function differentDbSameServerExampleUsage(db: string) { return `SELECT * FROM [${db}].[Schema1].[Table1]`; }
|
||||
export function differentDbDifferentServerExampleUsage(server: string, db: string) { return `SELECT * FROM [${server}].[${db}].[Schema1].[Table1]`; }
|
||||
|
||||
// Target platforms
|
||||
export const targetPlatformToVersion: Map<string, string> = new Map<string, string>([
|
||||
[SqlTargetPlatform.sqlServer2005, '90'],
|
||||
[SqlTargetPlatform.sqlServer2008, '100'],
|
||||
@@ -363,7 +367,8 @@ export const targetPlatformToVersion: Map<string, string> = new Map<string, stri
|
||||
// DW is special since the system dacpac folder has a different name from the target platform
|
||||
export const AzureDwFolder = 'AzureDw';
|
||||
|
||||
export const defaultDSP = targetPlatformToVersion.get(SqlTargetPlatform.sqlServer2019)!;
|
||||
export const defaultTargetPlatform = SqlTargetPlatform.sqlServer2019;
|
||||
export const defaultDSP = targetPlatformToVersion.get(defaultTargetPlatform)!;
|
||||
|
||||
/**
|
||||
* Returns the name of the target platform of the version of sql
|
||||
|
||||
@@ -34,8 +34,8 @@ import { CreateProjectFromDatabaseDialog } from '../dialogs/createProjectFromDat
|
||||
import { TelemetryActions, TelemetryReporter, TelemetryViews } from '../common/telemetry';
|
||||
import { IconPathHelper } from '../common/iconHelper';
|
||||
import { DashboardData, PublishData, Status } from '../models/dashboardData/dashboardData';
|
||||
import { SqlTargetPlatform } from 'sqldbproj';
|
||||
import { launchPublishDatabaseQuickpick } from '../dialogs/publishDatabaseQuickpick';
|
||||
import { SqlTargetPlatform } from 'sqldbproj';
|
||||
|
||||
const maxTableLength = 10;
|
||||
|
||||
@@ -131,7 +131,11 @@ export class ProjectsController {
|
||||
.send();
|
||||
|
||||
if (creationParams.projectGuid && !UUID.isUUID(creationParams.projectGuid)) {
|
||||
throw new Error(`Specified GUID is invalid: '${creationParams.projectGuid}'`);
|
||||
throw new Error(constants.invalidGuid(creationParams.projectGuid));
|
||||
}
|
||||
|
||||
if (creationParams.targetPlatform && !constants.targetPlatformToVersion.get(creationParams.targetPlatform)) {
|
||||
throw new Error(constants.invalidTargetPlatform(creationParams.targetPlatform, Array.from(constants.targetPlatformToVersion.keys())));
|
||||
}
|
||||
|
||||
const macroDict: Record<string, string> = {
|
||||
|
||||
@@ -39,7 +39,9 @@ export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvide
|
||||
projectFileExtension: constants.sqlprojExtension.replace(/\./g, ''),
|
||||
displayName: constants.emptyProjectTypeDisplayName,
|
||||
description: constants.emptyProjectTypeDescription,
|
||||
icon: IconPathHelper.colorfulSqlProject
|
||||
icon: IconPathHelper.colorfulSqlProject,
|
||||
targetPlatforms: Array.from(constants.targetPlatformToVersion.keys()),
|
||||
defaultTargetPlatform: constants.defaultTargetPlatform
|
||||
},
|
||||
{
|
||||
id: constants.edgeSqlDatabaseProjectTypeId,
|
||||
|
||||
Reference in New Issue
Block a user