Started work on global map

This commit is contained in:
Ylian Saint-Hilaire 2017-08-28 15:57:25 -07:00
parent 41125c66ee
commit 95f88d1125
2 changed files with 135 additions and 114 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.0.6-p", "version": "0.0.6-q",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

View File

@ -102,29 +102,32 @@
<div id=p1 style=display:none> <div id=p1 style=display:none>
<h1>My Devices</h1> <h1>My Devices</h1>
<div style=width:100%;height:24px;background-color:#d3d9d6> <div style=width:100%;height:24px;background-color:#d3d9d6>
<div class=style7 style=width:84px;height:100%;float:left>&nbsp;</div>
<div class=h1 style=height:100%;float:left>&nbsp;</div> <div class=h1 style=height:100%;float:left>&nbsp;</div>
<div class=style14 style=height:100%;float:left> <div id=devListToolbar class=style14 style=height:100%;float:left>
&nbsp;&nbsp;<input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All" />&nbsp; &nbsp;&nbsp;<input type="button" id="SelectAllButton" onclick="selectallButtonFunction();" value="Select All" />&nbsp;
<input type="button" id="GroupActionButton" disabled="disabled" value="Group Action" onclick="groupActionFunction();" />&nbsp; <input type="button" id="GroupActionButton" disabled="disabled" value="Group Action" onclick="groupActionFunction();" />&nbsp;
<input id="SearchInput" type="text" style=width:120px placeholder=Search onchange="onSearchInputChanged()" onkeyup="onSearchInputChanged()" autocomplete=off onfocus="onSearchFocus(1)" onblur="onSearchFocus(0)" />&nbsp; <input id="SearchInput" type="text" style=width:120px placeholder=Search onchange="onSearchInputChanged()" onkeyup="onSearchInputChanged()" autocomplete=off onfocus="onSearchFocus(1)" onblur="onSearchFocus(0)" />&nbsp;
<input type="checkbox" id="HostnameCheckBox" onclick="onHostnameCheckBox()" /><span title="Show device hostnames">Hostname</span> <input type="checkbox" id="HostnameCheckBox" onclick="onHostnameCheckBox()" /><span title="Show device hostnames">Hostname</span>
</div> </div>
<div class="auto-style1" style="height: 100%; float: right"> <div class="auto-style1" style="height: 100%; float: right">
<div style="height: 100%; width: 4px; float: right; background-color: #ffffff"></div> <div style="height:100%;width:4px;float:right;background-color:#ffffff"></div>
<div class="h2" style="height: 100%; float: right;">&nbsp;</div> <div class=h2 style="height:100%;float:right">&nbsp;</div>
<div style="float: right"> <div style=float:right>
View
<select id=viewselect onchange=onDeviceViewChange()>
<option value=1>3 wide</option>
<option value=2>List</option>
<option value=3>Map</option>
</select>
</div>
<div style=float:right id=devListToolbarSort>
Sort Sort
<select id=sortselect onchange=onSortSelectChange()> <select id=sortselect onchange=onSortSelectChange()>
<option>Mesh</option> <option>Mesh</option>
<option>Power</option> <option>Power</option>
<option>Device</option> <option>Device</option>
</select> </select>
&nbsp;View &nbsp;
<select id=viewselect onchange=onDeviceViewChange()>
<option value=1>3 wide</option>
<option value=2>List</option>
</select>
</div> </div>
</div> </div>
</div> </div>
@ -142,6 +145,7 @@
<p></p> <p></p>
</div> </div>
<div id="xdevices" style="max-height:calc(100vh - 228px);overflow-y:auto;-webkit-overflow-scrolling:touch"></div> <div id="xdevices" style="max-height:calc(100vh - 228px);overflow-y:auto;-webkit-overflow-scrolling:touch"></div>
<div id="xdevicesmap" style="height:500px;width:100%;overflow:hidden"></div>
</div> </div>
<div id=p2 style=display:none> <div id=p2 style=display:none>
<h1>My Account</h1> <h1>My Account</h1>
@ -596,6 +600,7 @@
var features = {{{features}}}; var features = {{{features}}};
var serverPublicNamePort = "{{{serverDnsName}}}:{{{serverPublicPort}}}"; var serverPublicNamePort = "{{{serverDnsName}}}:{{{serverPublicPort}}}";
var amtScanResults = null; var amtScanResults = null;
var xxmap = null;
function startup() { function startup() {
// Guard against other site's top frames (web bugs). // Guard against other site's top frames (web bugs).
@ -657,6 +662,13 @@
var x = ''; var x = '';
for (var c = 1; c < 27; c++) x += "<option value='" + c + "'>Ctrl-" + String.fromCharCode(64 + c) + " (" + c + ")</option>"; for (var c = 1; c < 27; c++) x += "<option value='" + c + "'>Ctrl-" + String.fromCharCode(64 + c) + " (" + c + ")</option>";
QH('specialkeylist', 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) { function getNodeFromId(id) {
@ -1134,9 +1146,17 @@
var deviceHeaderId = 0; var deviceHeaderId = 0;
var deviceHeaderCount; var deviceHeaderCount;
var deviceHeaders = {}; var deviceHeaders = {};
function updateDevices() { function updateDevices() {
var r = "", c = 0, current = null, count = 0, displayedMeshes = {}, view = Q('viewselect').value; var r = "", c = 0, current = null, count = 0, displayedMeshes = {}, view = Q('viewselect').value;
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; deviceHeaderId = 0;
deviceHeaderCount = {}; deviceHeaderCount = {};
deviceHeaderTotal = 0; deviceHeaderTotal = 0;
@ -1248,6 +1268,7 @@
for (var i in deviceHeadersTitles) { Q(i).title = deviceHeadersTitles[i]; } for (var i in deviceHeadersTitles) { Q(i).title = deviceHeadersTitles[i]; }
p1updateInfo(); p1updateInfo();
} }
}
function getMeshActions(mesh, meshrights) { function getMeshActions(mesh, meshrights) {
if ((meshrights & 4) == 0) return ''; if ((meshrights & 4) == 0) return '';