mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add SDK sql project template (#18058)
* add sdk style project template * update description and order * update template * update template and add link * remove ToolsVersion and xmlns from project node * update template name to SQL Database (SDK)
This commit is contained in:
10
extensions/data-workspace/src/dataworkspace.d.ts
vendored
10
extensions/data-workspace/src/dataworkspace.d.ts
vendored
@@ -129,6 +129,16 @@ declare module 'dataworkspace' {
|
|||||||
* Gets the default target platform
|
* Gets the default target platform
|
||||||
*/
|
*/
|
||||||
readonly defaultTargetPlatform?: string;
|
readonly defaultTargetPlatform?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Link display value for a link at the end of the project description. linkLocation also needs to be set to use this
|
||||||
|
*/
|
||||||
|
readonly linkDisplayValue?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Location where clicking on the linkDisplayValue will go to
|
||||||
|
*/
|
||||||
|
readonly linkLocation?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -122,21 +122,30 @@ export class NewProjectDialog extends DialogBase {
|
|||||||
'font-weight': 'bold'
|
'font-weight': 'bold'
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
textValue: projectType.description
|
textValue: projectType.description,
|
||||||
|
linkDisplayValue: projectType.linkDisplayValue
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
iconHeight: '75px',
|
iconHeight: '75px',
|
||||||
iconWidth: '75px',
|
iconWidth: '75px',
|
||||||
cardWidth: '170px',
|
cardWidth: '215px',
|
||||||
cardHeight: '170px',
|
cardHeight: '195px',
|
||||||
ariaLabel: constants.TypeTitle,
|
ariaLabel: constants.TypeTitle,
|
||||||
width: '500px',
|
width: '500px',
|
||||||
iconPosition: 'top',
|
iconPosition: 'top',
|
||||||
selectedCardId: allProjectTypes.length > 0 ? allProjectTypes[0].id : undefined
|
selectedCardId: allProjectTypes.length > 0 ? allProjectTypes[0].id : undefined
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
|
projectTypeRadioCardGroup.onLinkClick(async (value) => {
|
||||||
|
for (let projectType of allProjectTypes) {
|
||||||
|
if (value.cardId === projectType.id) {
|
||||||
|
void vscode.env.openExternal(vscode.Uri.parse(projectType.linkLocation!));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.register(projectTypeRadioCardGroup.onSelectionChanged((e) => {
|
this.register(projectTypeRadioCardGroup.onSelectionChanged((e) => {
|
||||||
this.model.projectTypeId = e.cardId;
|
this.model.projectTypeId = e.cardId;
|
||||||
const selectedProject = allProjectTypes.find(p => p.id === e.cardId);
|
const selectedProject = allProjectTypes.find(p => p.id === e.cardId);
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build">
|
||||||
|
<Sdk Name="Microsoft.Build.Sql" Version="0.1.1-alpha" />
|
||||||
|
<PropertyGroup>
|
||||||
|
<Name>@@PROJECT_NAME@@</Name>
|
||||||
|
<ProjectGuid>{@@PROJECT_GUID@@}</ProjectGuid>
|
||||||
|
<DSP>Microsoft.Data.Tools.Schema.Sql.Sql@@PROJECT_DSP@@DatabaseSchemaProvider</DSP>
|
||||||
|
<ModelCollation>1033, CI</ModelCollation>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
<Delete Files="$(BaseIntermediateOutputPath)\project.assets.json" />
|
||||||
|
</Target>
|
||||||
|
</Project>
|
||||||
@@ -32,6 +32,10 @@ export const edgeSqlDatabaseProjectTypeId = 'SqlDbEdgeProj';
|
|||||||
export const edgeProjectTypeDisplayName = localize('edgeProjectTypeDisplayName', "SQL Edge");
|
export const edgeProjectTypeDisplayName = localize('edgeProjectTypeDisplayName', "SQL Edge");
|
||||||
export const edgeProjectTypeDescription = localize('edgeProjectTypeDescription', "Start with the core pieces to develop and publish schemas for SQL Edge");
|
export const edgeProjectTypeDescription = localize('edgeProjectTypeDescription', "Start with the core pieces to develop and publish schemas for SQL Edge");
|
||||||
|
|
||||||
|
export const emptySqlDatabaseSdkProjectTypeId = 'EmptySqlDbSdkProj';
|
||||||
|
export const emptySdkProjectTypeDisplayName = localize('emptySdkProjectTypeDisplayName', "SQL Database (SDK)");
|
||||||
|
export const emptySdkProjectTypeDescription = localize('emptySdkProjectTypeDescription', "Develop and publish schemas for SQL databases with Microsoft.Build.Sql (preview), starting from an empty SDK-style project.");
|
||||||
|
|
||||||
// Dashboard
|
// Dashboard
|
||||||
export const addItemAction = localize('addItemAction', "Add Item");
|
export const addItemAction = localize('addItemAction', "Add Item");
|
||||||
export const schemaCompareAction = localize('schemaCompareAction', "Schema Compare");
|
export const schemaCompareAction = localize('schemaCompareAction', "Schema Compare");
|
||||||
@@ -87,6 +91,7 @@ export const schemaObjectType = localize('schemaObjectType', "Schema/Object Type
|
|||||||
export const defaultProjectNameStarter = localize('defaultProjectNameStarter', "DatabaseProject");
|
export const defaultProjectNameStarter = localize('defaultProjectNameStarter', "DatabaseProject");
|
||||||
export const location = localize('location', "Location");
|
export const location = localize('location', "Location");
|
||||||
export const reloadProject = localize('reloadProject', "Would you like to reload your database project?");
|
export const reloadProject = localize('reloadProject', "Would you like to reload your database project?");
|
||||||
|
export const learnMore = localize('learnMore', "Learn More");
|
||||||
export function newObjectNamePrompt(objectType: string) { return localize('newObjectNamePrompt', 'New {0} name:', objectType); }
|
export function newObjectNamePrompt(objectType: string) { return localize('newObjectNamePrompt', 'New {0} name:', objectType); }
|
||||||
export function deleteConfirmation(toDelete: string) { return localize('deleteConfirmation', "Are you sure you want to delete {0}?", toDelete); }
|
export function deleteConfirmation(toDelete: string) { return localize('deleteConfirmation', "Are you sure you want to delete {0}?", toDelete); }
|
||||||
export function deleteConfirmationContents(toDelete: string) { return localize('deleteConfirmationContents', "Are you sure you want to delete {0} and all of its contents?", toDelete); }
|
export function deleteConfirmationContents(toDelete: string) { return localize('deleteConfirmationContents', "Are you sure you want to delete {0} and all of its contents?", toDelete); }
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ export class ProjectsController {
|
|||||||
'PROJECT_DSP': creationParams.targetPlatform ? constants.targetPlatformToVersion.get(creationParams.targetPlatform)! : constants.defaultDSP
|
'PROJECT_DSP': creationParams.targetPlatform ? constants.targetPlatformToVersion.get(creationParams.targetPlatform)! : constants.defaultDSP
|
||||||
};
|
};
|
||||||
|
|
||||||
let newProjFileContents = templates.macroExpansion(templates.newSqlProjectTemplate, macroDict);
|
let newProjFileContents = creationParams.projectTypeId === constants.emptySqlDatabaseSdkProjectTypeId ? templates.macroExpansion(templates.newSdkSqlProjectTemplate, macroDict) : templates.macroExpansion(templates.newSqlProjectTemplate, macroDict);
|
||||||
|
|
||||||
let newProjFileName = creationParams.newProjName;
|
let newProjFileName = creationParams.newProjName;
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,17 @@ export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvide
|
|||||||
*/
|
*/
|
||||||
get supportedProjectTypes(): dataworkspace.IProjectType[] {
|
get supportedProjectTypes(): dataworkspace.IProjectType[] {
|
||||||
return [{
|
return [{
|
||||||
|
id: constants.emptySqlDatabaseSdkProjectTypeId,
|
||||||
|
projectFileExtension: constants.sqlprojExtension.replace(/\./g, ''),
|
||||||
|
displayName: constants.emptySdkProjectTypeDisplayName,
|
||||||
|
description: constants.emptySdkProjectTypeDescription,
|
||||||
|
icon: IconPathHelper.colorfulSqlProject,
|
||||||
|
targetPlatforms: Array.from(constants.targetPlatformToVersion.keys()),
|
||||||
|
defaultTargetPlatform: constants.defaultTargetPlatform,
|
||||||
|
linkDisplayValue: constants.learnMore,
|
||||||
|
linkLocation: 'https://github.com/microsoft/DacFx/tree/main/src/Microsoft.Build.Sql'
|
||||||
|
},
|
||||||
|
{
|
||||||
id: constants.emptySqlDatabaseProjectTypeId,
|
id: constants.emptySqlDatabaseProjectTypeId,
|
||||||
projectFileExtension: constants.sqlprojExtension.replace(/\./g, ''),
|
projectFileExtension: constants.sqlprojExtension.replace(/\./g, ''),
|
||||||
displayName: constants.emptyProjectTypeDisplayName,
|
displayName: constants.emptyProjectTypeDisplayName,
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import * as constants from '../common/constants';
|
|||||||
import { promises as fs } from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
|
|
||||||
export let newSqlProjectTemplate: string;
|
export let newSqlProjectTemplate: string;
|
||||||
|
export let newSdkSqlProjectTemplate: string;
|
||||||
|
|
||||||
// Object types
|
// Object types
|
||||||
|
|
||||||
@@ -51,6 +52,7 @@ export async function loadTemplates(templateFolderPath: string) {
|
|||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
Promise.resolve(newSqlProjectTemplate = await loadTemplate(templateFolderPath, 'newSqlProjectTemplate.xml')),
|
Promise.resolve(newSqlProjectTemplate = await loadTemplate(templateFolderPath, 'newSqlProjectTemplate.xml')),
|
||||||
|
Promise.resolve(newSdkSqlProjectTemplate = await loadTemplate(templateFolderPath, 'newSdkSqlProjectTemplate.xml')),
|
||||||
loadObjectTypeInfo(script, constants.scriptFriendlyName, templateFolderPath, 'newTsqlScriptTemplate.sql'),
|
loadObjectTypeInfo(script, constants.scriptFriendlyName, templateFolderPath, 'newTsqlScriptTemplate.sql'),
|
||||||
loadObjectTypeInfo(table, constants.tableFriendlyName, templateFolderPath, 'newTsqlTableTemplate.sql'),
|
loadObjectTypeInfo(table, constants.tableFriendlyName, templateFolderPath, 'newTsqlTableTemplate.sql'),
|
||||||
loadObjectTypeInfo(view, constants.viewFriendlyName, templateFolderPath, 'newTsqlViewTemplate.sql'),
|
loadObjectTypeInfo(view, constants.viewFriendlyName, templateFolderPath, 'newTsqlViewTemplate.sql'),
|
||||||
|
|||||||
Reference in New Issue
Block a user