Fixed cancel connectionDialog from attach to shows dup "select connection" (#4865)

This commit is contained in:
Yurong He
2019-04-08 14:06:46 -07:00
committed by GitHub
parent 0975e6834e
commit 88161cc37d
2 changed files with 10 additions and 5 deletions

View File

@@ -668,7 +668,6 @@ export class NotebookModel extends Disposable implements INotebookModel {
});
} else {
this._onValidConnectionSelected.fire(false);
throw new Error('No valid connection');
}
} catch (err) {
let msg = notebookUtils.getErrorMessage(err);

View File

@@ -387,8 +387,10 @@ export class AttachToDropdown extends SelectBox {
this.selectWithOptionName(msgSelectConnection);
}
else {
if (!connections.includes(msgAddNewConnection)) {
connections.push(msgAddNewConnection);
}
}
this.setOptions(connections);
}
}
@@ -396,9 +398,13 @@ export class AttachToDropdown extends SelectBox {
private loadWithSelectConnection(connections: string[]): string[] {
if (connections && connections.length > 0) {
if (!connections.includes(msgSelectConnection)) {
connections.unshift(msgSelectConnection);
}
this.selectWithOptionName(msgSelectConnection);
if (!connections.includes(msgAddNewConnection)) {
connections.push(msgAddNewConnection);
}
this.setOptions(connections);
}
return connections;