From bd7b9c10aa3ec495e2e332277b7d55a4cbbd18a0 Mon Sep 17 00:00:00 2001 From: Oliver Gerlich Date: Sat, 21 Jul 2018 19:43:26 +0200 Subject: [PATCH] node page: add "Reset Location" button, to unset node location This can be helpful if the node was placed far away (eg. due to IP-based geolocation). --- webroot/js/view/node.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/webroot/js/view/node.js b/webroot/js/view/node.js index 90ad3e2..eb0f0ee 100644 --- a/webroot/js/view/node.js +++ b/webroot/js/view/node.js @@ -144,6 +144,18 @@ export class NodeView extends View { } this.gpsStatusText = domlib.newAt(this.el, 'span'); this.gpsStatusText.classList.add('withTextMargins'); + + this.resetLocationBtn = domlib.newAt(this.el, 'span'); + this.resetLocationBtn.classList.add('btn'); + this.resetLocationBtn.innerHTML = 'Reset Location'; + this.resetLocationBtn.addEventListener('click', () => { + const node = store.getNode(this.currentNodeID) || store.createNode(this.currentNodeID), + localNodeCopy = Object.assign({}, node); + + localNodeCopy.location = null; + this.currentNodeIsRendered = false; + socket.sendnode(localNodeCopy); + }); } updatePosition (lat, lng) {