[TASK] add hostname to nodeView

This commit is contained in:
Martin Geno 2017-05-29 23:39:49 +02:00
parent 75ffdbeefe
commit f48aaf3236
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
3 changed files with 25 additions and 5 deletions

View File

@ -12,19 +12,19 @@
border-left: 3px solid green; border-left: 3px solid green;
} }
.leaflet-container .node.client5 { .leaflet-container .node.client5 {
border-border: 3px solid green; border-right: 3px solid green;
} }
.leaflet-container .node.client24-warn { .leaflet-container .node.client24-warn {
border-left: 3px solid yellow; border-left: 3px solid yellow;
} }
.leaflet-container .node.client5-warn { .leaflet-container .node.client5-warn {
border-border: 3px solid yellow; border-right: 3px solid yellow;
} }
.leaflet-container .node.client24-crit { .leaflet-container .node.client24-crit {
border-left: 3px solid red; border-left: 3px solid red;
} }
.leaflet-container .node.client5-crit { .leaflet-container .node.client5-crit {
border-border: 3px solid red; border-right: 3px solid red;
} }
.leaflet-container .nodeicon-label { .leaflet-container .nodeicon-label {
font-size: 12px; font-size: 12px;

View File

@ -23,12 +23,12 @@ const config = {
*/ */
'heatmap': { 'heatmap': {
'wifi24': { 'wifi24': {
'size': 230, 'size': 30,
'opacity': 0.5, 'opacity': 0.5,
'alphaRange': 1 'alphaRange': 1
}, },
'wifi5': { 'wifi5': {
'size': 230, 'size': 30,
'opacity': 0.5, 'opacity': 0.5,
'alphaRange': 1 'alphaRange': 1
} }

View File

@ -15,6 +15,8 @@ const guiNode = {};
titleID = null, titleID = null,
ago = null, ago = null,
hostnameInput = null,
marker = null, marker = null,
map = null, map = null,
geoJsonLayer = null, geoJsonLayer = null,
@ -66,6 +68,7 @@ const guiNode = {};
return; return;
} }
titleName.innerHTML = node.hostname; titleName.innerHTML = node.hostname;
hostnameInput.value = node.hostname;
// 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];
@ -96,6 +99,7 @@ const guiNode = {};
const title = domlib.newAt(el, 'h1'), const title = domlib.newAt(el, 'h1'),
lastseen = domlib.newAt(el, 'p'), lastseen = domlib.newAt(el, 'p'),
hostname = domlib.newAt(el, 'p'),
mapEl = domlib.newAt(el, 'div'); mapEl = domlib.newAt(el, 'div');
titleName = domlib.newAt(title, 'span'); titleName = domlib.newAt(title, 'span');
@ -106,6 +110,22 @@ const guiNode = {};
domlib.newAt(lastseen, 'span').innerHTML = 'Lastseen: '; domlib.newAt(lastseen, 'span').innerHTML = 'Lastseen: ';
ago = domlib.newAt(lastseen, 'span'); ago = domlib.newAt(lastseen, 'span');
domlib.newAt(hostname, 'span').innerHTML = 'Hostname: ';
hostnameInput = domlib.newAt(hostname, 'input');
hostnameInput.setAttribute('placeholder', 'Hostname');
hostnameInput.addEventListener('focusin', () => {
editing = true;
});
hostnameInput.addEventListener('focusout', () => {
editing = false;
const node = store.getNode(currentNodeID);
node.hostname = hostnameInput.value;
socket.sendnode(node);
});
mapEl.style.height = '300px'; mapEl.style.height = '300px';
map = L.map(mapEl).setView(config.map.view.bound, config.map.view.zoom); map = L.map(mapEl).setView(config.map.view.bound, config.map.view.zoom);