mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Setting right options of command based new connections (#23849)
This commit is contained in:
@@ -11,7 +11,7 @@ import { Action2, MenuId, MenuRegistry, registerAction2 } from 'vs/platform/acti
|
|||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
import { ConnectionStatusbarItem } from 'sql/workbench/contrib/connection/browser/connectionStatus';
|
import { ConnectionStatusbarItem } from 'sql/workbench/contrib/connection/browser/connectionStatus';
|
||||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
import { ConnectionType, IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||||
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 { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||||
@@ -21,6 +21,7 @@ import { ContextKeyEqualsExpr } from 'vs/platform/contextkey/common/contextkey';
|
|||||||
import { ActiveConnectionsFilterAction, AddServerAction, AddServerGroupAction } from 'sql/workbench/services/objectExplorer/browser/connectionTreeAction';
|
import { ActiveConnectionsFilterAction, AddServerAction, AddServerGroupAction } from 'sql/workbench/services/objectExplorer/browser/connectionTreeAction';
|
||||||
import { CONTEXT_SERVER_TREE_VIEW, CONTEXT_SERVER_TREE_HAS_CONNECTIONS } from 'sql/workbench/contrib/objectExplorer/browser/serverTreeView';
|
import { CONTEXT_SERVER_TREE_VIEW, CONTEXT_SERVER_TREE_HAS_CONNECTIONS } from 'sql/workbench/contrib/objectExplorer/browser/serverTreeView';
|
||||||
import { SqlIconId } from 'sql/base/common/codicons';
|
import { SqlIconId } from 'sql/base/common/codicons';
|
||||||
|
import * as Utils from 'sql/platform/connection/common/utils';
|
||||||
|
|
||||||
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
||||||
|
|
||||||
@@ -132,23 +133,31 @@ CommandsRegistry.registerCommand('azdata.connect',
|
|||||||
groupFullName: undefined,
|
groupFullName: undefined,
|
||||||
saveProfile: true,
|
saveProfile: true,
|
||||||
id: undefined,
|
id: undefined,
|
||||||
groupId: undefined,
|
groupId: Utils.defaultGroupId,
|
||||||
options: args.options
|
options: args.options
|
||||||
};
|
};
|
||||||
const connectionProfile = ConnectionProfile.fromIConnectionProfile(capabilitiesServices, profile);
|
const connectionProfile = ConnectionProfile.fromIConnectionProfile(capabilitiesServices, profile);
|
||||||
|
const root = connectionManagementService.getConnectionGroups().filter(g => g.id === Utils.defaultGroupId)[0];
|
||||||
|
connectionProfile.parent = root;
|
||||||
|
connectionProfile.groupFullName = root.fullName;
|
||||||
connectionManagementService.connect(connectionProfile, undefined, {
|
connectionManagementService.connect(connectionProfile, undefined, {
|
||||||
saveTheConnection: true,
|
saveTheConnection: true,
|
||||||
showDashboard: true,
|
showDashboard: true,
|
||||||
showConnectionDialogOnError: true,
|
showConnectionDialogOnError: true,
|
||||||
showFirewallRuleOnError: true
|
showFirewallRuleOnError: true,
|
||||||
|
params: {
|
||||||
|
connectionType: ConnectionType.default,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
connectionManagementService.showConnectionDialog(undefined, {
|
connectionManagementService.showConnectionDialog(undefined, {
|
||||||
saveTheConnection: true,
|
saveTheConnection: true,
|
||||||
showDashboard: true,
|
showDashboard: true,
|
||||||
showConnectionDialogOnError: true,
|
showConnectionDialogOnError: true,
|
||||||
showFirewallRuleOnError: true
|
showFirewallRuleOnError: true,
|
||||||
|
params: {
|
||||||
|
connectionType: ConnectionType.default,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user