Skip to content

Commit 1abbc52

Browse files
committed
MySQL Schema Management Plugin
Change-Id: I9384041c278975ba0bbfed23a195187629e65649
1 parent 93b0d45 commit 1abbc52

File tree

104 files changed

+54196
-37
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+54196
-37
lines changed

MySQLShellPluginDevelopment.code-workspace

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
"name": "MRS HeatWave Chat",
3434
"path": "mrs_plugin/examples/mrs_chat"
3535
},
36+
{
37+
"name": "MySQL Schema Management Plugin",
38+
"path": "msm_plugin"
39+
},
3640
{
3741
"name": "Shell Plugin Tools",
3842
"path": "gui/tools"

gui/extension/package.json

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"Data Science"
2424
],
2525
"activationEvents": [
26-
"onView:msg-view"
26+
"onStartupFinished"
2727
],
2828
"main": "./out/main.cjs",
2929
"type": "module",
@@ -1097,6 +1097,22 @@
10971097
"dark": "images/dark/mrsServiceDefault.svg",
10981098
"light": "images/light/mrsServiceDefault.svg"
10991099
}
1100+
},
1101+
{
1102+
"command": "msg.msm.createNewProjectFolder",
1103+
"title": "Create New MSM Project Folder"
1104+
},
1105+
{
1106+
"command": "msg.msm.getProjectInformation",
1107+
"title": "Get MSM Project Information"
1108+
},
1109+
{
1110+
"command": "msg.msm.prepareRelease",
1111+
"title": "Prepare Release"
1112+
},
1113+
{
1114+
"command": "msg.msm.generateDeploymentScript",
1115+
"title": "Generate Deployment Script"
11001116
}
11011117
],
11021118
"submenus": [
@@ -1114,6 +1130,14 @@
11141130
"id": "msg.loadFromDisk",
11151131
"label": "Load from Disk",
11161132
"command": ""
1133+
},
1134+
{
1135+
"id": "msg.msm.subMenu",
1136+
"label": "MySQL Schema Management"
1137+
},
1138+
{
1139+
"id": "msg.mrs.subMenu",
1140+
"label": "MySQL REST Service"
11171141
}
11181142
],
11191143
"menus": {
@@ -1288,6 +1312,40 @@
12881312
"group": "3_msg@2"
12891313
}
12901314
],
1315+
"msg.mrs.subMenu": [
1316+
{
1317+
"when": "explorerResourceIsFolder",
1318+
"command": "msg.mrs.addFolderAsContentSet",
1319+
"group": "8_msg@1"
1320+
},
1321+
{
1322+
"when": "explorerResourceIsFolder && resourceExtname =~ /.*\\.mrs\\.sdk'$/",
1323+
"command": "msg.mrs.rebuildMrsSdk",
1324+
"group": "8_msg@2"
1325+
}
1326+
],
1327+
"msg.msm.subMenu": [
1328+
{
1329+
"when": "explorerResourceIsFolder && !(resourceFilename =~ /.*\\.msm\\.project$/)",
1330+
"command": "msg.msm.createNewProjectFolder",
1331+
"group": "1_msg@1"
1332+
},
1333+
{
1334+
"when": "explorerResourceIsFolder && resourceFilename =~ /.*\\.msm\\.project$/",
1335+
"command": "msg.msm.getProjectInformation",
1336+
"group": "2_msg@1"
1337+
},
1338+
{
1339+
"when": "explorerResourceIsFolder && resourceFilename =~ /.*\\.msm\\.project$/",
1340+
"command": "msg.msm.prepareRelease",
1341+
"group": "3_msg@1"
1342+
},
1343+
{
1344+
"when": "explorerResourceIsFolder && resourceFilename =~ /.*\\.msm\\.project$/",
1345+
"command": "msg.msm.generateDeploymentScript",
1346+
"group": "3_msg@2"
1347+
}
1348+
],
12911349
"explorer/context": [
12921350
{
12931351
"when": "resourceLangId == mysql-notebook",
@@ -1301,13 +1359,13 @@
13011359
},
13021360
{
13031361
"when": "explorerResourceIsFolder",
1304-
"command": "msg.mrs.addFolderAsContentSet",
1305-
"group": "8_msg@1"
1362+
"submenu": "msg.msm.subMenu",
1363+
"group": "1_msg@1"
13061364
},
13071365
{
1308-
"when": "explorerResourceIsFolder && resourceExtname === '.sdk'",
1309-
"command": "msg.mrs.rebuildMrsSdk",
1310-
"group": "8_msg@2"
1366+
"when": "explorerResourceIsFolder",
1367+
"submenu": "msg.mrs.subMenu",
1368+
"group": "1_msg@2"
13111369
}
13121370
],
13131371
"editor/title/context": [
@@ -2021,4 +2079,4 @@
20212079
"unit-tests": "mkdir -p .vscode-test/vscode-dummy/ && touch .vscode-test/vscode-dummy/dummy.txt",
20222080
"package-extension": "pwsh scripts/package_extension.ps1"
20232081
}
2024-
}
2082+
}

gui/extension/scripts/package_extension.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright (c) 2022, 2024, Oracle and/or its affiliates.
2+
# Copyright (c) 2022, 2025, Oracle and/or its affiliates.
33

