diff --git a/src/components/ControlPanel.vue b/src/components/ControlPanel.vue index d90474bd47c..726626567c6 100644 --- a/src/components/ControlPanel.vue +++ b/src/components/ControlPanel.vue @@ -28,7 +28,7 @@ - + - + a.value === this.cnt_action) if (askId) { - var id = parseInt(prompt('Node ID')) + broadcast = await this.$refs.confirm.open( + 'Broadcast', + 'Send this command to all nodes?' + ) - if (isNaN(id)) { - this.showMessage('Node ID must be an integer value') - return + if (!broadcast) { + var id = parseInt(prompt('Node ID')) + + if (isNaN(id)) { + this.showMessage('Node ID must be an integer value') + return + } + args.push(id) } - args.push(id) } if (this.cnt_action === 'addNode') { @@ -1222,7 +1230,14 @@ export default { } } - this.apiRequest(this.cnt_action, args) + if (broadcast) { + for (let i = 0; i < this.nodes.length; i++) { + const nodeid = this.nodes[i].node_id + this.apiRequest(this.cnt_action, [nodeid]) + } + } else { + this.apiRequest(this.cnt_action, args) + } } }, sendNodeAction (action) {