mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
'Attach to' with Spark kernel resets to sql connection on cancelling connection dialog (#4024)
* Sql connection resets to Select Connection on cancelling dialog * Hiding error message wehen cancel the connection dialog
This commit is contained in:
@@ -341,7 +341,7 @@ export interface INotebookModel {
|
|||||||
/**
|
/**
|
||||||
* Change the current context (if applicable)
|
* Change the current context (if applicable)
|
||||||
*/
|
*/
|
||||||
changeContext(host: string, connection?: IConnectionProfile): Promise<void>;
|
changeContext(host: string, connection?: IConnectionProfile, hideErrorMessage?: boolean): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a cell's index given its model
|
* Find a cell's index given its model
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async changeContext(server: string, newConnection?: IConnectionProfile): Promise<void> {
|
public async changeContext(server: string, newConnection?: IConnectionProfile, hideErrorMessage?: boolean): Promise<void> {
|
||||||
try {
|
try {
|
||||||
if (!newConnection) {
|
if (!newConnection) {
|
||||||
newConnection = this._activeContexts.otherConnections.find((connection) => connection.serverName === server);
|
newConnection = this._activeContexts.otherConnections.find((connection) => connection.serverName === server);
|
||||||
@@ -467,7 +467,9 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
|||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
if (error) {
|
if (error) {
|
||||||
this.notifyError(notebookUtils.getErrorMessage(error));
|
if (!hideErrorMessage) {
|
||||||
|
this.notifyError(notebookUtils.getErrorMessage(error));
|
||||||
|
}
|
||||||
//Selected a wrong connection, Attach to should be defaulted with 'Select connection'
|
//Selected a wrong connection, Attach to should be defaulted with 'Select connection'
|
||||||
this._onValidConnectionSelected.fire(false);
|
this._onValidConnectionSelected.fire(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -392,11 +392,11 @@ export class AttachToDropdown extends SelectBox {
|
|||||||
return otherConnections;
|
return otherConnections;
|
||||||
}
|
}
|
||||||
|
|
||||||
public doChangeContext(connection?: ConnectionProfile): void {
|
public doChangeContext(connection?: ConnectionProfile, hideErrorMessage?: boolean): void {
|
||||||
if (this.value === msgAddNewConnection) {
|
if (this.value === msgAddNewConnection) {
|
||||||
this.openConnectionDialog();
|
this.openConnectionDialog();
|
||||||
} else {
|
} else {
|
||||||
this.model.changeContext(this.value, connection).then(ok => undefined, err => this._notificationService.error(getErrorMessage(err)));
|
this.model.changeContext(this.value, connection, hideErrorMessage).then(ok => undefined, err => this._notificationService.error(getErrorMessage(err)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,6 +412,7 @@ export class AttachToDropdown extends SelectBox {
|
|||||||
let attachToConnections = this.values;
|
let attachToConnections = this.values;
|
||||||
if (!connection) {
|
if (!connection) {
|
||||||
this.loadAttachToDropdown(this.model, this.getKernelDisplayName());
|
this.loadAttachToDropdown(this.model, this.getKernelDisplayName());
|
||||||
|
this.doChangeContext(undefined, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let connectionProfile = new ConnectionProfile(this._capabilitiesService, connection);
|
let connectionProfile = new ConnectionProfile(this._capabilitiesService, connection);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export class NotebookModelStub implements INotebookModel {
|
|||||||
changeKernel(displayName: string): void {
|
changeKernel(displayName: string): void {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
changeContext(host: string, connection?: IConnectionProfile): Promise<void> {
|
changeContext(host: string, connection?: IConnectionProfile, hideErrorMessage?: boolean): Promise<void> {
|
||||||
throw new Error('Method not implemented.');
|
throw new Error('Method not implemented.');
|
||||||
}
|
}
|
||||||
findCellIndex(cellModel: ICellModel): number {
|
findCellIndex(cellModel: ICellModel): number {
|
||||||
|
|||||||
Reference in New Issue
Block a user