mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -05:00
Add launchPublishToDockerContainerQuickpick to extension API (#19834)
* Initial * remove namespace * minor fixes
This commit is contained in:
@@ -15,7 +15,7 @@ import * as vscodeMssql from 'vscode-mssql';
|
||||
import * as fse from 'fs-extra';
|
||||
import * as which from 'which';
|
||||
import { promises as fs } from 'fs';
|
||||
import { Project } from '../models/project';
|
||||
import { ISqlProject } from 'sqldbproj';
|
||||
|
||||
export interface ValidationResult {
|
||||
errorMessage: string;
|
||||
@@ -322,7 +322,7 @@ export async function defaultAzureAccountServiceFactory(): Promise<vscodeMssql.I
|
||||
/*
|
||||
* Returns the default deployment options from DacFx, filtered to appropriate options for the given project.
|
||||
*/
|
||||
export async function getDefaultPublishDeploymentOptions(project: Project): Promise<mssql.DeploymentOptions | vscodeMssql.DeploymentOptions> {
|
||||
export async function getDefaultPublishDeploymentOptions(project: ISqlProject): Promise<mssql.DeploymentOptions | vscodeMssql.DeploymentOptions> {
|
||||
const schemaCompareService = await getSchemaCompareService();
|
||||
const result = await schemaCompareService.schemaCompareGetDefaultOptions();
|
||||
const deploymentOptions = result.defaultDeploymentOptions;
|
||||
|
||||
@@ -16,11 +16,10 @@ import { IconPathHelper } from '../common/iconHelper';
|
||||
import { WorkspaceTreeItem } from 'dataworkspace';
|
||||
import * as constants from '../common/constants';
|
||||
import { SqlDatabaseProjectProvider } from '../projectProvider/projectProvider';
|
||||
import { GenerateProjectFromOpenApiSpecOptions, ItemType } from 'sqldbproj';
|
||||
import { EntryType, GenerateProjectFromOpenApiSpecOptions, ItemType } from 'sqldbproj';
|
||||
import { TableFileNode } from '../models/tree/fileFolderTreeItem';
|
||||
import { ProjectRootTreeItem } from '../models/tree/projectTreeItem';
|
||||
import { getAzdataApi } from '../common/utils';
|
||||
import { EntryType } from '../models/projectEntry';
|
||||
|
||||
/**
|
||||
* The main controller class that initializes the extension
|
||||
|
||||
@@ -20,7 +20,6 @@ import { PublishDatabaseDialog } from '../dialogs/publishDatabaseDialog';
|
||||
import { Project, reservedProjectFolders } from '../models/project';
|
||||
import { SqlDatabaseProjectTreeViewProvider } from './databaseProjectTreeViewProvider';
|
||||
import { FolderNode, FileNode } from '../models/tree/fileFolderTreeItem';
|
||||
import { IDeploySettings } from '../models/IDeploySettings';
|
||||
import { BaseProjectTreeItem } from '../models/tree/baseTreeItem';
|
||||
import { ProjectRootTreeItem } from '../models/tree/projectTreeItem';
|
||||
import { ImportDataModel } from '../models/api/import';
|
||||
@@ -37,14 +36,14 @@ import { TelemetryActions, TelemetryReporter, TelemetryViews } from '../common/t
|
||||
import { IconPathHelper } from '../common/iconHelper';
|
||||
import { DashboardData, PublishData, Status } from '../models/dashboardData/dashboardData';
|
||||
import { getPublishDatabaseSettings, launchPublishTargetOption } from '../dialogs/publishDatabaseQuickpick';
|
||||
import { launchCreateAzureServerQuickPick, launchPublishToDockerContainerQuickpick } from '../dialogs/deployDatabaseQuickpick';
|
||||
import { launchCreateAzureServerQuickPick, getPublishToDockerSettings } from '../dialogs/deployDatabaseQuickpick';
|
||||
import { DeployService } from '../models/deploy/deployService';
|
||||
import { AddItemOptions, GenerateProjectFromOpenApiSpecOptions, ISqlProject, ItemType, SqlTargetPlatform } from 'sqldbproj';
|
||||
import { AddItemOptions, EntryType, GenerateProjectFromOpenApiSpecOptions, IDatabaseReferenceProjectEntry, IDeploySettings, IPublishToDockerSettings, ISqlProject, ItemType, SqlTargetPlatform } from 'sqldbproj';
|
||||
import { AutorestHelper } from '../tools/autorestHelper';
|
||||
import { createNewProjectFromDatabaseWithQuickpick } from '../dialogs/createProjectFromDatabaseQuickpick';
|
||||
import { addDatabaseReferenceQuickpick } from '../dialogs/addDatabaseReferenceQuickpick';
|
||||
import { ILocalDbDeployProfile, ISqlDbDeployProfile } from '../models/deploy/deployProfile';
|
||||
import { EntryType, FileProjectEntry, IDatabaseReferenceProjectEntry, SqlProjectReferenceProjectEntry } from '../models/projectEntry';
|
||||
import { ISqlDbDeployProfile } from '../models/deploy/deployProfile';
|
||||
import { FileProjectEntry, SqlProjectReferenceProjectEntry } from '../models/projectEntry';
|
||||
import { UpdateProjectAction, UpdateProjectDataModel } from '../models/api/updateProject';
|
||||
import { AzureSqlClient } from '../models/deploy/azureSqlClient';
|
||||
import { ConnectionService } from '../models/connections/connectionService';
|
||||
@@ -317,7 +316,7 @@ export class ProjectsController {
|
||||
* @param context a treeItem in a project's hierarchy, to be used to obtain a Project or the Project itself
|
||||
* @param deployProfile
|
||||
*/
|
||||
public async publishToDockerContainer(context: Project | dataworkspace.WorkspaceTreeItem, deployProfile: ILocalDbDeployProfile): Promise<void> {
|
||||
public async publishToDockerContainer(context: Project | dataworkspace.WorkspaceTreeItem, deployProfile: IPublishToDockerSettings): Promise<void> {
|
||||
const project: Project = this.getProjectFromContext(context);
|
||||
// Removing the path separator from the image base name to be able to add that in the telemetry. With the separator the name is flagged as user path which is not true
|
||||
// We only need to know the image base parts so it's ok to use a different separator when adding to telemetry
|
||||
@@ -400,7 +399,7 @@ export class ProjectsController {
|
||||
}
|
||||
|
||||
if (publishTarget === constants.PublishTargetType.docker) {
|
||||
const deployProfile = await launchPublishToDockerContainerQuickpick(project);
|
||||
const deployProfile = await getPublishToDockerSettings(project);
|
||||
if (deployProfile?.deploySettings && deployProfile?.localDbSetting) {
|
||||
await this.publishToDockerContainer(project, deployProfile);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { DeploymentOptions as mssqlDeploymentOptions } from 'mssql';
|
||||
import { DeploymentOptions as vscodeMssqlDeploymentOptions } from 'vscode-mssql';
|
||||
|
||||
export type DeploymentOptions = mssqlDeploymentOptions | vscodeMssqlDeploymentOptions;
|
||||
|
||||
export interface IDeploySettings {
|
||||
databaseName: string;
|
||||
serverName: string;
|
||||
connectionUri: string;
|
||||
sqlCmdVariables?: Record<string, string>;
|
||||
deploymentOptions?: DeploymentOptions;
|
||||
profileUsed?: boolean;
|
||||
}
|
||||
@@ -8,18 +8,7 @@ import * as utils from '../../common/utils';
|
||||
import * as vscode from 'vscode';
|
||||
import { ConnectionResult } from 'azdata';
|
||||
import { IFireWallRuleError } from 'vscode-mssql';
|
||||
|
||||
export interface ISqlConnectionProperties {
|
||||
tenantId?: string,
|
||||
accountId?: string
|
||||
serverName: string,
|
||||
userName: string,
|
||||
password: string,
|
||||
port: number,
|
||||
dbName: string,
|
||||
profileName?: string,
|
||||
connectionRetryTimeout?: number
|
||||
}
|
||||
import { ISqlConnectionProperties } from 'sqldbproj';
|
||||
|
||||
/**
|
||||
* Includes methods to open connections and interact with connection views
|
||||
|
||||
@@ -3,19 +3,14 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IDeploySettings } from '../IDeploySettings';
|
||||
import type * as azdataType from 'azdata';
|
||||
import { IDeploySettings, ISqlConnectionProperties } from 'sqldbproj';
|
||||
import { IAzureAccountSession } from 'vscode-mssql';
|
||||
import { ISqlConnectionProperties } from '../connections/connectionService';
|
||||
|
||||
export enum AppSettingType {
|
||||
None,
|
||||
AzureFunction
|
||||
}
|
||||
export interface ILocalDbDeployProfile {
|
||||
localDbSetting?: ILocalDbSetting;
|
||||
deploySettings?: IDeploySettings;
|
||||
}
|
||||
|
||||
export interface ISqlDbDeployProfile {
|
||||
sqlDbSetting?: ISqlDbSetting;
|
||||
@@ -34,13 +29,6 @@ export interface ISqlDbSetting extends ISqlConnectionProperties {
|
||||
location: string
|
||||
}
|
||||
|
||||
export interface ILocalDbSetting extends ISqlConnectionProperties {
|
||||
dockerBaseImage: string,
|
||||
dockerBaseImageEula: string,
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface DockerImageInfo {
|
||||
name: string,
|
||||
displayName: string,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ILocalDbDeployProfile, ILocalDbSetting, ISqlDbDeployProfile } from './deployProfile';
|
||||
import { ISqlDbDeployProfile } from './deployProfile';
|
||||
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
|
||||
import { Project } from '../project';
|
||||
import * as constants from '../../common/constants';
|
||||
@@ -12,6 +12,7 @@ import * as vscode from 'vscode';
|
||||
import { ShellExecutionHelper } from '../../tools/shellExecutionHelper';
|
||||
import { AzureSqlClient } from './azureSqlClient';
|
||||
import { ConnectionService } from '../connections/connectionService';
|
||||
import { ILocalDbSetting, IPublishToDockerSettings } from 'sqldbproj';
|
||||
|
||||
interface DockerImageSpec {
|
||||
label: string;
|
||||
@@ -89,7 +90,7 @@ export class DeployService {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
public async deployToContainer(profile: ILocalDbDeployProfile, project: Project): Promise<string | undefined> {
|
||||
public async deployToContainer(profile: IPublishToDockerSettings, project: Project): Promise<string | undefined> {
|
||||
return await this.executeTask(constants.deployDbTaskName, async () => {
|
||||
if (!profile.localDbSetting) {
|
||||
return undefined;
|
||||
|
||||
@@ -12,12 +12,12 @@ import * as os from 'os';
|
||||
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
|
||||
|
||||
import { Uri, window } from 'vscode';
|
||||
import { ISqlProject, ItemType, SqlTargetPlatform } from 'sqldbproj';
|
||||
import { EntryType, IDatabaseReferenceProjectEntry, IProjectEntry, ISqlProject, ItemType, SqlTargetPlatform } from 'sqldbproj';
|
||||
import { promises as fs } from 'fs';
|
||||
import { DataSource } from './dataSources/dataSources';
|
||||
import { ISystemDatabaseReferenceSettings, IDacpacReferenceSettings, IProjectReferenceSettings } from './IDatabaseReferenceSettings';
|
||||
import { TelemetryActions, TelemetryReporter, TelemetryViews } from '../common/telemetry';
|
||||
import { DacpacReferenceProjectEntry, EntryType, FileProjectEntry, IDatabaseReferenceProjectEntry, ProjectEntry, SqlCmdVariableProjectEntry, SqlProjectReferenceProjectEntry, SystemDatabase, SystemDatabaseReferenceProjectEntry } from './projectEntry';
|
||||
import { DacpacReferenceProjectEntry, FileProjectEntry, ProjectEntry, SqlCmdVariableProjectEntry, SqlProjectReferenceProjectEntry, SystemDatabase, SystemDatabaseReferenceProjectEntry } from './projectEntry';
|
||||
|
||||
/**
|
||||
* Class representing a Project, and providing functions for operating on it
|
||||
@@ -1625,8 +1625,8 @@ export class Project implements ISqlProject {
|
||||
await this.serializeToProjFile(this.projFileXmlDoc!);
|
||||
}
|
||||
|
||||
private async removeFromProjFile(entries: ProjectEntry | ProjectEntry[]): Promise<void> {
|
||||
if (entries instanceof ProjectEntry) {
|
||||
private async removeFromProjFile(entries: IProjectEntry | IProjectEntry[]): Promise<void> {
|
||||
if (!Array.isArray(entries)) {
|
||||
entries = [entries];
|
||||
}
|
||||
|
||||
|
||||
@@ -6,18 +6,15 @@
|
||||
import * as path from 'path';
|
||||
import * as utils from '../common/utils';
|
||||
import { IDacpacReferenceSettings, IProjectReferenceSettings } from './IDatabaseReferenceSettings';
|
||||
import { IFileProjectEntry } from 'sqldbproj';
|
||||
import { EntryType, IDatabaseReferenceProjectEntry, IFileProjectEntry, IProjectEntry } from 'sqldbproj';
|
||||
import { Uri } from 'vscode';
|
||||
|
||||
/**
|
||||
* Represents an entry in a project file
|
||||
*/
|
||||
export abstract class ProjectEntry {
|
||||
type: EntryType;
|
||||
export abstract class ProjectEntry implements IProjectEntry {
|
||||
|
||||
constructor(type: EntryType) {
|
||||
this.type = type;
|
||||
}
|
||||
constructor(public type: EntryType) { }
|
||||
}
|
||||
|
||||
export class FileProjectEntry extends ProjectEntry implements IFileProjectEntry {
|
||||
@@ -46,16 +43,6 @@ export class FileProjectEntry extends ProjectEntry implements IFileProjectEntry
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a database reference entry in a project file
|
||||
*/
|
||||
|
||||
export interface IDatabaseReferenceProjectEntry extends FileProjectEntry {
|
||||
databaseName: string;
|
||||
databaseVariableLiteralValue?: string;
|
||||
suppressMissingDependenciesErrors: boolean;
|
||||
}
|
||||
|
||||
export class DacpacReferenceProjectEntry extends FileProjectEntry implements IDatabaseReferenceProjectEntry {
|
||||
databaseVariableLiteralValue?: string;
|
||||
databaseSqlCmdVariable?: string;
|
||||
@@ -144,13 +131,6 @@ export class SqlCmdVariableProjectEntry extends ProjectEntry {
|
||||
}
|
||||
}
|
||||
|
||||
export enum EntryType {
|
||||
File,
|
||||
Folder,
|
||||
DatabaseReference,
|
||||
SqlCmdVariable
|
||||
}
|
||||
|
||||
export enum DatabaseReferenceLocation {
|
||||
sameDatabase,
|
||||
differentDatabaseSameServer,
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as constants from '../../common/constants';
|
||||
import { BaseProjectTreeItem } from './baseTreeItem';
|
||||
import { ProjectRootTreeItem } from './projectTreeItem';
|
||||
import { IconPathHelper } from '../../common/iconHelper';
|
||||
import { IDatabaseReferenceProjectEntry } from '../projectEntry';
|
||||
import { IDatabaseReferenceProjectEntry } from 'sqldbproj';
|
||||
|
||||
/**
|
||||
* Folder for containing references nodes in the tree
|
||||
|
||||
@@ -13,7 +13,8 @@ import * as utils from '../../common/utils';
|
||||
import { DatabaseReferencesTreeItem } from './databaseReferencesTreeItem';
|
||||
import { DatabaseProjectItemType, RelativeOuterPath, ExternalStreamingJob, sqlprojExtension } from '../../common/constants';
|
||||
import { IconPathHelper } from '../../common/iconHelper';
|
||||
import { EntryType, FileProjectEntry } from '../projectEntry';
|
||||
import { FileProjectEntry } from '../projectEntry';
|
||||
import { EntryType } from 'sqldbproj';
|
||||
|
||||
/**
|
||||
* TreeNode root that represents an entire project
|
||||
|
||||
@@ -14,6 +14,7 @@ import { SqlDatabaseProjectTreeViewProvider } from '../controllers/databaseProje
|
||||
import { ProjectsController } from '../controllers/projectController';
|
||||
import { Project } from '../models/project';
|
||||
import { BaseProjectTreeItem } from '../models/tree/baseTreeItem';
|
||||
import { getPublishToDockerSettings } from '../dialogs/deployDatabaseQuickpick';
|
||||
|
||||
export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvider, sqldbproj.IExtension {
|
||||
constructor(private projectController: ProjectsController) {
|
||||
@@ -211,11 +212,15 @@ export class SqlDatabaseProjectProvider implements dataworkspace.IProjectProvide
|
||||
/**
|
||||
* Gets the Database Schema Provider version for a SQL project
|
||||
*/
|
||||
async getProjectDatabaseSchemaProvider(projectFilePath: string): Promise<string> {
|
||||
public async getProjectDatabaseSchemaProvider(projectFilePath: string): Promise<string> {
|
||||
return await this.projectController.getProjectDatabaseSchemaProvider(projectFilePath);
|
||||
}
|
||||
|
||||
async generateProjectFromOpenApiSpec(options?: sqldbproj.GenerateProjectFromOpenApiSpecOptions): Promise<sqldbproj.ISqlProject | undefined> {
|
||||
public async generateProjectFromOpenApiSpec(options?: sqldbproj.GenerateProjectFromOpenApiSpecOptions): Promise<sqldbproj.ISqlProject | undefined> {
|
||||
return await this.projectController.generateProjectFromOpenApiSpec(options);
|
||||
}
|
||||
|
||||
getPublishToDockerSettings(project: sqldbproj.ISqlProject): Promise<sqldbproj.IPublishToDockerSettings | undefined> {
|
||||
return getPublishToDockerSettings(project);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
|
||||
declare module 'sqldbproj' {
|
||||
import * as vscode from 'vscode';
|
||||
import { DeploymentOptions as mssqlDeploymentOptions } from 'mssql';
|
||||
import { DeploymentOptions as vscodeMssqlDeploymentOptions } from 'vscode-mssql';
|
||||
|
||||
export const enum extension {
|
||||
name = 'Microsoft.sql-database-projects',
|
||||
vsCodeName = 'ms-mssql.sql-database-projects-vscode'
|
||||
@@ -63,6 +66,8 @@ declare module 'sqldbproj' {
|
||||
*/
|
||||
addItemPrompt(project: ISqlProject, relativeFilePath: string, options?: AddItemOptions): Promise<void>;
|
||||
|
||||
getPublishToDockerSettings(project: ISqlProject): Promise<IPublishToDockerSettings | undefined>;
|
||||
|
||||
}
|
||||
|
||||
export interface AddItemOptions {
|
||||
@@ -240,14 +245,37 @@ declare module 'sqldbproj' {
|
||||
* "None" scripts in this project (scripts ignored by the build)
|
||||
*/
|
||||
readonly noneDeployScripts: IFileProjectEntry[];
|
||||
|
||||
readonly databaseReferences: IDatabaseReferenceProjectEntry[];
|
||||
}
|
||||
|
||||
export const enum EntryType {
|
||||
File,
|
||||
Folder,
|
||||
DatabaseReference,
|
||||
SqlCmdVariable
|
||||
}
|
||||
|
||||
export interface IProjectEntry {
|
||||
type: EntryType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents an entry in a project file
|
||||
*/
|
||||
export interface IFileProjectEntry {
|
||||
export interface IFileProjectEntry extends IProjectEntry {
|
||||
fsUri: vscode.Uri;
|
||||
relativePath: string;
|
||||
pathForSqlProj(): string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a database reference entry in a project file
|
||||
*/
|
||||
export interface IDatabaseReferenceProjectEntry extends IFileProjectEntry {
|
||||
databaseName: string;
|
||||
databaseVariableLiteralValue?: string;
|
||||
suppressMissingDependenciesErrors: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,4 +291,37 @@ declare module 'sqldbproj' {
|
||||
sqlDW = 'Azure Synapse Dedicated SQL Pool',
|
||||
sqlEdge = 'Azure SQL Edge'
|
||||
}
|
||||
|
||||
export interface ISqlConnectionProperties {
|
||||
tenantId?: string,
|
||||
accountId?: string
|
||||
serverName: string,
|
||||
userName: string,
|
||||
password: string,
|
||||
port: number,
|
||||
dbName: string,
|
||||
profileName?: string,
|
||||
connectionRetryTimeout?: number
|
||||
}
|
||||
|
||||
export interface ILocalDbSetting extends ISqlConnectionProperties {
|
||||
dockerBaseImage: string,
|
||||
dockerBaseImageEula: string,
|
||||
}
|
||||
|
||||
export interface IPublishToDockerSettings {
|
||||
localDbSetting?: ILocalDbSetting;
|
||||
deploySettings?: IDeploySettings;
|
||||
}
|
||||
|
||||
export type DeploymentOptions = mssqlDeploymentOptions | vscodeMssqlDeploymentOptions;
|
||||
|
||||
export interface IDeploySettings {
|
||||
databaseName: string;
|
||||
serverName: string;
|
||||
connectionUri: string;
|
||||
sqlCmdVariables?: Record<string, string>;
|
||||
deploymentOptions?: DeploymentOptions;
|
||||
profileUsed?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,14 @@ import { DeployService } from '../../models/deploy/deployService';
|
||||
import { Project } from '../../models/project';
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import { ILocalDbDeployProfile, ISqlDbDeployProfile } from '../../models/deploy/deployProfile';
|
||||
import { ISqlDbDeployProfile } from '../../models/deploy/deployProfile';
|
||||
import * as UUID from 'vscode-languageclient/lib/utils/uuid';
|
||||
import * as constants from '../../common/constants';
|
||||
import { ShellExecutionHelper } from '../../tools/shellExecutionHelper';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import { AzureSqlClient } from '../../models/deploy/azureSqlClient';
|
||||
import { ConnectionService } from '../../models/connections/connectionService';
|
||||
import { IPublishToDockerSettings } from 'sqldbproj';
|
||||
|
||||
export interface TestContext {
|
||||
outputChannel: vscode.OutputChannel;
|
||||
@@ -70,7 +71,7 @@ describe('deploy service', function (): void {
|
||||
|
||||
it('Should deploy a database to docker container successfully', async function (): Promise<void> {
|
||||
const testContext = createContext();
|
||||
const deployProfile: ILocalDbDeployProfile = {
|
||||
const deployProfile: IPublishToDockerSettings = {
|
||||
localDbSetting: {
|
||||
dbName: 'test',
|
||||
password: 'PLACEHOLDER',
|
||||
@@ -100,7 +101,7 @@ describe('deploy service', function (): void {
|
||||
|
||||
it('Should fail the deploy if docker is not running', async function (): Promise<void> {
|
||||
const testContext = createContext();
|
||||
const deployProfile: ILocalDbDeployProfile = {
|
||||
const deployProfile: IPublishToDockerSettings = {
|
||||
localDbSetting: {
|
||||
dbName: 'test',
|
||||
password: 'PLACEHOLDER',
|
||||
|
||||
@@ -15,10 +15,9 @@ import * as TypeMoq from 'typemoq';
|
||||
import { PublishDatabaseDialog } from '../../dialogs/publishDatabaseDialog';
|
||||
import { Project } from '../../models/project';
|
||||
import { ProjectsController } from '../../controllers/projectController';
|
||||
import { IDeploySettings } from '../../models/IDeploySettings';
|
||||
import { emptySqlDatabaseProjectTypeId } from '../../common/constants';
|
||||
import { createContext, mockDacFxOptionsResult, TestContext } from '../testContext';
|
||||
import { ILocalDbDeployProfile } from '../../models/deploy/deployProfile';
|
||||
import { IDeploySettings, IPublishToDockerSettings } from 'sqldbproj';
|
||||
|
||||
let testContext: TestContext;
|
||||
describe('Publish Database Dialog', () => {
|
||||
@@ -112,7 +111,7 @@ describe('Publish Database Dialog', () => {
|
||||
|
||||
should(profile).deepEqual(expectedGenScript);
|
||||
|
||||
const expectedContainerPublishProfile: ILocalDbDeployProfile = {
|
||||
const expectedContainerPublishProfile: IPublishToDockerSettings = {
|
||||
localDbSetting: {
|
||||
dbName: 'MockDatabaseName',
|
||||
dockerBaseImage: '',
|
||||
@@ -136,7 +135,7 @@ describe('Publish Database Dialog', () => {
|
||||
}
|
||||
};
|
||||
dialog.object.publishToExistingServer = false;
|
||||
let deployProfile: ILocalDbDeployProfile | undefined;
|
||||
let deployProfile: IPublishToDockerSettings | undefined;
|
||||
dialog.object.publishToContainer = (_, prof) => { deployProfile = prof; };
|
||||
await dialog.object.publishClick();
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ import { Project } from '../models/project';
|
||||
import { exists, convertSlashesForSqlProj, getWellKnownDatabaseSources } from '../common/utils';
|
||||
import { Uri, window } from 'vscode';
|
||||
import { IDacpacReferenceSettings, IProjectReferenceSettings, ISystemDatabaseReferenceSettings } from '../models/IDatabaseReferenceSettings';
|
||||
import { ItemType, SqlTargetPlatform } from 'sqldbproj';
|
||||
import { EntryType, SystemDatabaseReferenceProjectEntry, SqlProjectReferenceProjectEntry, SystemDatabase } from '../models/projectEntry';
|
||||
import { EntryType, ItemType, SqlTargetPlatform } from 'sqldbproj';
|
||||
import { SystemDatabaseReferenceProjectEntry, SqlProjectReferenceProjectEntry, SystemDatabase } from '../models/projectEntry';
|
||||
|
||||
let projFilePath: string;
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ import { AddDatabaseReferenceDialog } from '../dialogs/addDatabaseReferenceDialo
|
||||
import { IDacpacReferenceSettings } from '../models/IDatabaseReferenceSettings';
|
||||
import { CreateProjectFromDatabaseDialog } from '../dialogs/createProjectFromDatabaseDialog';
|
||||
import { ImportDataModel } from '../models/api/import';
|
||||
import { ItemType, SqlTargetPlatform } from 'sqldbproj';
|
||||
import { SystemDatabaseReferenceProjectEntry, SystemDatabase, EntryType, FileProjectEntry } from '../models/projectEntry';
|
||||
import { EntryType, ItemType, SqlTargetPlatform } from 'sqldbproj';
|
||||
import { SystemDatabaseReferenceProjectEntry, SystemDatabase, FileProjectEntry } from '../models/projectEntry';
|
||||
|
||||
let testContext: TestContext;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Project } from '../models/project';
|
||||
import { FolderNode, FileNode, sortFileFolderNodes } from '../models/tree/fileFolderTreeItem';
|
||||
import { ProjectRootTreeItem } from '../models/tree/projectTreeItem';
|
||||
import { DatabaseProjectItemType } from '../common/constants';
|
||||
import { EntryType } from '../models/projectEntry';
|
||||
import { EntryType } from 'sqldbproj';
|
||||
|
||||
describe('Project Tree tests', function (): void {
|
||||
it('Should correctly order tree nodes by type, then by name', function (): void {
|
||||
|
||||
Reference in New Issue
Block a user