mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Move rest of DE actions into package contributions (#11755)
* Move rest of DE actions into package contributions * Add sql-database-projects import
This commit is contained in:
@@ -48,6 +48,23 @@
|
|||||||
"when": "connectionProvider == MSSQL && nodeType && nodeType == Folder && nodeLabel == 'Databases' && mssql:engineedition != 11",
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Folder && nodeLabel == 'Databases' && mssql:engineedition != 11",
|
||||||
"group": "export"
|
"group": "export"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"dataExplorer/context": [
|
||||||
|
{
|
||||||
|
"command": "dacFx.start",
|
||||||
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Database && mssql:engineedition != 11",
|
||||||
|
"group": "export"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "dacFx.start",
|
||||||
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Server && mssql:engineedition != 11",
|
||||||
|
"group": "export"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "dacFx.start",
|
||||||
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Folder && nodeLabel == 'Databases' && mssql:engineedition != 11",
|
||||||
|
"group": "export"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -49,6 +49,13 @@
|
|||||||
"when": "connectionProvider == MSSQL && nodeType && nodeType == Database && mssql:engineedition != 11",
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Database && mssql:engineedition != 11",
|
||||||
"group": "import"
|
"group": "import"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"dataExplorer/context": [
|
||||||
|
{
|
||||||
|
"command": "flatFileImport.start",
|
||||||
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Database && mssql:engineedition != 11",
|
||||||
|
"group": "import"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"configuration": {
|
"configuration": {
|
||||||
|
|||||||
@@ -69,6 +69,13 @@
|
|||||||
"when": "connectionProvider == MSSQL && nodeType && nodeType == Server && mssql:engineedition != 11",
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Server && mssql:engineedition != 11",
|
||||||
"group": "profiler"
|
"group": "profiler"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"dataExplorer/context": [
|
||||||
|
{
|
||||||
|
"command": "profiler.newProfiler",
|
||||||
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Server && mssql:engineedition != 11",
|
||||||
|
"group": "profiler"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"outputChannels": [
|
"outputChannels": [
|
||||||
|
|||||||
@@ -60,6 +60,18 @@
|
|||||||
"when": "connectionProvider == MSSQL && nodeType && nodeType == Server && mssql:engineedition != 11",
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Server && mssql:engineedition != 11",
|
||||||
"group": "export"
|
"group": "export"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"dataExplorer/context": [
|
||||||
|
{
|
||||||
|
"command": "schemaCompare.start",
|
||||||
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Database && mssql:engineedition != 11",
|
||||||
|
"group": "export"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "schemaCompare.start",
|
||||||
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Server && mssql:engineedition != 11",
|
||||||
|
"group": "export"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -282,6 +282,14 @@
|
|||||||
"group": "export"
|
"group": "export"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
"dataExplorer/context": [
|
||||||
|
{
|
||||||
|
"command": "sqlDatabaseProjects.importDatabase",
|
||||||
|
"when": "connectionProvider == MSSQL && nodeType && nodeType == Database && mssql:engineedition != 11",
|
||||||
|
"group": "export"
|
||||||
|
}
|
||||||
|
],
|
||||||
"dashboard/toolbar": [
|
"dashboard/toolbar": [
|
||||||
{
|
{
|
||||||
"command": "sqlDatabaseProjects.importDatabase",
|
"command": "sqlDatabaseProjects.importDatabase",
|
||||||
|
|||||||
@@ -1,111 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
|
|
||||||
import { TreeViewItemHandleArg } from 'sql/workbench/common/views';
|
|
||||||
import * as azdata from 'azdata';
|
|
||||||
import { IOEShimService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerViewTreeShim';
|
|
||||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
|
||||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
|
||||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
|
||||||
|
|
||||||
export const DATA_TIER_WIZARD_COMMAND_ID = 'dataExplorer.dataTierWizard';
|
|
||||||
export const PROFILER_COMMAND_ID = 'dataExplorer.profiler';
|
|
||||||
export const IMPORT_COMMAND_ID = 'dataExplorer.flatFileImport';
|
|
||||||
export const SCHEMA_COMPARE_COMMAND_ID = 'dataExplorer.schemaCompare';
|
|
||||||
export const GENERATE_SCRIPTS_COMMAND_ID = 'dataExplorer.generateScripts';
|
|
||||||
export const PROPERTIES_COMMAND_ID = 'dataExplorer.properties';
|
|
||||||
export const IMPORT_DATABASE_COMMAND_ID = 'dataExplorer.importDatabase';
|
|
||||||
|
|
||||||
|
|
||||||
// Data Tier Wizard
|
|
||||||
CommandsRegistry.registerCommand({
|
|
||||||
id: DATA_TIER_WIZARD_COMMAND_ID,
|
|
||||||
handler: (accessor, args: TreeViewItemHandleArg) => {
|
|
||||||
const commandService = accessor.get(ICommandService);
|
|
||||||
const connectedContext: azdata.ConnectedContext = { connectionProfile: args.$treeItem.payload };
|
|
||||||
return commandService.executeCommand('dacFx.start', connectedContext);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
// Flat File Import
|
|
||||||
CommandsRegistry.registerCommand({
|
|
||||||
id: IMPORT_COMMAND_ID,
|
|
||||||
handler: (accessor, args: TreeViewItemHandleArg) => {
|
|
||||||
const commandService = accessor.get(ICommandService);
|
|
||||||
let connectedContext: azdata.ConnectedContext = { connectionProfile: args.$treeItem.payload };
|
|
||||||
return commandService.executeCommand('flatFileImport.start', connectedContext);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Schema Compare
|
|
||||||
CommandsRegistry.registerCommand({
|
|
||||||
id: SCHEMA_COMPARE_COMMAND_ID,
|
|
||||||
handler: (accessor, args: TreeViewItemHandleArg) => {
|
|
||||||
const commandService = accessor.get(ICommandService);
|
|
||||||
let connectedContext: azdata.ConnectedContext = { connectionProfile: args.$treeItem.payload };
|
|
||||||
return commandService.executeCommand('schemaCompare.start', connectedContext);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Profiler
|
|
||||||
CommandsRegistry.registerCommand({
|
|
||||||
id: PROFILER_COMMAND_ID,
|
|
||||||
handler: (accessor, args: TreeViewItemHandleArg) => {
|
|
||||||
const commandService = accessor.get(ICommandService);
|
|
||||||
const oeShimService = accessor.get(IOEShimService);
|
|
||||||
const objectExplorerContext: azdata.ObjectExplorerContext = {
|
|
||||||
connectionProfile: args.$treeItem.payload,
|
|
||||||
isConnectionNode: true,
|
|
||||||
nodeInfo: oeShimService.getNodeInfoForTreeItem(args.$treeItem)
|
|
||||||
};
|
|
||||||
return commandService.executeCommand('profiler.newProfiler', objectExplorerContext);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Generate Scripts
|
|
||||||
CommandsRegistry.registerCommand({
|
|
||||||
id: GENERATE_SCRIPTS_COMMAND_ID,
|
|
||||||
handler: (accessor, args: TreeViewItemHandleArg) => {
|
|
||||||
const commandService = accessor.get(ICommandService);
|
|
||||||
const oeShimService = accessor.get(IOEShimService);
|
|
||||||
const objectExplorerContext: azdata.ObjectExplorerContext = {
|
|
||||||
connectionProfile: args.$treeItem.payload,
|
|
||||||
isConnectionNode: true,
|
|
||||||
nodeInfo: oeShimService.getNodeInfoForTreeItem(args.$treeItem)
|
|
||||||
};
|
|
||||||
return commandService.executeCommand('adminToolExtWin.launchSsmsMinGswDialog', objectExplorerContext);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Properties
|
|
||||||
CommandsRegistry.registerCommand({
|
|
||||||
id: PROPERTIES_COMMAND_ID,
|
|
||||||
handler: async (accessor, args: TreeViewItemHandleArg) => {
|
|
||||||
const commandService = accessor.get(ICommandService);
|
|
||||||
const capabilitiesService = accessor.get(ICapabilitiesService);
|
|
||||||
const connectionManagementService = accessor.get(IConnectionManagementService);
|
|
||||||
const oeShimService = accessor.get(IOEShimService);
|
|
||||||
const profile = new ConnectionProfile(capabilitiesService, args.$treeItem.payload);
|
|
||||||
await connectionManagementService.connectIfNotConnected(profile);
|
|
||||||
const objectExplorerContext: azdata.ObjectExplorerContext = {
|
|
||||||
connectionProfile: args.$treeItem.payload,
|
|
||||||
isConnectionNode: true,
|
|
||||||
nodeInfo: oeShimService.getNodeInfoForTreeItem(args.$treeItem)
|
|
||||||
};
|
|
||||||
return commandService.executeCommand('adminToolExtWin.launchSsmsMinPropertiesDialog', objectExplorerContext);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Import Database
|
|
||||||
CommandsRegistry.registerCommand({
|
|
||||||
id: IMPORT_DATABASE_COMMAND_ID,
|
|
||||||
handler: (accessor, args: TreeViewItemHandleArg) => {
|
|
||||||
const commandService = accessor.get(ICommandService);
|
|
||||||
let connectedContext: azdata.ConnectedContext = { connectionProfile: args.$treeItem.payload };
|
|
||||||
return commandService.executeCommand('sqlDatabaseProjects.importDatabase', connectedContext);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------------------------
|
|
||||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
||||||
*--------------------------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
|
||||||
import { DATA_TIER_WIZARD_COMMAND_ID, PROFILER_COMMAND_ID, IMPORT_COMMAND_ID, SCHEMA_COMPARE_COMMAND_ID, IMPORT_DATABASE_COMMAND_ID } from 'sql/workbench/contrib/dataExplorer/browser/extensionActions';
|
|
||||||
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
|
||||||
import { MssqlNodeContext } from 'sql/workbench/services/objectExplorer/browser/mssqlNodeContext';
|
|
||||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
|
||||||
import { NodeType } from 'sql/workbench/services/objectExplorer/common/nodeType';
|
|
||||||
import { localize } from 'vs/nls';
|
|
||||||
import { DatabaseEngineEdition } from 'sql/workbench/api/common/sqlExtHostTypes';
|
|
||||||
|
|
||||||
// Data-Tier Application Wizard
|
|
||||||
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
|
||||||
group: 'export',
|
|
||||||
order: 7,
|
|
||||||
command: {
|
|
||||||
id: DATA_TIER_WIZARD_COMMAND_ID,
|
|
||||||
title: localize('dacFx', "Data-tier Application Wizard")
|
|
||||||
},
|
|
||||||
when: ContextKeyExpr.and(MssqlNodeContext.NodeProvider.isEqualTo(mssqlProviderName),
|
|
||||||
MssqlNodeContext.IsDatabaseOrServer, MssqlNodeContext.EngineEdition.notEqualsTo(DatabaseEngineEdition.SqlOnDemand.toString()))
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
|
||||||
group: 'export',
|
|
||||||
order: 7,
|
|
||||||
command: {
|
|
||||||
id: DATA_TIER_WIZARD_COMMAND_ID,
|
|
||||||
title: localize('dacFx', "Data-tier Application Wizard")
|
|
||||||
},
|
|
||||||
when: ContextKeyExpr.and(MssqlNodeContext.NodeProvider.isEqualTo(mssqlProviderName),
|
|
||||||
MssqlNodeContext.NodeType.isEqualTo(NodeType.Folder),
|
|
||||||
MssqlNodeContext.NodeLabel.isEqualTo('Databases'),
|
|
||||||
MssqlNodeContext.EngineEdition.notEqualsTo(DatabaseEngineEdition.SqlOnDemand.toString()))
|
|
||||||
});
|
|
||||||
|
|
||||||
// Import Database
|
|
||||||
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
|
||||||
group: 'export',
|
|
||||||
order: 8,
|
|
||||||
command: {
|
|
||||||
id: IMPORT_DATABASE_COMMAND_ID,
|
|
||||||
title: localize('importDatabase', "Import New Database Project")
|
|
||||||
},
|
|
||||||
when: ContextKeyExpr.and(MssqlNodeContext.NodeProvider.isEqualTo(mssqlProviderName),
|
|
||||||
MssqlNodeContext.NodeType.isEqualTo(NodeType.Database), MssqlNodeContext.EngineEdition.notEqualsTo(DatabaseEngineEdition.SqlOnDemand.toString()))
|
|
||||||
});
|
|
||||||
|
|
||||||
// Profiler
|
|
||||||
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
|
||||||
group: 'profiler',
|
|
||||||
order: 9,
|
|
||||||
command: {
|
|
||||||
id: PROFILER_COMMAND_ID,
|
|
||||||
title: localize('profiler', "Launch Profiler")
|
|
||||||
},
|
|
||||||
when: ContextKeyExpr.and(MssqlNodeContext.NodeProvider.isEqualTo(mssqlProviderName),
|
|
||||||
MssqlNodeContext.NodeType.isEqualTo(NodeType.Server), MssqlNodeContext.EngineEdition.notEqualsTo(DatabaseEngineEdition.SqlOnDemand.toString()))
|
|
||||||
});
|
|
||||||
|
|
||||||
// Schema Compare
|
|
||||||
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
|
||||||
group: 'export',
|
|
||||||
order: 10,
|
|
||||||
command: {
|
|
||||||
id: SCHEMA_COMPARE_COMMAND_ID,
|
|
||||||
title: localize('schemaCompare', "Schema Compare")
|
|
||||||
},
|
|
||||||
when: ContextKeyExpr.and(MssqlNodeContext.NodeProvider.isEqualTo(mssqlProviderName),
|
|
||||||
MssqlNodeContext.NodeType.isEqualTo(NodeType.Database), MssqlNodeContext.EngineEdition.notEqualsTo(DatabaseEngineEdition.SqlOnDemand.toString()))
|
|
||||||
});
|
|
||||||
|
|
||||||
// Flat File Import
|
|
||||||
MenuRegistry.appendMenuItem(MenuId.DataExplorerContext, {
|
|
||||||
group: 'import',
|
|
||||||
order: 11,
|
|
||||||
command: {
|
|
||||||
id: IMPORT_COMMAND_ID,
|
|
||||||
title: localize('flatFileImport', "Import Wizard")
|
|
||||||
},
|
|
||||||
when: ContextKeyExpr.and(MssqlNodeContext.NodeProvider.isEqualTo(mssqlProviderName),
|
|
||||||
MssqlNodeContext.NodeType.isEqualTo(NodeType.Database))
|
|
||||||
});
|
|
||||||
@@ -12,7 +12,6 @@ import * as TaskUtilities from 'sql/workbench/browser/taskUtilities';
|
|||||||
import { IProfilerService } from 'sql/workbench/services/profiler/browser/interfaces';
|
import { IProfilerService } from 'sql/workbench/services/profiler/browser/interfaces';
|
||||||
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||||
import { ProfilerEditor } from 'sql/workbench/contrib/profiler/browser/profilerEditor';
|
import { ProfilerEditor } from 'sql/workbench/contrib/profiler/browser/profilerEditor';
|
||||||
import { ObjectExplorerActionsContext } from 'sql/workbench/services/objectExplorer/browser/objectExplorerActions';
|
|
||||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||||
@@ -32,9 +31,12 @@ CommandsRegistry.registerCommand({
|
|||||||
let capabilitiesService: ICapabilitiesService = accessor.get(ICapabilitiesService);
|
let capabilitiesService: ICapabilitiesService = accessor.get(ICapabilitiesService);
|
||||||
|
|
||||||
// If a context is available if invoked from the context menu, we will use the connection profiler of the server node
|
// If a context is available if invoked from the context menu, we will use the connection profiler of the server node
|
||||||
if (args && args.length === 1 && args[0] && args[0] instanceof ObjectExplorerActionsContext) {
|
if (args[0]?.connectionProfile) {
|
||||||
let context = args[0] as ObjectExplorerActionsContext;
|
connectionProfile = ConnectionProfile.fromIConnectionProfile(capabilitiesService, args[0].connectionProfile);
|
||||||
connectionProfile = ConnectionProfile.fromIConnectionProfile(capabilitiesService, context.connectionProfile);
|
} else if (args[0]?.$treeItem.payload) {
|
||||||
|
// Because this is contributed from core it doesn't go through the argument processor that extension commands do
|
||||||
|
// so we just pull out the payload directly
|
||||||
|
connectionProfile = ConnectionProfile.fromIConnectionProfile(capabilitiesService, args[0].$treeItem.payload);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// No context available, we will try to get the current global active connection
|
// No context available, we will try to get the current global active connection
|
||||||
|
|||||||
@@ -404,7 +404,6 @@ import 'sql/workbench/contrib/query/common/resultsGrid.contribution';
|
|||||||
// data explorer
|
// data explorer
|
||||||
import 'sql/workbench/contrib/dataExplorer/browser/dataExplorer.contribution';
|
import 'sql/workbench/contrib/dataExplorer/browser/dataExplorer.contribution';
|
||||||
import 'sql/workbench/contrib/dataExplorer/browser/nodeActions.common.contribution';
|
import 'sql/workbench/contrib/dataExplorer/browser/nodeActions.common.contribution';
|
||||||
import 'sql/workbench/contrib/dataExplorer/browser/extensions.contribution';
|
|
||||||
|
|
||||||
//editor replacement
|
//editor replacement
|
||||||
import 'sql/workbench/contrib/editorReplacement/common/editorReplacer.contribution';
|
import 'sql/workbench/contrib/editorReplacement/common/editorReplacer.contribution';
|
||||||
|
|||||||
Reference in New Issue
Block a user