Make sure new queries are connected for unsaved password (#2633)

This commit is contained in:
Matt Irvine
2018-09-26 16:21:07 -04:00
committed by GitHub
parent 79c69d03fa
commit 810073a79b
6 changed files with 14 additions and 31 deletions

View File

@@ -33,7 +33,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
public constructor(
capabilitiesService: ICapabilitiesService,
model: string | interfaces.IConnectionProfile
model: string | sqlops.IConnectionProfile
) {
super(capabilitiesService, model);
if (model && !isString(model)) {
@@ -171,7 +171,7 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
};
}
public static fromIConnectionProfile(capabilitiesService: ICapabilitiesService, profile: interfaces.IConnectionProfile) {
public static fromIConnectionProfile(capabilitiesService: ICapabilitiesService, profile: sqlops.IConnectionProfile) {
if (profile) {
if (profile instanceof ConnectionProfile) {
return profile;

View File

@@ -26,7 +26,7 @@ export class ProviderConnectionInfo extends Disposable implements sqlops.Connect
public constructor(
protected capabilitiesService: ICapabilitiesService,
model: string | interfaces.IConnectionProfile
model: string | sqlops.IConnectionProfile
) {
super();
// we can't really do a whole lot if we don't have a provider
@@ -195,8 +195,8 @@ export class ProviderConnectionInfo extends Disposable implements sqlops.Connect
if (this._serverCapabilities) {
idNames = this._serverCapabilities.connectionOptions.map(o => {
if ((o.specialValueType || o.isIdentity)
&& o.specialValueType !== ConnectionOptionSpecialType.password
&& o.specialValueType !== ConnectionOptionSpecialType.connectionName) {
&& o.specialValueType !== ConnectionOptionSpecialType.password
&& o.specialValueType !== ConnectionOptionSpecialType.connectionName) {
return o.name;
} else {
return undefined;

View File

@@ -6,9 +6,9 @@
import { localize } from 'vs/nls';
import { TPromise } from 'vs/base/common/winjs.base';
import { Action } from 'vs/base/common/actions';
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile';
import { IConnectionManagementService, IErrorMessageService } from 'sql/parts/connection/common/connectionManagement';
import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesService';
import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
import { ServerTreeView } from 'sql/parts/objectExplorer/viewlet/serverTreeView';
import { ConnectionViewlet } from 'sql/parts/objectExplorer/viewlet/connectionViewlet';
@@ -20,7 +20,7 @@ import * as Constants from 'sql/parts/connection/common/constants';
import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService';
import { TreeNode } from 'sql/parts/objectExplorer/common/treeNode';
import Severity from 'vs/base/common/severity';
import { ObjectExplorerActionsContext, ObjectExplorerActionUtilities } from 'sql/parts/objectExplorer/viewlet/objectExplorerActions';
import { ObjectExplorerActionsContext } from 'sql/parts/objectExplorer/viewlet/objectExplorerActions';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
export class RefreshAction extends Action {
@@ -323,7 +323,8 @@ export class NewQueryAction extends Action {
@IQueryEditorService private queryEditorService: IQueryEditorService,
@IConnectionManagementService private connectionManagementService: IConnectionManagementService,
@IObjectExplorerService protected _objectExplorerService: IObjectExplorerService,
@IEditorService protected _workbenchEditorService: IEditorService
@IEditorService protected _workbenchEditorService: IEditorService,
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService
) {
super(id, label);
this.class = 'extension-action update';
@@ -331,7 +332,7 @@ export class NewQueryAction extends Action {
public run(actionContext: ObjectExplorerActionsContext): TPromise<boolean> {
if (actionContext instanceof ObjectExplorerActionsContext) {
this._connectionProfile = actionContext.connectionProfile;
this._connectionProfile = new ConnectionProfile(this._capabilitiesService, actionContext.connectionProfile);
}
TaskUtilities.newQuery(this._connectionProfile, this.connectionManagementService, this.queryEditorService, this._objectExplorerService, this._workbenchEditorService);

View File

@@ -32,7 +32,7 @@ import { ConnectionProfile } from 'sql/parts/connection/common/connectionProfile
export class ObjectExplorerActionsContext implements sqlops.ObjectExplorerContext {
public connectionProfile: IConnectionProfile;
public connectionProfile: sqlops.IConnectionProfile;
public nodeInfo: sqlops.NodeInfo;
public isConnectionNode: boolean = false;
}
@@ -52,8 +52,8 @@ export class OEAction extends ExecuteCommandAction {
id: string, label: string,
@IInstantiationService private _instantiationService: IInstantiationService,
@ICommandService commandService: ICommandService,
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService
) {
super(id, label, commandService);
}
@@ -65,7 +65,7 @@ export class OEAction extends ExecuteCommandAction {
let profile: IConnectionProfile;
if (actionContext instanceof ObjectExplorerActionsContext) {
if (actionContext.isConnectionNode) {
profile = actionContext.connectionProfile;
profile = new ConnectionProfile(this._capabilitiesService, actionContext.connectionProfile);
} else {
// Get the "correct" version from the tree
let treeNode = await getTreeNode(actionContext, this._objectExplorerService);