44
# This program is free software; you can redistribute it and/or modify
55
# it under the terms of the GNU General Public License, version 2.0,
@@ -26,11 +26,12 @@
2626
# darwin-arm64, darwin-x64, win32-x64
2727
# Usage: package_extension.sh [single-platform]
2828
#
29-
# This script assumes you have unpacked GUI, MDS, MRS plugins into
29+
# This script assumes you have unpacked GUI, MDS, MRS, MSM plugins into
3030
#
3131
# $HOME/.mysqlsh/plugins/gui_plugin
3232
# $HOME/.mysqlsh/plugins/mds_plugin
3333
# $HOME/.mysqlsh/plugins/mrs_plugin
34+
# $HOME/.mysqlsh/plugins/msm_plugin
3435
#
3536
# Note that if SHELL_VERSION is set in the environment, this script is
3637
# assumed to be run from PB2 without prompting the user to input the
@@ -142,6 +143,10 @@ if [ ! -d "$HOME/.mysqlsh/plugins/mrs_plugin" ]; then
142143
echo "ERROR: The mrs_plugin is missing from ~/.mysqlsh/plugins/"
143144
exit 1
144145
fi
146+
if [ ! -d "$HOME/.mysqlsh/plugins/msm_plugin" ]; then
147+
echo "ERROR: The msm_plugin is missing from ~/.mysqlsh/plugins/"
148+
exit 1
149+
fi
145150

146151
if [ -z "${SHELL_VERSION}" ] && [ ! -d "packaging" ]; then
147152
echo "Setting up the packaging resources..."
@@ -214,18 +219,19 @@ for d in packaging/mysql-shell/*; do
214219
cp -R $d/share shell/.
215220

216221
echo "Cleanup OCI SDK folder"
217-
OCIPATH=shell/lib/mysqlsh/lib/python3.12/site-packages/oci
222+
OCIPATH=shell/lib/mysqlsh/lib/python3.13/site-packages/oci
218223
if [ "$PLATFORM" == "linux-arm64" ] || [ "$PLATFORM" == "linux-x64" ]; then
219-
OCIPATH=shell/lib/mysqlsh/lib/python3.12/site-packages/oci
224+
OCIPATH=shell/lib/mysqlsh/lib/python3.13/site-packages/oci
220225
elif [ "$PLATFORM" == "win32-x64" ]; then
221-
OCIPATH=shell/lib/Python3.12/Lib/site-packages/oci
226+
OCIPATH=shell/lib/Python3.13/Lib/site-packages/oci
222227
fi
223228
strip_oci_package $OCIPATH
224229

225230
echo "Copy plugins"
226231
cp -RL $HOME/.mysqlsh/plugins/gui_plugin shell/lib/mysqlsh/plugins/.
227232
cp -RL $HOME/.mysqlsh/plugins/mds_plugin shell/lib/mysqlsh/plugins/.
228233
cp -RL $HOME/.mysqlsh/plugins/mrs_plugin shell/lib/mysqlsh/plugins/.
234+
cp -RL $HOME/.mysqlsh/plugins/msm_plugin shell/lib/mysqlsh/plugins/.
229235

230236
# Clean *.py[co] files and __pycache__ directories
231237
find shell/lib/mysqlsh/plugins -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete

gui/extension/src/ExtensionHost.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import { NodeMessageScheduler } from "./communication/NodeMessageScheduler.js";
5858
import { NotebookEditorProvider } from "./editor-providers/NotebookEditorProvider.js";
5959
import { ConnectionsTreeDataProvider } from "./tree-providers/ConnectionsTreeProvider/ConnectionsTreeProvider.js";
6060
import { convertErrorToString } from "../../frontend/src/utilities/helpers.js";
61+
import { MsmCommandHandler } from "./MsmCommandHandler.js";
6162

6263
/** This class manages some extension wide things like authentication handling etc. */
6364
export class ExtensionHost {
@@ -78,6 +79,7 @@ export class ExtensionHost {
7879
private notebookProvider = new NotebookEditorProvider();
7980
private mrsCommandHandler: MRSCommandHandler;
8081
private mdsCommandHandler = new MDSCommandHandler();
82+
private msmCommandHandler: MsmCommandHandler;
8183

8284
// Tree data providers for the extension's sidebar. The connection provider is managed in the DB editor
8385
// command handler.
@@ -102,6 +104,7 @@ export class ExtensionHost {
102104
this.connectionsProvider = new ConnectionsTreeDataProvider(this.#connectionsDataModel);
103105
this.dbEditorCommandHandler = new DBEditorCommandHandler(this.connectionsProvider);
104106
this.mrsCommandHandler = new MRSCommandHandler(this.connectionsProvider);
107+
this.msmCommandHandler = new MsmCommandHandler(this.connectionsProvider);
105108

106109
this.setupEnvironment();
107110

@@ -132,6 +135,10 @@ export class ExtensionHost {
132135
requisitions.register("proxyRequest", this.proxyRequest);
133136
}
134137

138+
public extensionInitialized(): boolean {
139+
return this.#connectionsDataModel.initialized;
140+
}
141+
135142
/**
136143
* Closes all webview tabs and frees their providers.
137144
*/
@@ -318,6 +325,7 @@ export class ExtensionHost {
318325
this.notebookProvider.setup(this);
319326
this.mrsCommandHandler.setup(this);
320327
this.mdsCommandHandler.setup(this);
328+
this.msmCommandHandler.setup(this);
321329

322330
const updateLogLevel = (): void => {
323331
const configuration = workspace.getConfiguration(`msg.debugLog`);

0 commit comments

Comments
 (0)