Skip to content

Commit da1b9d9

Browse files
authored
VsCode SQL Projects publish dialog Initial user interface setup (#20179)
* intial changes to load empty dialog * UI intial changes * advanced options added * basic UI final changes * UI changes with formwebviewcontroller * Basic UI final changes * removed Advanced related changes from the current set * converting const to static class * localized files * copilot comments adjusted * using new webview provider * updating the code * Adding publish dialog basic test file * addressing code review comments * updating the variable name * addressing code review comments * updating LOC and fixing test * addressing code review comments * undo double wrapping * adding main controller test to validate publish proj call * addressing review comments * updating profile name and path clearly to notify about publish profile
1 parent b4dea21 commit da1b9d9

23 files changed

+5225
-4298
lines changed

localization/l10n/bundle.l10n.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,8 @@
635635
"comment": ["{0} is the name of the entry"]
636636
},
637637
"Processing include or exclude all differences operation.": "Processing include or exclude all differences operation.",
638+
"Select Profile": "Select Profile",
639+
"Save As...": "Save As...",
638640
"Create New Connection Group": "Create New Connection Group",
639641
"Edit Connection Group: {0}/{0} is the name of the connection group being edited": {
640642
"message": "Edit Connection Group: {0}",
@@ -1419,6 +1421,15 @@
14191421
"comment": ["{0} is the webview name"]
14201422
},
14211423
"General": "General",
1424+
"Publish Project": "Publish Project",
1425+
"Publish Profile": "Publish Profile",
1426+
"Select or enter a publish profile": "Select or enter a publish profile",
1427+
"Database name is required": "Database name is required",
1428+
"SQLCMD Variables": "SQLCMD Variables",
1429+
"Publish Target": "Publish Target",
1430+
"Existing SQL server": "Existing SQL server",
1431+
"Local development container": "Local development container",
1432+
"Save As": "Save As",
14221433
"Schema Compare": "Schema Compare",
14231434
"Options have changed. Recompare to see the comparison?": "Options have changed. Recompare to see the comparison?",
14241435
"Failed to generate script: '{0}'/{0} is the error message returned from the generate script operation": {
@@ -1435,7 +1446,6 @@
14351446
},
14361447
"Loading Schema Designer Model...": "Loading Schema Designer Model...",
14371448
"Schema Designer Model is ready. Changes can now be published.": "Schema Designer Model is ready. Changes can now be published.",
1438-
"Save As": "Save As",
14391449
"Schema Designer": "Schema Designer",
14401450
"Opening Publish Script. This may take a while...": "Opening Publish Script. This may take a while...",
14411451
"Generating Report. This may take a while...": "Generating Report. This may take a while...",

localization/xliff/vscode-mssql.xlf

Lines changed: 4289 additions & 4259 deletions
Large diffs are not rendered by default.

media/changePassword_dark.svg

Lines changed: 20 additions & 12 deletions
Loading

media/changePassword_light.svg

Lines changed: 20 additions & 12 deletions
Loading

scripts/bundle-reactviews.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const config = {
2626
schemaDesigner: "src/reactviews/pages/SchemaDesigner/index.tsx",
2727
schemaCompare: "src/reactviews/pages/SchemaCompare/index.tsx",
2828
changePassword: "src/reactviews/pages/ChangePassword/index.tsx",
29+
publishProject: "src/reactviews/pages/PublishProject/index.tsx",
2930
},
3031
bundle: true,
3132
outdir: "dist/views",

src/constants/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export const cmdCommandPaletteQueryHistory = "mssql.commandPaletteQueryHistory";
5151
export const cmdNewQuery = "mssql.newQuery";
5252
export const cmdSchemaCompare = "mssql.schemaCompare";
5353
export const cmdSchemaCompareOpenFromCommandPalette = "mssql.schemaCompareOpenFromCommandPalette";
54+
export const cmdPublishDatabaseProject = "mssql.publishDatabaseProject";
5455
export const cmdManageConnectionProfiles = "mssql.manageProfiles";
5556
export const cmdClearPooledConnections = "mssql.clearPooledConnections";
5657
export const cmdRebuildIntelliSenseCache = "mssql.rebuildIntelliSenseCache";

src/constants/locConstants.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,23 @@ export class TableDesigner {
12801280
public static AdvancedOptions = l10n.t("Advanced Options");
12811281
}
12821282

