Skip to content

Commit

Permalink
fix(ui): better ui add/remove dialog feedback (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando authored Feb 4, 2021
1 parent 3bec169 commit 325be03
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/components/ControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default {
text: `${this.addRemoveAction} stopped, checking nodes…`
}
this.addRemoveStatus = 'wait'
setTimeout(this.showResults, 1000) // add additional discovery time
this.waitTimeout = setTimeout(this.showResults, 5000) // add additional discovery time
} else {
// error
this.addRemoveEndDate = new Date()
Expand All @@ -160,6 +160,7 @@ export default {
addRemoveShowDialog: false,
addRemoveAction: null,
addRemoveStatus: 'stop',
waitTimeout: null,
addRemoveAlert: null,
addRemoveEndDate: new Date(),
addRemoveTimer: null,
Expand Down Expand Up @@ -286,6 +287,11 @@ export default {
this.apiRequest(action.method + action.baseAction, args)
},
showResults () {
if (this.waitTimeout) {
clearTimeout(this.waitTimeout)
this.waitTimeout = null
}
this.addRemoveAlert = null
if (this.addRemoveNode == null) {
Expand Down Expand Up @@ -439,6 +445,10 @@ export default {
},
onNodeAddedRemoved (node) {
this.addRemoveNode = node
// the add/remove dialog is waiting for a feedback
if (this.waitTimeout) {
this.showResults()
}
},
bindEvent (eventName, handler) {
this.socket.on(socketEvents[eventName], handler)
Expand All @@ -465,6 +475,10 @@ export default {
if (this.addRemoveTimer) {
clearInterval(this.addRemoveTimer)
}
if (this.waitTimeout) {
clearTimeout(this.waitTimeout)
}
}
}
</script>

0 comments on commit 325be03

Please sign in to comment.