@@ -596,6 +600,7 @@
var features = {{{features}}};
var serverPublicNamePort = "{{{serverDnsName}}}:{{{serverPublicPort}}}";
var amtScanResults = null;
+ var xxmap = null;
function startup() {
// Guard against other site's top frames (web bugs).
@@ -657,6 +662,13 @@
var x = '';
for (var c = 1; c < 27; c++) x += "";
QH('specialkeylist', x);
+
+ // Setup the map
+ xxmap = new ol.Map({
+ target: 'xdevicesmap',
+ layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }) ],
+ view: new ol.View({ center: ol.proj.fromLonLat([0, 0]), zoom: 1.8, minZoom: 1.8 })
+ });
}
function getNodeFromId(id) {
@@ -1134,119 +1146,128 @@
var deviceHeaderId = 0;
var deviceHeaderCount;
var deviceHeaders = {};
-
function updateDevices() {
var r = "", c = 0, current = null, count = 0, displayedMeshes = {}, view = Q('viewselect').value;
- deviceHeaderId = 0;
- deviceHeaderCount = {};
- deviceHeaderTotal = 0;
- deviceHeaders = {};
- deviceHeadersTitles = {};
+ QV('xdevices', view < 3);
+ QV('xdevicesmap', view == 3);
+ QV('devListToolbar', view < 3);
+ QV('devListToolbarSort', view < 3);
+ if (view == 3) {
+ setTimeout( function() { xxmap.updateSize();}, 200);
+ // TODO
+ } else {
+ // 3 wide or list view
+ deviceHeaderId = 0;
+ deviceHeaderCount = {};
+ deviceHeaderTotal = 0;
+ deviceHeaders = {};
+ deviceHeadersTitles = {};
- // Save the list of currently checked nodeid's
- var checkedNodeids = [], elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
- for (var i in elements) { if (elements[i].checked) { checkedNodeids.push(elements[i].value); } }
+ // Save the list of currently checked nodeid's
+ var checkedNodeids = [], elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
+ for (var i in elements) { if (elements[i].checked) { checkedNodeids.push(elements[i].value); } }
- // Go thru the list of nodes and display them
- for (var i in nodes) {
- if (nodes[i].v == false) continue;
- var mesh2 = meshes[nodes[i].meshid], meshlinks = mesh2.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()];
- if (meshlinks == undefined) continue;
- if (sort == 0) {
- // Mesh header
- if (nodes[i].meshid != current) {
- deviceHeaderSet();
- var extra = '';
- if (meshes[nodes[i].meshid].mtype == 1) { extra = ', Intel® AMT only'; }
- var meshrights = meshlinks.rights;
- if ((view == 1) && (current != null)) { if (c == 2) { r += '
'; } r += ''; }
- r += '
';
- r += getMeshActions(mesh2, meshrights);
- r += '' + EscapeHtml(meshes[nodes[i].meshid].name) + '' + extra + '
';
- current = nodes[i].meshid;
- displayedMeshes[current] = 1;
- c = 0;
- }
- } else if (sort == 1) {
- // Power header
- if (nodes[i].pwr !== current) {
- deviceHeaderSet();
- if ((view == 1) && (current !== null)) { if (c == 2) { r += '
'; } r += '
'; }
- r += '
' + PowerStateStr2(nodes[i].pwr) + '
';
- current = nodes[i].pwr;
- c = 0;
- }
- } else if (sort == 2) {
- // Device header
- if (current == null) { r += '
'; current = '1'; }
- }
-
- // Node positioning
- if ((view == 1) && (c > 2)) { r += '
'; c = 0; }
- c++;
- count++;
-
- var title = EscapeHtml(nodes[i].name);
- if (title.length == 0) { title = 'None'; }
- if ((nodes[i].host != undefined) && (nodes[i].host.length > 0)) { title += " / " + EscapeHtml(nodes[i].host); }
- var name = EscapeHtml(nodes[i].name);
- if (showHostnames == true && nodes[i].host != undefined) name = EscapeHtml(nodes[i].host);
- if (name.length == 0) { name = 'None'; }
-
- // Node
- var icon = nodes[i].icon;
- var nodestate = NodeStateStr(nodes[i]);
- if ((!nodes[i].conn) || (nodes[i].conn == 0)) { icon += ' gray'; }
- if (view == 1) {
- r += '
'; // Adds device padding
-
- // Display all empty meshes, we need to do this because users can add devices to these at any time.
- if (sort == 0 && Q('SearchInput').value == '') {
- for (var i in meshes) {
- var mesh = meshes[i], meshlink = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()];
- if (meshlink != undefined) {
- var meshrights = meshlink.rights;
- if (displayedMeshes[mesh._id] == undefined) {
- if (current != '') { r += '
'; }
+ // Go thru the list of nodes and display them
+ for (var i in nodes) {
+ if (nodes[i].v == false) continue;
+ var mesh2 = meshes[nodes[i].meshid], meshlinks = mesh2.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()];
+ if (meshlinks == undefined) continue;
+ if (sort == 0) {
+ // Mesh header
+ if (nodes[i].meshid != current) {
+ deviceHeaderSet();
+ var extra = '';
+ if (meshes[nodes[i].meshid].mtype == 1) { extra = ', Intel® AMT only'; }
+ var meshrights = meshlinks.rights;
+ if ((view == 1) && (current != null)) { if (c == 2) { r += '
'; } r += '
'; }
r += '
';
- r += getMeshActions(mesh, meshrights);
- r += '' + EscapeHtml(mesh.name) + '
';
- if (mesh.mtype == 1) {
- r += '
No Intel® AMT devices in this mesh';
- if ((meshrights & 4) != 0) { r += ', add one'; }
+ r += getMeshActions(mesh2, meshrights);
+ r += '' + EscapeHtml(meshes[nodes[i].meshid].name) + '' + extra + '
';
+ current = nodes[i].meshid;
+ displayedMeshes[current] = 1;
+ c = 0;
+ }
+ } else if (sort == 1) {
+ // Power header
+ if (nodes[i].pwr !== current) {
+ deviceHeaderSet();
+ if ((view == 1) && (current !== null)) { if (c == 2) { r += '
'; } r += '
'; }
+ r += '
' + PowerStateStr2(nodes[i].pwr) + '
';
+ current = nodes[i].pwr;
+ c = 0;
+ }
+ } else if (sort == 2) {
+ // Device header
+ if (current == null) { r += '
'; current = '1'; }
+ }
+
+ // Node positioning
+ if ((view == 1) && (c > 2)) { r += '
'; c = 0; }
+ c++;
+ count++;
+
+ var title = EscapeHtml(nodes[i].name);
+ if (title.length == 0) { title = 'None'; }
+ if ((nodes[i].host != undefined) && (nodes[i].host.length > 0)) { title += " / " + EscapeHtml(nodes[i].host); }
+ var name = EscapeHtml(nodes[i].name);
+ if (showHostnames == true && nodes[i].host != undefined) name = EscapeHtml(nodes[i].host);
+ if (name.length == 0) { name = 'None'; }
+
+ // Node
+ var icon = nodes[i].icon;
+ var nodestate = NodeStateStr(nodes[i]);
+ if ((!nodes[i].conn) || (nodes[i].conn == 0)) { icon += ' gray'; }
+ if (view == 1) {
+ r += '
'; // Adds device padding
+
+ // Display all empty meshes, we need to do this because users can add devices to these at any time.
+ if (sort == 0 && Q('SearchInput').value == '') {
+ for (var i in meshes) {
+ var mesh = meshes[i], meshlink = mesh.links['user/{{{domain}}}/' + userinfo.name.toLowerCase()];
+ if (meshlink != undefined) {
+ var meshrights = meshlink.rights;
+ if (displayedMeshes[mesh._id] == undefined) {
+ if (current != '') { r += '
'; }
+ r += '
';
+ r += getMeshActions(mesh, meshrights);
+ r += '' + EscapeHtml(mesh.name) + '
';
+ if (mesh.mtype == 1) {
+ r += '
No Intel® AMT devices in this mesh';
+ if ((meshrights & 4) != 0) { r += ', add one'; }
+ }
+ if (mesh.mtype == 2) {
+ r += '
No devices in this mesh';
+ if ((meshrights & 4) != 0) { r += ', add one'; }
+ }
+ r += '.
';
+ current = mesh._id;
+ count++;
}
- if (mesh.mtype == 2) {
- r += '
No devices in this mesh';
- if ((meshrights & 4) != 0) { r += ', add one'; }
- }
- r += '.
';
- current = mesh._id;
- count++;
}
}
}
+ r += '
'; // This height of 1 div fixes a problem in Linux firefox browsers
+
+ QH('xdevices', r);
+ deviceHeaderSet();
+ QV('NoNodesPanel', count == 0);
+
+ // Re-check nodeid's
+ var elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
+ for (var i in elements) { elements[i].checked = (checkedNodeids.indexOf(elements[i].value) >= 0); }
+
+ for (var i in deviceHeaders) { QH(i, deviceHeaders[i]); }
+ for (var i in deviceHeadersTitles) { Q(i).title = deviceHeadersTitles[i]; }
+ p1updateInfo();
}
- r += '
'; // This height of 1 div fixes a problem in Linux firefox browsers
-
- QH('xdevices', r);
- deviceHeaderSet();
- QV('NoNodesPanel', count == 0);
-
- // Re-check nodeid's
- var elements = document.getElementsByClassName("DeviceCheckbox"), checkcount = 0;
- for (var i in elements) { elements[i].checked = (checkedNodeids.indexOf(elements[i].value) >= 0); }
-
- for (var i in deviceHeaders) { QH(i, deviceHeaders[i]); }
- for (var i in deviceHeadersTitles) { Q(i).title = deviceHeadersTitles[i]; }
- p1updateInfo();
}
function getMeshActions(mesh, meshrights) {