mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -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',
|
||||
}
|
||||
|
||||
@@ -1,25 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{opacity:0;fill:#F6F6F6;}
|
||||
.st1{fill:#F6F6F6;}
|
||||
.st2{fill:#424242;}
|
||||
.st3{fill:#F0EFF1;}
|
||||
</style>
|
||||
<g id="outline">
|
||||
<rect class="st0" width="16" height="16"/>
|
||||
<path class="st1" d="M16,16H1V0h15V16z"/>
|
||||
</g>
|
||||
<g id="icon_x5F_bg">
|
||||
<path class="st2" d="M2,1v14h13V1H2z M14,14H3V3h11V14z"/>
|
||||
<path class="st2" d="M12.5,10H11L9.5,7h1L11,6.5v-2L10.5,4h-4L6,4.5v2L6.5,7h1L6,10H4.5L4,10.5v2L4.5,13h3L8,12.5v-2L7.5,10H7
|
||||
l1.5-3l1.5,3H9.5L9,10.5v2L9.5,13h3l0.5-0.5v-2L12.5,10z M7,12H5v-1h2V12z M8,6H7V5h3v1H9H8z M12,12h-2v-1h2V12z"/>
|
||||
</g>
|
||||
<g id="icon_x5F_fg">
|
||||
<path class="st3" d="M5,11h2v1H5V11z M10,12h2v-1h-2V12z M10,5H7v1h3V5z M14,3v11H3V3H14z M13,10.5L12.5,10H11L9.5,7h1L11,6.5v-2
|
||||
L10.5,4h-4L6,4.5v2L6.5,7h1L6,10H4.5L4,10.5v2L4.5,13h3L8,12.5v-2L7.5,10H7l1.5-3l1.5,3H9.5L9,10.5v2L9.5,13h3l0.5-0.5V10.5z"/>
|
||||
</g>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
||||
<style>
|
||||
.icon-canvas-transparent {
|
||||
opacity: 0;
|
||||
fill: #000000
|
||||
}
|
||||
|
||||
.icon-vs-out {
|
||||
fill: #f6f6f6
|
||||
}
|
||||
|
||||
.icon-vs-bg {
|
||||
fill: #424242
|
||||
}
|
||||
|
||||
.icon-vs-fg {
|
||||
fill: #f0eff1
|
||||
}
|
||||
|
||||
.icon-vs-blue {
|
||||
fill: #1ba1e2
|
||||
}
|
||||
</style>
|
||||
<path class="icon-canvas-transparent" d="M16 0v16H0V0h16z" id="canvas" />
|
||||
<path class="icon-vs-out"
|
||||
d="M16 3v6c0 1.711-2.149 3-5 3-.345 0-.678-.021-1-.057V12h1v4H6v-4H5v4H0v-4h1V9h2V5h3V3c0-1.711 2.149-3 5-3s5 1.289 5 3z"
|
||||
id="outline" />
|
||||
<path class="icon-vs-fg"
|
||||
d="M14.325 3c0 .527-1.326 1.325-3.325 1.325S7.675 3.527 7.675 3 9.001 1.675 11 1.675s3.325.798 3.325 1.325z"
|
||||
id="iconFg" />
|
||||
<g id="iconBg">
|
||||
<path class="icon-vs-blue"
|
||||
d="M11 1c-2.209 0-4 .896-4 2v2h1v4h2v1.93c.321.041.652.07 1 .07 2.209 0 4-.896 4-2V3c0-1.104-1.791-2-4-2zm0 3.325c-1.999 0-3.325-.798-3.325-1.325S9.001 1.675 11 1.675s3.325.798 3.325 1.325S12.999 4.325 11 4.325z" />
|
||||
<path class="icon-vs-bg" d="M10 13v2H7v-2h1v-2H3v2h1v2H1v-2h1v-3h3V8H4V6h3v2H6v2h3v3h1z" />
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.0 KiB |
Reference in New Issue
Block a user