Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Group by schema to OE #17543

Merged
merged 16 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions localization/xliff/enu/constants/localizedConstants.enu.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,9 @@
<trans-unit id="columnWidthMustBePositiveError">
<source xml:lang="en">Width cannot be 0 or negative</source>
</trans-unit>
<trans-unit id="objectExplorerNodeRefreshError">
<source xml:lang="en">Error occured while refreshing nodes</source>
aasimkhan30 marked this conversation as resolved.
Show resolved Hide resolved
</trans-unit>
</body>
</file>
</xliff>
9 changes: 9 additions & 0 deletions localization/xliff/enu/localizedPackage.json.enu.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,15 @@
<trans-unit id="mssql.deviceCode.description">
<source xml:lang="en">Allows users to sign in to input-constrained devices.</source>
</trans-unit>
<trans-unit id="mssql.objectExplorer.groupBySchema">
<source xml:lang="en">When enabled, the database objects in Object explorer will be categorized by schema.</source>
aasimkhan30 marked this conversation as resolved.
Show resolved Hide resolved
</trans-unit>
<trans-unit id="mssql.objectExplorer.enableGroupBySchema">
<source xml:lang="en">Enable Group By Schema</source>
</trans-unit>
<trans-unit id="mssql.objectExplorer.disableGroupBySchema">
<source xml:lang="en">Disable Group By Schema</source>
</trans-unit>
</body>
</file>
</xliff>
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,18 @@
"when": "view == queryHistory",
"title": "%mssql.clearAllQueryHistory%",
"group": "secondary"
},
{
"command": "mssql.objectExplorer.enableGroupBySchema",
"when": "view == objectExplorer && !config.mssql.objectExplorer.groupBySchema",
"title": "%mssql.objectExplorer.enableGroupBySchema%",
"group": "secondary"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For VS Code MSSQL seems like it'd be better to have it as a navigation item so it shows up on the title bar. That's a lot easier to see and work with - the secondary menu is still a bit too hidden IMO.

@erinstellato-ms thoughts on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO I don't think people will toggle this setting a lot. Therefore, I am not sure about making it visible all the time. They will either stick with schema tree or regular tree. We can enable this setting by default in the next version and let users disable it if they want to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not like there isn't plenty of room there. And I just think that hiding it in the secondary menu means that most people aren't going to know it exists unless they're really diligent about reading the release notes.

Just seems a shame to put all the work into this feature and then make it difficult for people to discover it. We can always hide the action later if people don't like it there.

},
{
"command": "mssql.objectExplorer.disableGroupBySchema",
"when": "view == objectExplorer && config.mssql.objectExplorer.groupBySchema",
"title": "%mssql.objectExplorer.disableGroupBySchema%",
"group": "secondary"
}
],
"view/item/context": [
Expand Down Expand Up @@ -439,6 +451,16 @@
"category": "MS SQL",
"icon": "$(add)"
},
{
"command": "mssql.objectExplorer.enableGroupBySchema",
"title": "%mssql.objectExplorer.enableGroupBySchema%",
"category": "MS SQL"
},
{
"command": "mssql.objectExplorer.disableGroupBySchema",
"title": "%mssql.objectExplorer.disableGroupBySchema%",
"category": "MS SQL"
},
{
"command": "mssql.objectExplorerNewQuery",
"title": "%mssql.objectExplorerNewQuery%",
Expand Down Expand Up @@ -1137,6 +1159,11 @@
"type": "boolean",
"description": "%mssql.ignorePlatformWarning%",
"default": false
},
"mssql.objectExplorer.groupBySchema": {
"type": "boolean",
"description": "%mssql.objectExplorer.groupBySchema%",
"default": false
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,8 @@
"mssql.Configuration":"MSSQL configuration",
"mssql.chooseAuthMethod":"Chooses which Authentication method to use",
"mssql.authCodeGrant.description":"Prompts users to sign in using their browser.",
"mssql.deviceCode.description":"Allows users to sign in to input-constrained devices."
"mssql.deviceCode.description":"Allows users to sign in to input-constrained devices.",
"mssql.objectExplorer.groupBySchema":"When enabled, the database objects in Object explorer will be categorized by schema.",
"mssql.objectExplorer.enableGroupBySchema":"Enable Group By Schema",
"mssql.objectExplorer.disableGroupBySchema":"Disable Group By Schema"
}
24 changes: 12 additions & 12 deletions src/configurations/config.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"service": {
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
"version": "4.5.0.8",
"version": "4.5.0.20",
"downloadFileNames": {
"Windows_86": "win-x86-net6.0.zip",
"Windows_64": "win-x64-net6.0.zip",
"OSX_10_11_64": "osx-x64-net6.0.tar.gz",
"CentOS_7": "rhel-x64-net6.0.tar.gz",
"Debian_8": "rhel-x64-net6.0.tar.gz",
"Fedora_23": "rhel-x64-net6.0.tar.gz",
"OpenSUSE_13_2": "rhel-x64-net6.0.tar.gz",
"SLES_12_2": "rhel-x64-net6.0.tar.gz",
"RHEL_7": "rhel-x64-net6.0.tar.gz",
"Ubuntu_14": "rhel-x64-net6.0.tar.gz",
"Ubuntu_16": "rhel-x64-net6.0.tar.gz"
"Windows_86": "win-x86-net7.0.zip",
"Windows_64": "win-x64-net7.0.zip",
"OSX_10_11_64": "osx-x64-net7.0.tar.gz",
"CentOS_7": "rhel-x64-net7.0.tar.gz",
"Debian_8": "rhel-x64-net7.0.tar.gz",
"Fedora_23": "rhel-x64-net7.0.tar.gz",
"OpenSUSE_13_2": "rhel-x64-net7.0.tar.gz",
"SLES_12_2": "rhel-x64-net7.0.tar.gz",
"RHEL_7": "rhel-x64-net7.0.tar.gz",
"Ubuntu_14": "rhel-x64-net7.0.tar.gz",
"Ubuntu_16": "rhel-x64-net7.0.tar.gz"
},
"installDir": "../sqltoolsservice/{#version#}/{#platform#}",
"executableFiles": [
Expand Down
3 changes: 3 additions & 0 deletions src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export const cmdObjectExplorerNodeSignIn = 'mssql.objectExplorerNodeSignIn';
export const cmdConnectObjectExplorerNode = 'mssql.connectObjectExplorerNode';
export const cmdConnectObjectExplorerProfile = 'mssql.connectObjectExplorerProfile';
export const cmdOpenObjectExplorerCommand = 'workbench.view.extension.objectExplorer';
export const cmdObjectExplorerGroupBySchemaFlagName = 'mssql.objectExplorer.groupBySchema';
export const cmdObjectExplorerEnableGroupBySchemaCommand = 'mssql.objectExplorer.enableGroupBySchema';
export const cmdObjectExplorerDisableGroupBySchemaCommand = 'mssql.objectExplorer.disableGroupBySchema';
export const cmdScriptSelect = 'mssql.scriptSelect';
export const cmdScriptCreate = 'mssql.scriptCreate';
export const cmdScriptDelete = 'mssql.scriptDelete';
Expand Down
24 changes: 24 additions & 0 deletions src/controllers/mainController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ export default class MainController implements vscode.Disposable {
});
});