1283+
export class PublishProject {
1284+
public static Title = l10n.t("Publish Project");
1285+
public static PublishProfileLabel = l10n.t("Publish Profile");
1286+
public static PublishProfilePlaceholder = l10n.t("Select or enter a publish profile");
1287+
public static ServerLabel = l10n.t("Server");
1288+
public static DatabaseLabel = l10n.t("Database");
1289+
public static DatabaseRequiredMessage = l10n.t("Database name is required");
1290+
public static SqlCmdVariablesLabel = l10n.t("SQLCMD Variables");
1291+
public static PublishTargetLabel = l10n.t("Publish Target");
1292+
public static PublishTargetExisting = l10n.t("Existing SQL server");
1293+
public static PublishTargetContainer = l10n.t("Local development container");
1294+
public static SelectPublishProfile = l10n.t("Select Profile");
1295+
public static SaveAs = l10n.t("Save As");
1296+
public static GenerateScript = l10n.t("Generate Script");
1297+
public static Publish = l10n.t("Publish");
1298+
}
1299+
12831300
export class SchemaCompare {
12841301
public static Title = l10n.t("Schema Compare");
12851302
public static Open = l10n.t("Open");

src/controllers/mainController.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ import store from "../queryResult/singletonStore";
6464
import { SchemaCompareWebViewController } from "../schemaCompare/schemaCompareWebViewController";
6565
import { SchemaCompare } from "../constants/locConstants";
6666
import { SchemaDesignerWebviewManager } from "../schemaDesigner/schemaDesignerWebviewManager";
67+
import { PublishProjectWebViewController } from "../publishProject/publishProjectWebViewController";
6768
import { ConnectionNode } from "../objectExplorer/nodes/connectionNode";
6869
import { CopilotService } from "../services/copilotService";
6970
import * as Prompts from "../copilot/prompts";
@@ -482,6 +483,16 @@ export default class MainController implements vscode.Disposable {
482483
},
483484
);
484485

486+
// -- PUBLISH PROJECT --
487+
this._context.subscriptions.push(
488+
vscode.commands.registerCommand(
489+
Constants.cmdPublishDatabaseProject,
490+
async (projectFilePath: string) => {
491+
await this.onPublishDatabaseProject(projectFilePath);
492+
},
493+
),
494+
);
495+
485496
// -- EXPLAIN QUERY --
486497
this._context.subscriptions.push(
487498
vscode.commands.registerCommand(Constants.cmdExplainQuery, async () => {
@@ -2587,6 +2598,22 @@ export default class MainController implements vscode.Disposable {
25872598
schemaCompareWebView.revealToForeground();
25882599
}
25892600

2601+
/**
2602+
* Handler for the Publish Database Project command.
2603+
* Accepts the project file path as an argument.
2604+
* This method launches the Publish Project UI for the specified database project.
2605+
* @param projectFilePath The file path of the database project to publish.
2606+
*/
2607+
public onPublishDatabaseProject(projectFilePath: string): void {
2608+
const publishProjectWebView = new PublishProjectWebViewController(
2609+
this._context,
2610+
this._vscodeWrapper,
2611+
projectFilePath,
2612+
);
2613+
2614+
publishProjectWebView.revealToForeground();
2615+
}
2616+
25902617
/**
25912618
* Check if the extension launched file exists.
25922619
* This is to detect when we are running in a clean install scenario.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import { FormItemType } from "../sharedInterfaces/form";
7+
import {
8+
IPublishForm,
9+
PublishDialogFormItemSpec,
10+
PublishDialogState,
11+
} from "../sharedInterfaces/publishDialog";
12+
import { PublishProject as Loc } from "../constants/locConstants";
13+
14+
/**
15+
* Generate publish form components.
16+
*/
17+
export function generatePublishFormComponents(): Record<
18+
keyof IPublishForm,
19+
PublishDialogFormItemSpec
20+
> {
21+
const components: Record<keyof IPublishForm, PublishDialogFormItemSpec> = {
22+
publishProfilePath: {
23+
propertyName: "publishProfilePath",
24+
label: Loc.PublishProfileLabel,
25+
required: false,
26+
type: FormItemType.Input,
27+
},
28+
serverName: {
29+
propertyName: "serverName",
30+
label: Loc.ServerLabel,
31+
required: true,
32+
type: FormItemType.Input,
33+
},
34+
databaseName: {
35+
propertyName: "databaseName",
36+
label: Loc.DatabaseLabel,
37+
required: true,
38+
type: FormItemType.Input,
39+
validate: (_state: PublishDialogState, value: string) => {
40+
const isValid = (value ?? "").trim().length > 0;
41+
return { isValid, validationMessage: isValid ? "" : Loc.DatabaseRequiredMessage };
42+
},
43+
},
44+
publishTarget: {
45+
propertyName: "publishTarget",
46+
label: Loc.PublishTargetLabel,
47+
required: true,
48+
type: FormItemType.Dropdown,
49+
options: [
50+
{
51+
displayName: Loc.PublishTargetExisting,
52+
value: "existingServer",
53+
},
54+
{
55+
displayName: Loc.PublishTargetContainer,
56+
value: "localContainer",
57+
},
58+
],
59+
},
60+
sqlCmdVariables: {
61+
propertyName: "sqlCmdVariables",
62+
label: Loc.SqlCmdVariablesLabel,
63+
required: false,
64+
type: FormItemType.Input,
65+
hidden: true,
66+
},
67+
};
68+
69+
return components;
70+
}

0 commit comments

Comments
 (0)