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).
This commit is contained in:
Oliver Gerlich 2018-07-21 19:43:26 +02:00
parent d95b41315c
commit bd7b9c10aa
1 changed files with 12 additions and 0 deletions

View File

@ -144,6 +144,18 @@ export class NodeView extends View {
} }
this.gpsStatusText = domlib.newAt(this.el, 'span'); this.gpsStatusText = domlib.newAt(this.el, 'span');
this.gpsStatusText.classList.add('withTextMargins'); 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) { updatePosition (lat, lng) {