Skip to content

Commit 4798db9

Browse files
committed
🐛 when connection removed, reset connect form
1 parent 3b177b0 commit 4798db9

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/connect/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,13 @@ var ConnectView = View.extend({
197197
this.authMethod = null;
198198
this.authOpen = false;
199199
},
200+
onConnectionDestroyed: function() {
201+
this.reset();
202+
this.form.connection_id = '';
203+
this.form.reset();
204+
this.authMethod = null;
205+
this.authOpen = false;
206+
},
200207

201208
/**
202209
* Triggers when the auth methods has changed (or set back to null)

src/connect/sidebar.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var SidebarItemView = View.extend({
1919
dblclick: 'onDoubleClick',
2020
mouseover: 'onMouseOver',
2121
mouseout: 'onMouseOut',
22-
'click [data-hook=close]': 'onCloseClick'
22+
'click [data-hook=close]': 'onRemoveClick'
2323
},
2424
bindings: {
2525
'model.name': {
@@ -51,10 +51,11 @@ var SidebarItemView = View.extend({
5151
onDoubleClick: function(event) {
5252
this.parent.onItemDoubleClick(event, this);
5353
},
54-
onCloseClick: function(event) {
54+
onRemoveClick: function(event) {
5555
event.stopPropagation();
5656
event.preventDefault();
5757
this.model.destroy();
58+
this.parent.onRemoveClick(event, this);
5859
},
5960
onMouseOver: function() {
6061
this.hover = true;
@@ -93,6 +94,12 @@ var SidebarView = View.extend({
9394
}
9495
this.parent.createNewConnection();
9596
},
97+
onRemoveClick: function(event, view) {
98+
event.stopPropagation();
99+
event.preventDefault();
100+
view.model.destroy();
101+
this.parent.onConnectionDestroyed();
102+
},
96103
onItemClick: function(event, view) {
97104
event.stopPropagation();
98105
event.preventDefault();

0 commit comments

Comments
 (0)