mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 01:25:36 -05:00
Add ability to create publish profile from project context (#23110)
* Ability to add publish profile from project context * Add/update test + fix Build vs None addition to sqlproj file
This commit is contained in:
@@ -246,6 +246,9 @@ export class ProjectsController {
|
||||
case ItemType.postDeployScript:
|
||||
await project.addPostDeploymentScript(relativePath);
|
||||
break;
|
||||
case ItemType.publishProfile:
|
||||
await project.addNoneItem(relativePath);
|
||||
break;
|
||||
default: // a normal SQL object script
|
||||
await project.addSqlObjectScript(relativePath);
|
||||
break;
|
||||
@@ -729,7 +732,10 @@ export class ProjectsController {
|
||||
|
||||
const itemType = templates.get(itemTypeName);
|
||||
const absolutePathToParent = path.join(project.projectFolderPath, relativePath);
|
||||
let itemObjectName = await this.promptForNewObjectName(itemType, project, absolutePathToParent, constants.sqlFileExtension, options?.defaultName);
|
||||
const isItemTypePublishProfile = itemTypeName === constants.publishProfileFriendlyName || itemTypeName === ItemType.publishProfile;
|
||||
const fileExtension = isItemTypePublishProfile ? constants.publishProfileExtension : constants.sqlFileExtension;
|
||||
const defaultName = isItemTypePublishProfile ? `${project.projectFileName}_` : options?.defaultName;
|
||||
let itemObjectName = await this.promptForNewObjectName(itemType, project, absolutePathToParent, fileExtension, defaultName);
|
||||
|
||||
itemObjectName = itemObjectName?.trim();
|
||||
|
||||
@@ -737,7 +743,7 @@ export class ProjectsController {
|
||||
return; // user cancelled
|
||||
}
|
||||
|
||||
const relativeFilePath = path.join(relativePath, itemObjectName + constants.sqlFileExtension);
|
||||
const relativeFilePath = path.join(relativePath, itemObjectName + fileExtension);
|
||||
|
||||
const telemetryProps: Record<string, string> = { itemType: itemType.type };
|
||||
const telemetryMeasurements: Record<string, number> = {};
|
||||
@@ -749,7 +755,7 @@ export class ProjectsController {
|
||||
}
|
||||
|
||||
try {
|
||||
const absolutePath = await this.addFileToProjectFromTemplate(project, itemType, relativeFilePath, new Map([['OBJECT_NAME', itemObjectName]]));
|
||||
const absolutePath = await this.addFileToProjectFromTemplate(project, itemType, relativeFilePath, new Map([['OBJECT_NAME', itemObjectName], ['PROJECT_NAME', project.projectFileName]]));
|
||||
|
||||
TelemetryReporter.createActionEvent(TelemetryViews.ProjectTree, TelemetryActions.addItemFromTree)
|
||||
.withAdditionalProperties(telemetryProps)
|
||||
|
||||
Reference in New Issue
Block a user