node page: set node details (hostname/owner etc.) also if location is unknown

This commit is contained in:
Oliver Gerlich 2018-07-15 22:16:23 +02:00 committed by Geno
parent 2417bc3ae0
commit 7f498b4a6e
1 changed files with 14 additions and 12 deletions

View File

@ -158,7 +158,6 @@ export class NodeView extends View {
if (!node) { if (!node) {
console.log(`internal error: node not found: ${this.currentNodeID}`); console.log(`internal error: node not found: ${this.currentNodeID}`);
return; return;
} }
@ -171,13 +170,14 @@ export class NodeView extends View {
this.ago.classList.add('online'); this.ago.classList.add('online');
} }
this.ago.innerHTML = `${FromNowAgo(node.lastseen)} (${node.lastseen})`; this.ago.innerHTML = `${FromNowAgo(node.lastseen)} (${node.lastseen})`;
if (this.editLocationGPS || this.editing || !node.location || !node.location.latitude || !node.location.longitude) {
return;
}
this.titleName.innerHTML = node.hostname; this.titleName.innerHTML = node.hostname;
if (!this.editing) { // don't change input fields while user is editing
this.hostnameInput.value = node.hostname; this.hostnameInput.value = node.hostname;
this.ownerInput.value = node.owner; this.ownerInput.value = node.owner;
if (!this.editLocationGPS && node.location && node.location.latitude && node.location.longitude) {
// eslint-disable-next-line one-var // eslint-disable-next-line one-var
const latlng = [node.location.latitude, node.location.longitude]; const latlng = [node.location.latitude, node.location.longitude];
@ -186,6 +186,8 @@ export class NodeView extends View {
this.marker.setOpacity(1); this.marker.setOpacity(1);
this.map.invalidateSize(); this.map.invalidateSize();
} }
}
}
setNodeID (nodeID) { setNodeID (nodeID) {
this.currentNodeID = nodeID; this.currentNodeID = nodeID;