mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Adding group by schema to OE (#21941)
* Adding group by schema and updating schema icon * Adding item context menu * Fixing command logic * Adding telemetry for group by and changing default config * reverting no child nodes error message * Code cleanup * Cleaning up constants * Removing unused imports * Update extensions/mssql/src/main.ts Co-authored-by: Charles Gagnon <chgagnon@microsoft.com> * converting to sendActionEvent * sendActionEvent * Adding telemetryViews and telemetry actions * Fixing localized string * registering context --------- Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||
"version": "4.5.0.18",
|
||||
"version": "4.5.0.20",
|
||||
"downloadFileNames": {
|
||||
"Windows_86": "win-x86-net7.0.zip",
|
||||
"Windows_64": "win-x64-net7.0.zip",
|
||||
|
||||
@@ -66,6 +66,16 @@
|
||||
"command": "mssql.designTable",
|
||||
"category": "MSSQL",
|
||||
"title": "%title.designTable%"
|
||||
},
|
||||
{
|
||||
"command": "mssql.enableGroupBySchema",
|
||||
"category": "MSSQL",
|
||||
"title": "%mssql.objectExplorer.enableGroupBySchema%"
|
||||
},
|
||||
{
|
||||
"command": "mssql.disableGroupBySchema",
|
||||
"category": "MSSQL",
|
||||
"title": "%mssql.objectExplorer.disableGroupBySchema%"
|
||||
}
|
||||
],
|
||||
"outputChannels": [
|
||||
@@ -356,6 +366,11 @@
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%mssql.tableDesigner.preloadDatabaseModel%"
|
||||
},
|
||||
"mssql.objectExplorer.groupBySchema": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "%mssql.objectExplorer.groupBySchema%"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -388,6 +403,14 @@
|
||||
"command": "mssql.newTable",
|
||||
"when": "connectionProvider == MSSQL && nodeType == Folder && objectType == Tables",
|
||||
"group": "0_query@1"
|
||||
},
|
||||
{
|
||||
"command": "mssql.enableGroupBySchema",
|
||||
"when": "connectionProvider == MSSQL && nodeType && nodeType =~ /^(Server|Database)$/ && !config.mssql.objectExplorer.groupBySchema"
|
||||
},
|
||||
{
|
||||
"command": "mssql.disableGroupBySchema",
|
||||
"when": "connectionProvider == MSSQL && nodeType && nodeType =~ /^(Server|Database)$/ && config.mssql.objectExplorer.groupBySchema"
|
||||
}
|
||||
],
|
||||
"dataExplorer/context": [
|
||||
@@ -400,6 +423,14 @@
|
||||
"command": "mssql.newTable",
|
||||
"when": "connectionProvider == MSSQL && nodeType == Folder && objectType == Tables",
|
||||
"group": "connection@1"
|
||||
},
|
||||
{
|
||||
"command": "mssql.enableGroupBySchema",
|
||||
"when": "connectionProvider == MSSQL && nodeType && nodeType =~ /^(Server|Database)$/ && !config.mssql.objectExplorer.groupBySchema"
|
||||
},
|
||||
{
|
||||
"command": "mssql.disableGroupBySchema",
|
||||
"when": "connectionProvider == MSSQL && nodeType && nodeType =~ /^(Server|Database)$/ && config.mssql.objectExplorer.groupBySchema"
|
||||
}
|
||||
],
|
||||
"notebook/toolbar": [
|
||||
|
||||
@@ -178,5 +178,9 @@
|
||||
"title.newTable": "New Table",
|
||||
"title.designTable": "Design",
|
||||
"mssql.parallelMessageProcessing" : "[Experimental] Whether the requests to the SQL Tools Service should be handled in parallel. This is introduced to discover the issues there might be when handling all requests in parallel. The default value is false. Relaunch of ADS is required when the value is changed.",
|
||||
"mssql.tableDesigner.preloadDatabaseModel": "Whether to preload the database model when the database node in the object explorer is expanded. When enabled, the loading time of table designer can be reduced. Note: You might see higher than normal memory usage if you need to expand a lot of database nodes."
|
||||
"mssql.tableDesigner.preloadDatabaseModel": "Whether to preload the database model when the database node in the object explorer is expanded. When enabled, the loading time of table designer can be reduced. Note: You might see higher than normal memory usage if you need to expand a lot of database nodes.",
|
||||
|
||||
"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,3 +24,10 @@ export const SqlMigrationService = 'sqlMigrationService';
|
||||
export const NotebookConvertService = 'notebookConvertService';
|
||||
export const AzureBlobService = 'azureBlobService';
|
||||
export const TdeMigrationService = 'tdeMigrationService';
|
||||
|
||||
// CONFIGURATION VALUES //////////////////////////////////////////////////////////
|
||||
export const configObjectExplorerGroupBySchemaFlagName = 'mssql.objectExplorer.groupBySchema';
|
||||
|
||||
// COMMANDNAMES //////////////////////////////////////////////////////////
|
||||
export const cmdObjectExplorerEnableGroupBySchemaCommand = 'mssql.enableGroupBySchema';
|
||||
export const cmdObjectExplorerDisableGroupBySchemaCommand = 'mssql.disableGroupBySchema';
|
||||
|
||||
@@ -22,7 +22,7 @@ import { IconPathHelper } from './iconHelper';
|
||||
import * as nls from 'vscode-nls';
|
||||
import { INotebookConvertService } from './notebookConvert/notebookConvertService';
|
||||
import { registerTableDesignerCommands } from './tableDesigner/tableDesigner';
|
||||
import { TelemetryReporter } from './telemetry';
|
||||
import { TelemetryActions, TelemetryReporter, TelemetryViews } from './telemetry';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -63,7 +63,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
|
||||
context.subscriptions.push(server);
|
||||
await server.start(appContext);
|
||||
|
||||
vscode.commands.registerCommand('mssql.exportSqlAsNotebook', async (uri: vscode.Uri) => {
|
||||
context.subscriptions.push(vscode.commands.registerCommand('mssql.exportSqlAsNotebook', async (uri: vscode.Uri) => {
|
||||
try {
|
||||
const result = await appContext.getService<INotebookConvertService>(Constants.NotebookConvertService).convertSqlToNotebook(uri.toString());
|
||||
const title = findNextUntitledEditorName();
|
||||
@@ -72,9 +72,9 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
|
||||
} catch (err) {
|
||||
void vscode.window.showErrorMessage(localize('mssql.errorConvertingToNotebook', "An error occurred converting the SQL document to a Notebook. Error : {0}", err.toString()));
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
vscode.commands.registerCommand('mssql.exportNotebookToSql', async (uri: vscode.Uri) => {
|
||||
context.subscriptions.push(vscode.commands.registerCommand('mssql.exportNotebookToSql', async (uri: vscode.Uri) => {
|
||||
try {
|
||||
// SqlToolsService doesn't currently store anything about Notebook documents so we have to pass the raw JSON to it directly
|
||||
// We use vscode.workspace.textDocuments here because the azdata.nb.notebookDocuments don't actually contain their contents
|
||||
@@ -85,7 +85,30 @@ export async function activate(context: vscode.ExtensionContext): Promise<IExten
|
||||
} catch (err) {
|
||||
void vscode.window.showErrorMessage(localize('mssql.errorConvertingToSQL', "An error occurred converting the Notebook document to SQL. Error : {0}", err.toString()));
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
context.subscriptions.push(vscode.commands.registerCommand(Constants.cmdObjectExplorerEnableGroupBySchemaCommand, async () => {
|
||||
await vscode.workspace.getConfiguration().update(Constants.configObjectExplorerGroupBySchemaFlagName, true, true);
|
||||
}));
|
||||
|
||||
context.subscriptions.push(vscode.commands.registerCommand(Constants.cmdObjectExplorerDisableGroupBySchemaCommand, async () => {
|
||||
await vscode.workspace.getConfiguration().update(Constants.configObjectExplorerGroupBySchemaFlagName, false, true);
|
||||
}));
|
||||
|
||||
context.subscriptions.push(vscode.workspace.onDidChangeConfiguration(async e => {
|
||||
if (e.affectsConfiguration(Constants.configObjectExplorerGroupBySchemaFlagName)) {
|
||||
const groupBySchemaTelemetryActionEvent = vscode.workspace.getConfiguration().get(Constants.configObjectExplorerGroupBySchemaFlagName) ? TelemetryActions.GroupBySchemaEnabled : TelemetryActions.GroupBySchemaDisabled;
|
||||
TelemetryReporter.sendActionEvent(TelemetryViews.MssqlObjectExplorer, groupBySchemaTelemetryActionEvent);
|
||||
const activeConnections = await azdata.objectexplorer.getActiveConnectionNodes();
|
||||
const connections = await azdata.connection.getConnections();
|
||||
activeConnections.forEach(async node => {
|
||||
const connectionProfile = connections.find(c => c.connectionId === node.connectionId);
|
||||
if (connectionProfile?.providerId === Constants.providerId) {
|
||||
await node.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
||||
|
||||
registerTableDesignerCommands(appContext);
|
||||
|
||||
|
||||
@@ -76,3 +76,12 @@ export class LanguageClientErrorHandler implements ErrorHandler {
|
||||
return CloseAction.DoNotRestart;
|
||||
}
|
||||
}
|
||||
|
||||
export enum TelemetryViews {
|
||||
MssqlObjectExplorer = 'mssqlObjectExplorer'
|
||||
}
|
||||
|
||||
export enum TelemetryActions {
|
||||
GroupBySchemaEnabled = 'objectExplorerGroupBySchemaEnabled',
|
||||
GroupBySchemaDisabled = 'objectExplorerGroupBySchemaDisabled',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user