mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -05:00
SQL Database Project - Deploy db to docker (#16406)
Added a new command to deploy the project to docker
This commit is contained in:
@@ -35,6 +35,8 @@ import { TelemetryActions, TelemetryReporter, TelemetryViews } from '../common/t
|
||||
import { IconPathHelper } from '../common/iconHelper';
|
||||
import { DashboardData, PublishData, Status } from '../models/dashboardData/dashboardData';
|
||||
import { launchPublishDatabaseQuickpick } from '../dialogs/publishDatabaseQuickpick';
|
||||
import { launchDeployDatabaseQuickpick } from '../dialogs/deployDatabaseQuickpick';
|
||||
import { DeployService } from '../models/deploy/deployService';
|
||||
import { SqlTargetPlatform } from 'sqldbproj';
|
||||
import { createNewProjectFromDatabaseWithQuickpick } from '../dialogs/createProjectFromDatabaseQuickpick';
|
||||
import { addDatabaseReferenceQuickpick } from '../dialogs/addDatabaseReferenceQuickpick';
|
||||
@@ -64,12 +66,14 @@ export class ProjectsController {
|
||||
private buildHelper: BuildHelper;
|
||||
private buildInfo: DashboardData[] = [];
|
||||
private publishInfo: PublishData[] = [];
|
||||
private deployService: DeployService;
|
||||
|
||||
projFileWatchers = new Map<string, vscode.FileSystemWatcher>();
|
||||
|
||||
constructor() {
|
||||
this.netCoreTool = new NetCoreTool();
|
||||
constructor(outputChannel: vscode.OutputChannel) {
|
||||
this.netCoreTool = new NetCoreTool(outputChannel);
|
||||
this.buildHelper = new BuildHelper();
|
||||
this.deployService = new DeployService(outputChannel);
|
||||
}
|
||||
|
||||
public getDashboardPublishData(projectFile: string): (string | dataworkspace.IconCellValue)[][] {
|
||||
@@ -251,6 +255,46 @@ export class ProjectsController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deploys a project
|
||||
* @param treeNode a treeItem in a project's hierarchy, to be used to obtain a Project
|
||||
*/
|
||||
public async deployProject(context: Project | dataworkspace.WorkspaceTreeItem): Promise<void> {
|
||||
const project: Project = this.getProjectFromContext(context);
|
||||
try {
|
||||
let deployProfile = await launchDeployDatabaseQuickpick(project);
|
||||
if (deployProfile && deployProfile.deploySettings) {
|
||||
let connectionUri: string | undefined;
|
||||
if (deployProfile.localDbSetting) {
|
||||
connectionUri = await this.deployService.deploy(deployProfile, project);
|
||||
if (connectionUri) {
|
||||
deployProfile.deploySettings.connectionUri = connectionUri;
|
||||
}
|
||||
}
|
||||
if (deployProfile.deploySettings.connectionUri) {
|
||||
const publishResult = await this.publishOrScriptProject(project, deployProfile.deploySettings, true);
|
||||
if (publishResult && publishResult.success) {
|
||||
|
||||
// Update app settings if requested by user
|
||||
//
|
||||
await this.deployService.updateAppSettings(deployProfile);
|
||||
if (deployProfile.localDbSetting) {
|
||||
await this.deployService.getConnection(deployProfile.localDbSetting, true, deployProfile.localDbSetting.dbName);
|
||||
}
|
||||
vscode.window.showInformationMessage(constants.deployProjectSucceed);
|
||||
} else {
|
||||
vscode.window.showErrorMessage(constants.deployProjectFailed(publishResult?.errorMessage || ''));
|
||||
}
|
||||
} else {
|
||||
vscode.window.showErrorMessage(constants.deployProjectFailed(constants.deployProjectFailedMessage));
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
vscode.window.showErrorMessage(constants.deployProjectFailed(utils.getErrorMessage(error)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds and publishes a project
|
||||
* @param treeNode a treeItem in a project's hierarchy, to be used to obtain a Project
|
||||
|
||||
Reference in New Issue
Block a user