diff --git a/extensions/dacpac/src/wizard/api/models.ts b/extensions/dacpac/src/wizard/api/models.ts index ddad104b02..5ceec2fd80 100644 --- a/extensions/dacpac/src/wizard/api/models.ts +++ b/extensions/dacpac/src/wizard/api/models.ts @@ -17,6 +17,4 @@ export interface DacFxDataModel { filePath: string; version: string; upgradeExisting: boolean; - scriptFilePath: string; - generateScriptAndDeploy: boolean; } diff --git a/extensions/dacpac/src/wizard/dataTierApplicationWizard.ts b/extensions/dacpac/src/wizard/dataTierApplicationWizard.ts index 016af7f4b8..b9c933b884 100644 --- a/extensions/dacpac/src/wizard/dataTierApplicationWizard.ts +++ b/extensions/dacpac/src/wizard/dataTierApplicationWizard.ts @@ -9,7 +9,6 @@ import * as azdata from 'azdata'; import { SelectOperationPage } from './pages/selectOperationpage'; import { DeployConfigPage } from './pages/deployConfigPage'; import { DeployPlanPage } from './pages/deployPlanPage'; -import { DeployActionPage } from './pages/deployActionPage'; import { DacFxSummaryPage } from './pages/dacFxSummaryPage'; import { ExportConfigPage } from './pages/exportConfigPage'; import { ExtractConfigPage } from './pages/extractConfigPage'; @@ -40,7 +39,6 @@ export enum DeployOperationPath { selectOperation, deployOptions, deployPlan, - deployAction, summary } @@ -104,7 +102,6 @@ export class DataTierApplicationWizard { let selectOperationWizardPage = azdata.window.createWizardPage(localize('dacFx.selectOperationPageName', 'Select an Operation')); let deployConfigWizardPage = azdata.window.createWizardPage(localize('dacFx.deployConfigPageName', 'Select Deploy Dacpac Settings')); let deployPlanWizardPage = azdata.window.createWizardPage(localize('dacFx.deployPlanPage', 'Review the deploy plan')); - let deployActionWizardPage = azdata.window.createWizardPage(localize('dacFx.deployActionPageName', 'Select Action')); let summaryWizardPage = azdata.window.createWizardPage(localize('dacFx.summaryPageName', 'Summary')); let extractConfigWizardPage = azdata.window.createWizardPage(localize('dacFx.extractConfigPageName', 'Select Extract Dacpac Settings')); let importConfigWizardPage = azdata.window.createWizardPage(localize('dacFx.importConfigPageName', 'Select Import Bacpac Settings')); @@ -113,7 +110,6 @@ export class DataTierApplicationWizard { this.pages.set('selectOperation', new Page(selectOperationWizardPage)); this.pages.set('deployConfig', new Page(deployConfigWizardPage)); this.pages.set('deployPlan', new Page(deployPlanWizardPage)); - this.pages.set('deployAction', new Page(deployActionWizardPage)); this.pages.set('extractConfig', new Page(extractConfigWizardPage)); this.pages.set('importConfig', new Page(importConfigWizardPage)); this.pages.set('exportConfig', new Page(exportConfigWizardPage)); @@ -140,12 +136,6 @@ export class DataTierApplicationWizard { await deployPlanDacFxPage.start(); }); - deployActionWizardPage.registerContent(async (view) => { - let deployActionDacFxPage = new DeployActionPage(this, deployActionWizardPage, this.model, view); - this.pages.get('deployAction').dacFxPage = deployActionDacFxPage; - await deployActionDacFxPage.start(); - }); - extractConfigWizardPage.registerContent(async (view) => { let extractConfigDacFxPage = new ExtractConfigPage(this, extractConfigWizardPage, this.model, view); this.pages.get('extractConfig').dacFxPage = extractConfigDacFxPage; @@ -190,7 +180,7 @@ export class DataTierApplicationWizard { } }); - this.wizard.pages = [selectOperationWizardPage, deployConfigWizardPage, deployPlanWizardPage, deployActionWizardPage, summaryWizardPage]; + this.wizard.pages = [selectOperationWizardPage, deployConfigWizardPage, deployPlanWizardPage, summaryWizardPage]; this.wizard.generateScriptButton.hidden = true; this.wizard.generateScriptButton.onClick(async () => await this.generateDeployScript()); this.wizard.doneButton.onClick(async () => await this.executeOperation()); @@ -306,19 +296,15 @@ export class DataTierApplicationWizard { } private async generateDeployScript() { - if (!this.model.scriptFilePath) { - return; - } - let service = await DataTierApplicationWizard.getService(this.model.server.providerName); let ownerUri = await azdata.connection.getUriForConnection(this.model.server.connectionId); this.wizard.message = { - text: localize('dacfx.scriptGeneratingMessage', 'You can view the status of script generation in the Task History once the wizard is closed'), + text: localize('dacfx.scriptGeneratingMessage', 'You can view the status of script generation in the Tasks View once the wizard is closed. The generated script will open when complete.'), level: azdata.window.MessageLevel.Information, description: '' }; - let result = await service.generateDeployScript(this.model.filePath, this.model.database, this.model.scriptFilePath, ownerUri, azdata.TaskExecutionMode.execute); + let result = await service.generateDeployScript(this.model.filePath, this.model.database, ownerUri, azdata.TaskExecutionMode.script); if (!result || !result.success) { vscode.window.showErrorMessage( localize('alertData.deployErrorMessage', "Deploy failed '{0}'", result.errorMessage ? result.errorMessage : 'Unknown')); @@ -351,8 +337,6 @@ export class DataTierApplicationWizard { page = this.pages.get('summary'); } else if ((this.selectedOperation === Operation.deploy || this.selectedOperation === Operation.generateDeployScript) && idx === DeployOperationPath.deployPlan) { page = this.pages.get('deployPlan'); - } else if ((this.selectedOperation === Operation.deploy || this.selectedOperation === Operation.generateDeployScript) && idx === DeployOperationPath.deployAction) { - page = this.pages.get('deployAction'); } return page; diff --git a/extensions/dacpac/src/wizard/pages/dacFxSummaryPage.ts b/extensions/dacpac/src/wizard/pages/dacFxSummaryPage.ts index 4aa686c457..931e29b0c9 100644 --- a/extensions/dacpac/src/wizard/pages/dacFxSummaryPage.ts +++ b/extensions/dacpac/src/wizard/pages/dacFxSummaryPage.ts @@ -49,7 +49,7 @@ export class DacFxSummaryPage extends BasePage { async onPageEnter(): Promise { this.populateTable(); this.loader.loading = false; - if (this.model.upgradeExisting && this.model.generateScriptAndDeploy) { + if (this.model.upgradeExisting && this.instance.selectedOperation === Operation.deploy) { this.instance.wizard.generateScriptButton.hidden = false; } return true; @@ -76,10 +76,6 @@ export class DacFxSummaryPage extends BasePage { let sourceServer = localize('dacfx.sourceServerName', 'Source Server'); let sourceDatabase = localize('dacfx.sourceDatabaseName', 'Source Database'); let fileLocation = localize('dacfx.fileLocation', 'File Location'); - let scriptLocation = localize('dacfx.scriptLocation', 'Deployment Script Location'); - let action = localize('dacfx.action', 'Action'); - let deploy = localize('dacfx.deploy', 'Deploy'); - let generateScript = localize('dacfx.generateScript', 'Generate Deployment Script'); switch (this.instance.selectedOperation) { case Operation.deploy: { @@ -87,13 +83,6 @@ export class DacFxSummaryPage extends BasePage { [targetServer, this.model.serverName], [fileLocation, this.model.filePath], [targetDatabase, this.model.database]]; - if (this.model.generateScriptAndDeploy) { - data[3] = [scriptLocation, this.model.scriptFilePath]; - data[4] = [action, generateScript + ', ' + deploy]; - } - else { - data[3] = [action, deploy]; - } break; } case Operation.extract: { @@ -122,9 +111,7 @@ export class DacFxSummaryPage extends BasePage { data = [ [targetServer, this.model.serverName], [fileLocation, this.model.filePath], - [targetDatabase, this.model.database], - [scriptLocation, this.model.scriptFilePath], - [action, generateScript]]; + [targetDatabase, this.model.database]]; break; } } diff --git a/extensions/dacpac/src/wizard/pages/deployActionPage.ts b/extensions/dacpac/src/wizard/pages/deployActionPage.ts deleted file mode 100644 index 6f62ab63d3..0000000000 --- a/extensions/dacpac/src/wizard/pages/deployActionPage.ts +++ /dev/null @@ -1,179 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -'use strict'; -import * as azdata from 'azdata'; -import * as nls from 'vscode-nls'; -import * as vscode from 'vscode'; -import * as path from 'path'; -import { DacFxDataModel } from '../api/models'; -import { DataTierApplicationWizard, Operation } from '../dataTierApplicationWizard'; -import { DacFxConfigPage } from '../api/dacFxConfigPage'; -import { sanitizeStringForFilename } from '../api/utils'; - -const localize = nls.loadMessageBundle(); - -export class DeployActionPage extends DacFxConfigPage { - - protected readonly wizardPage: azdata.window.WizardPage; - protected readonly instance: DataTierApplicationWizard; - protected readonly model: DacFxDataModel; - protected readonly view: azdata.ModelView; - private deployRadioButton: azdata.RadioButtonComponent; - private deployScriptRadioButton: azdata.RadioButtonComponent; - private scriptRadioButton: azdata.RadioButtonComponent; - private form: azdata.FormContainer; - - public constructor(instance: DataTierApplicationWizard, wizardPage: azdata.window.WizardPage, model: DacFxDataModel, view: azdata.ModelView) { - super(instance, wizardPage, model, view); - } - - async start(): Promise { - let deployComponent = await this.createDeployRadioButton(); - let deployScriptComponent = await this.createDeployScriptRadioButton(); - let scriptComponent = await this.createScriptRadioButton(); - let fileBrowserComponent = await this.createFileBrowser(); - - this.form = this.view.modelBuilder.formContainer() - .withFormItems( - [ - deployComponent, - scriptComponent, - deployScriptComponent, - fileBrowserComponent - ]).component(); - await this.view.initializeModel(this.form); - - //default have the first radio button checked - this.deployRadioButton.checked = true; - this.toggleFileBrowser(false); - - return true; - } - - async onPageEnter(): Promise { - // generate script file path in case the database changed since last time the page was entered - this.setDefaultScriptFilePath(); - return true; - } - - private async createDeployRadioButton(): Promise { - this.deployRadioButton = this.view.modelBuilder.radioButton() - .withProperties({ - name: 'selectedDeployAction', - label: localize('dacFx.deployRadioButtonLabel', 'Deploy'), - }).component(); - - this.deployRadioButton.onDidClick(() => { - this.model.generateScriptAndDeploy = false; - this.instance.setDoneButton(Operation.deploy); - this.toggleFileBrowser(false); - }); - - return { - component: this.deployRadioButton, - title: '' - }; - } - - private async createDeployScriptRadioButton(): Promise { - this.deployScriptRadioButton = this.view.modelBuilder.radioButton() - .withProperties({ - name: 'selectedDeployAction', - label: localize('dacFx.deployScriptRadioButtonLabel', 'Generate Deployment Script and Deploy'), - }).component(); - - this.deployScriptRadioButton.onDidClick(() => { - this.model.generateScriptAndDeploy = true; - this.instance.setDoneButton(Operation.deploy); - this.toggleFileBrowser(true); - }); - - return { - component: this.deployScriptRadioButton, - title: '' - }; - } - - private async createScriptRadioButton(): Promise { - this.scriptRadioButton = this.view.modelBuilder.radioButton() - .withProperties({ - name: 'selectedDeployAction', - label: localize('dacFx.scriptRadioButtonLabel', 'Generate Deployment Script'), - }).component(); - - this.scriptRadioButton.onDidClick(() => { - this.model.generateScriptAndDeploy = false; - this.toggleFileBrowser(true); - - //change button text and operation - this.instance.setDoneButton(Operation.generateDeployScript); - }); - - return { - component: this.scriptRadioButton, - title: '' - }; - } - - private async createFileBrowser(): Promise { - this.createFileBrowserParts(); - - //default filepath - this.setDefaultScriptFilePath(); - this.fileButton.onDidClick(async (click) => { - let fileUri = await vscode.window.showSaveDialog( - { - defaultUri: vscode.Uri.file(this.fileTextBox.value), - saveLabel: localize('dacfxDeployScript.saveFile', 'Save'), - filters: { - 'SQL Files': ['sql'], - } - } - ); - - if (!fileUri) { - return; - } - - this.fileTextBox.value = fileUri.fsPath; - this.model.scriptFilePath = fileUri.fsPath; - }); - - this.fileTextBox.onTextChanged(async () => { - this.model.scriptFilePath = this.fileTextBox.value; - }); - - return { - title: '', - components: [ - { - title: localize('dacfx.generatedScriptLocation', 'Deployment Script Location'), - component: this.fileTextBox, - layout: { - horizontal: true, - componentWidth: 400 - }, - actions: [this.fileButton] - },], - }; - } - - private toggleFileBrowser(enable: boolean): void { - this.fileTextBox.enabled = enable; - this.fileButton.enabled = enable; - } - - private setDefaultScriptFilePath(): void { - this.fileTextBox.value = path.join(this.getRootPath(), sanitizeStringForFilename(this.model.database) + '_UpgradeDACScript_' + this.getDateTime() + '.sql'); - this.model.scriptFilePath = this.fileTextBox.value; - } - - public setupNavigationValidator() { - this.instance.registerNavigationValidator(() => { - return true; - }); - } -} diff --git a/extensions/dacpac/src/wizard/pages/deployConfigPage.ts b/extensions/dacpac/src/wizard/pages/deployConfigPage.ts index 535dc5d360..562a3cba93 100644 --- a/extensions/dacpac/src/wizard/pages/deployConfigPage.ts +++ b/extensions/dacpac/src/wizard/pages/deployConfigPage.ts @@ -123,11 +123,9 @@ export class DeployConfigPage extends DacFxConfigPage { this.formBuilder.addFormItem(this.databaseDropdownComponent, { horizontal: true, componentWidth: 400 }); this.model.database = (this.databaseDropdown.value).name; - // add deploy plan and generate script pages + // add deploy plan page let deployPlanPage = this.instance.pages.get('deployPlan'); this.instance.wizard.addPage(deployPlanPage.wizardPage, DeployOperationPath.deployPlan); - let deployActionPage = this.instance.pages.get('deployAction'); - this.instance.wizard.addPage(deployActionPage.wizardPage, DeployOperationPath.deployAction); }); newRadioButton.onDidClick(() => { @@ -137,8 +135,7 @@ export class DeployConfigPage extends DacFxConfigPage { this.model.database = this.databaseTextBox.value; this.instance.setDoneButton(Operation.deploy); - // remove deploy plan and generate script pages - this.instance.wizard.removePage(DeployOperationPath.deployAction); + // remove deploy plan page this.instance.wizard.removePage(DeployOperationPath.deployPlan); }); diff --git a/extensions/dacpac/src/wizard/pages/selectOperationpage.ts b/extensions/dacpac/src/wizard/pages/selectOperationpage.ts index 28090b0507..2a93247b05 100644 --- a/extensions/dacpac/src/wizard/pages/selectOperationpage.ts +++ b/extensions/dacpac/src/wizard/pages/selectOperationpage.ts @@ -76,8 +76,6 @@ export class SelectOperationPage extends BasePage { this.instance.wizard.addPage(configPage.wizardPage, DeployOperationPath.deployOptions); let deployPlanPage = this.instance.pages.get('deployPlan'); this.instance.wizard.addPage(deployPlanPage.wizardPage, DeployOperationPath.deployPlan); - let actionPage = this.instance.pages.get('deployAction'); - this.instance.wizard.addPage(actionPage.wizardPage, DeployOperationPath.deployAction); this.addSummaryPage(DeployOperationPath.summary); // change button text and operation diff --git a/extensions/mssql/src/config.json b/extensions/mssql/src/config.json index 6bc329c4bd..ecbd3a09f4 100644 --- a/extensions/mssql/src/config.json +++ b/extensions/mssql/src/config.json @@ -1,6 +1,6 @@ { "downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}", - "version": "1.5.0-alpha.99", + "version": "1.5.0-alpha.100", "downloadFileNames": { "Windows_86": "win-x86-netcoreapp2.2.zip", "Windows_64": "win-x64-netcoreapp2.2.zip", diff --git a/extensions/mssql/src/contracts.ts b/extensions/mssql/src/contracts.ts index 8126d7af20..8ff3abc845 100644 --- a/extensions/mssql/src/contracts.ts +++ b/extensions/mssql/src/contracts.ts @@ -335,7 +335,6 @@ export interface DeployParams { export interface GenerateDeployScriptParams { packageFilePath: string; databaseName: string; - scriptFilePath: string; ownerUri: string; taskExecutionMode: TaskExecutionMode; } diff --git a/extensions/mssql/src/features.ts b/extensions/mssql/src/features.ts index 3a14e0ce46..b584fa3a49 100644 --- a/extensions/mssql/src/features.ts +++ b/extensions/mssql/src/features.ts @@ -104,8 +104,8 @@ export class DacFxServicesFeature extends SqlOpsFeature { ); }; - let generateDeployScript = (packageFilePath: string, targetDatabaseName: string, scriptFilePath: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable => { - let params: contracts.GenerateDeployScriptParams = { packageFilePath: packageFilePath, databaseName: targetDatabaseName, scriptFilePath: scriptFilePath, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode }; + let generateDeployScript = (packageFilePath: string, targetDatabaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable => { + let params: contracts.GenerateDeployScriptParams = { packageFilePath: packageFilePath, databaseName: targetDatabaseName, ownerUri: ownerUri, taskExecutionMode: taskExecutionMode }; return client.sendRequest(contracts.GenerateDeployScriptRequest.type, params).then( r => { return r; diff --git a/src/sql/azdata.proposed.d.ts b/src/sql/azdata.proposed.d.ts index 264c41ed49..dce2084038 100644 --- a/src/sql/azdata.proposed.d.ts +++ b/src/sql/azdata.proposed.d.ts @@ -1691,7 +1691,6 @@ declare module 'azdata' { export interface GenerateDeployScriptParams { packageFilePath: string; databaseName: string; - scriptFilePath: string; ownerUri: string; taskExecutionMode: TaskExecutionMode; } @@ -1708,7 +1707,7 @@ declare module 'azdata' { importBacpac(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable; extractDacpac(databaseName: string, packageFilePath: string, applicationName: string, applicationVersion: string, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable; deployDacpac(packageFilePath: string, databaseName: string, upgradeExisting: boolean, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable; - generateDeployScript(packageFilePath: string, databaseName: string, scriptFilePath: string, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable; + generateDeployScript(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable; generateDeployPlan(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: TaskExecutionMode): Thenable; } diff --git a/src/sql/platform/dacfx/common/dacFxService.ts b/src/sql/platform/dacfx/common/dacFxService.ts index 446e91ddcf..a8cefd5378 100644 --- a/src/sql/platform/dacfx/common/dacFxService.ts +++ b/src/sql/platform/dacfx/common/dacFxService.ts @@ -19,7 +19,7 @@ export interface IDacFxService { importBacpac(packageFilePath: string, targetDatabaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): void; extractDacpac(sourceDatabaseName: string, packageFilePath: string, applicationName: string, applicationVersion: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): void; deployDacpac(packageFilePath: string, targetDatabaseName: string, upgradeExisting: boolean, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): void; - generateDeployScript(packageFilePath: string, targetDatabaseName: string, scriptFilePath: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): void; + generateDeployScript(packageFilePath: string, targetDatabaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): void; generateDeployPlan(packageFilePath: string, targetDatabaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): void; } @@ -60,9 +60,9 @@ export class DacFxService implements IDacFxService { }); } - generateDeployScript(packageFilePath: string, databaseName: string, generateDeployScript: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable { + generateDeployScript(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable { return this._runAction(ownerUri, (runner) => { - return runner.generateDeployScript(packageFilePath, databaseName, generateDeployScript, ownerUri, taskExecutionMode); + return runner.generateDeployScript(packageFilePath, databaseName, ownerUri, taskExecutionMode); }); } diff --git a/src/sql/workbench/api/browser/mainThreadDataProtocol.ts b/src/sql/workbench/api/browser/mainThreadDataProtocol.ts index 404b14975d..d9abc1d4ed 100644 --- a/src/sql/workbench/api/browser/mainThreadDataProtocol.ts +++ b/src/sql/workbench/api/browser/mainThreadDataProtocol.ts @@ -456,8 +456,8 @@ export class MainThreadDataProtocol implements MainThreadDataProtocolShape { deployDacpac(packageFilePath: string, databaseName: string, upgradeExisting: boolean, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable { return self._proxy.$deployDacpac(handle, packageFilePath, databaseName, upgradeExisting, ownerUri, taskExecutionMode); }, - generateDeployScript(packageFilePath: string, databaseName: string, scriptFilePath: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable { - return self._proxy.$generateDeployScript(handle, packageFilePath, databaseName, scriptFilePath, ownerUri, taskExecutionMode); + generateDeployScript(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable { + return self._proxy.$generateDeployScript(handle, packageFilePath, databaseName, ownerUri, taskExecutionMode); }, generateDeployPlan(packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable { return self._proxy.$generateDeployPlan(handle, packageFilePath, databaseName, ownerUri, taskExecutionMode); diff --git a/src/sql/workbench/api/node/sqlExtHost.protocol.ts b/src/sql/workbench/api/node/sqlExtHost.protocol.ts index 7ba79d456b..6bce817b3b 100644 --- a/src/sql/workbench/api/node/sqlExtHost.protocol.ts +++ b/src/sql/workbench/api/node/sqlExtHost.protocol.ts @@ -455,7 +455,7 @@ export abstract class ExtHostDataProtocolShape { /** * DacFx generate deploy script */ - $generateDeployScript(handle: number, packageFilePath: string, databaseName: string, scriptFilePath: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable { throw ni(); } + $generateDeployScript(handle: number, packageFilePath: string, databaseName: string, ownerUri: string, taskExecutionMode: azdata.TaskExecutionMode): Thenable { throw ni(); } /** * DacFx generate deploy plan