this.registerCommand(Constants.cmdObjectExplorerEnableGroupBySchemaCommand);
this._event.on(Constants.cmdObjectExplorerEnableGroupBySchemaCommand, () => {
vscode.workspace.getConfiguration().update(Constants.cmdObjectExplorerGroupBySchemaFlagName, true, true);
});
this.registerCommand(Constants.cmdObjectExplorerDisableGroupBySchemaCommand);
this._event.on(Constants.cmdObjectExplorerDisableGroupBySchemaCommand, () => {
vscode.workspace.getConfiguration().update(Constants.cmdObjectExplorerGroupBySchemaFlagName, false, true);
});

this.initializeQueryHistory();

this.sqlTasksService = new SqlTasksService(SqlToolsServerClient.instance, this._untitledSqlDocumentService);
Expand Down Expand Up @@ -1178,6 +1187,21 @@ export default class MainController implements vscode.Disposable {

await this.sanitizeConnectionProfiles();

if (e.affectsConfiguration(Constants.cmdObjectExplorerGroupBySchemaFlagName)) {
let errorFoundWhileRefreshing = false;
(await this._objectExplorerProvider.getChildren()).forEach((n: TreeNodeInfo) => {
try {
this._objectExplorerProvider.refreshNode(n);
} catch (e) {
errorFoundWhileRefreshing = true;
Utils.logToOutputChannel(e.toString());
}
});
if (errorFoundWhileRefreshing) {
Utils.showErrorMsg(LocalizedConstants.objectExplorerNodeRefreshError);
}
}

if (needsRefresh) {
this._objectExplorerProvider.refresh(undefined);
}
Expand Down
59 changes: 35 additions & 24 deletions src/objectExplorer/objectTypes/Schema.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.