node page: ask for confirmation before resetting node location

This commit is contained in:
Oliver Gerlich 2018-07-22 21:40:13 +02:00
parent bd7b9c10aa
commit 668ba59b8d
1 changed files with 7 additions and 5 deletions

View File

@ -149,12 +149,14 @@ export class NodeView extends View {
this.resetLocationBtn.classList.add('btn'); this.resetLocationBtn.classList.add('btn');
this.resetLocationBtn.innerHTML = 'Reset Location'; this.resetLocationBtn.innerHTML = 'Reset Location';
this.resetLocationBtn.addEventListener('click', () => { this.resetLocationBtn.addEventListener('click', () => {
if (confirm("Reset location of this node?")) {
const node = store.getNode(this.currentNodeID) || store.createNode(this.currentNodeID), const node = store.getNode(this.currentNodeID) || store.createNode(this.currentNodeID),
localNodeCopy = Object.assign({}, node); localNodeCopy = Object.assign({}, node);
localNodeCopy.location = null; localNodeCopy.location = null;
this.currentNodeIsRendered = false; this.currentNodeIsRendered = false;
socket.sendnode(localNodeCopy); socket.sendnode(localNodeCopy);
}
}); });
} }