Add launchPublishToDockerContainerQuickpick to extension API (#19834)

* Initial

* remove namespace

* minor fixes
This commit is contained in:
Charles Gagnon
2022-06-27 15:29:43 -07:00
committed by GitHub
parent 5cda676016
commit 5b95a47ca6
21 changed files with 116 additions and 112 deletions

View File

@@ -7,14 +7,14 @@ import * as vscode from 'vscode';
import * as constants from '../common/constants';
import * as utils from '../common/utils';
import * as uiUtils from './utils';
import { AppSettingType, DockerImageInfo, IDeployAppIntegrationProfile, ISqlDbDeployProfile, ILocalDbDeployProfile, ILocalDbSetting } from '../models/deploy/deployProfile';
import { AppSettingType, DockerImageInfo, IDeployAppIntegrationProfile, ISqlDbDeployProfile } from '../models/deploy/deployProfile';
import { Project } from '../models/project';
import { getPublishDatabaseSettings } from './publishDatabaseQuickpick';
import * as path from 'path';
import * as fse from 'fs-extra';
import { AzureSqlClient } from '../models/deploy/azureSqlClient';
import { IDeploySettings } from '../models/IDeploySettings';
import { IAccount } from 'vscode-mssql';
import { IDeploySettings, ILocalDbSetting, IPublishToDockerSettings, ISqlProject } from 'sqldbproj';
/**
* Create flow for Deploying a database using only VS Code-native APIs such as QuickPick
@@ -256,7 +256,8 @@ export async function launchCreateAzureServerQuickPick(project: Project, azureSq
return {
// TODO add tenant
deploySettings: settings, sqlDbSetting: {
deploySettings: settings,
sqlDbSetting: {
tenantId: session.tenantId,
accountId: session.account.key.id,
serverName: serverName,
@@ -272,9 +273,9 @@ export async function launchCreateAzureServerQuickPick(project: Project, azureSq
}
/**
* Create flow for publishing a database to docker container using only VS Code-native APIs such as QuickPick
* Gets the settings for publishing a database to docker container using only VS Code-native APIs such as QuickPick
*/
export async function launchPublishToDockerContainerQuickpick(project: Project): Promise<ILocalDbDeployProfile | undefined> {
export async function getPublishToDockerSettings(project: ISqlProject): Promise<IPublishToDockerSettings | undefined> {
const target = project.getProjectTargetVersion();
const name = uiUtils.getPublishServerName(target);
let localDbSetting: ILocalDbSetting | undefined;

View File

@@ -10,15 +10,14 @@ import * as utils from '../common/utils';
import { Project } from '../models/project';
import { SqlConnectionDataSource } from '../models/dataSources/sqlConnectionStringSource';
import { IDeploySettings } from '../models/IDeploySettings';
import { DeploymentOptions } from 'mssql';
import { IconPathHelper } from '../common/iconHelper';
import { cssStyles } from '../common/uiConstants';
import { getAgreementDisplayText, getConnectionName, getDockerBaseImages, getPublishServerName } from './utils';
import { TelemetryActions, TelemetryReporter, TelemetryViews } from '../common/telemetry';
import { ILocalDbDeployProfile } from '../models/deploy/deployProfile';
import { Deferred } from '../common/promise';
import { PublishOptionsDialog } from './publishOptionsDialog';
import { IDeploySettings, IPublishToDockerSettings } from 'sqldbproj';
interface DataSourceDropdownValue extends azdataType.CategoryValue {
dataSource: SqlConnectionDataSource;
@@ -65,7 +64,7 @@ export class PublishDatabaseDialog {
private toDispose: vscode.Disposable[] = [];
public publish: ((proj: Project, profile: IDeploySettings) => any) | undefined;
public publishToContainer: ((proj: Project, profile: ILocalDbDeployProfile) => any) | undefined;
public publishToContainer: ((proj: Project, profile: IPublishToDockerSettings) => any) | undefined;
public generateScript: ((proj: Project, profile: IDeploySettings) => any) | undefined;
public readPublishProfile: ((profileUri: vscode.Uri) => any) | undefined;
@@ -240,7 +239,7 @@ export class PublishDatabaseDialog {
const dockerBaseImage = this.getBaseDockerImageName();
const baseImages = getDockerBaseImages(this.project.getProjectTargetVersion());
const imageInfo = baseImages.find(x => x.name === dockerBaseImage);
const settings: ILocalDbDeployProfile = {
const settings: IPublishToDockerSettings = {
localDbSetting: {
dbName: this.targetDatabaseName,
dockerBaseImage: dockerBaseImage,

View File

@@ -10,14 +10,13 @@ import { PublishProfile, readPublishProfile } from '../models/publishProfile/pub
import { promptForPublishProfile } from './publishDatabaseDialog';
import { getDefaultPublishDeploymentOptions, getVscodeMssqlApi } from '../common/utils';
import { IConnectionInfo, IFireWallRuleError } from 'vscode-mssql';
import { IDeploySettings } from '../models/IDeploySettings';
import { getPublishServerName } from './utils';
import { SqlTargetPlatform } from 'sqldbproj';
import { IDeploySettings, ISqlProject, SqlTargetPlatform } from 'sqldbproj';
/**
* Create flow for Publishing a database using only VS Code-native APIs such as QuickPick
*/
export async function getPublishDatabaseSettings(project: Project, promptForConnection: boolean = true): Promise<IDeploySettings | undefined> {
export async function getPublishDatabaseSettings(project: ISqlProject, promptForConnection: boolean = true): Promise<IDeploySettings | undefined> {
// 1. Select publish settings file (optional)
// Create custom quickpick so we can control stuff like displaying the loading indicator