From 14b63552825cdaa1c20a2947a55127d273b2a49b Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Mon, 2 Dec 2019 14:00:28 -0800 Subject: [PATCH] Web app speed improvement with geolocation is off. --- package.json | 2 +- views/default-min.handlebars | 119 +++++++++--------- views/default.handlebars | 119 +++++++++--------- views/translations/default-min_cs.handlebars | 119 +++++++++--------- views/translations/default-min_fr.handlebars | 119 +++++++++--------- views/translations/default_cs.handlebars | 123 +++++++++---------- views/translations/default_fr.handlebars | 123 +++++++++---------- webserver.js | 8 +- 8 files changed, 350 insertions(+), 382 deletions(-) diff --git a/package.json b/package.json index 3867e0bd..2ee6fda5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.4.5-c", + "version": "0.4.5-d", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default-min.handlebars b/views/default-min.handlebars index f8818875..5434b100 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -1,4 +1,4 @@ -{{{title}}}
{{{title}}}
{{{title2}}}

 

{{{StartGeoLocation}}}{{{EndGeoLocation}}}{{{title}}}
{{{title}}}
{{{title2}}}

 

+ {{{StartGeoLocation}}} + {{{EndGeoLocation}}} {{{title}}} @@ -1431,7 +1433,7 @@ if (updateNaggleFlags & 8) { drawNotifications(); } if (updateNaggleFlags & 16) { updateMapMarkers(); } if (updateNaggleFlags & 32) { eventsUpdate(); } - if (updateNaggleFlags & 64) { refreshMap(false, true); } + {{{StartGeoLocationJS}}}if (updateNaggleFlags & 64) { refreshMap(false, true); }{{{EndGeoLocationJS}}} if (updateNaggleFlags & 256) { drawDeviceTimeline(); } if (updateNaggleFlags & 1024) { deviceEventsUpdate(); } if (updateNaggleFlags & 2048) { userEventsUpdate(); } @@ -3697,6 +3699,8 @@ mapView: null, // Sets the initial view } + {{{StartGeoLocationJS}}} + // Add a feature for every Node and change style if connection status changes function updateMapMarkers(selectedMesh) { if ((xxmap != null) && (xxmap.map == null)) { try { loadmap(); } catch (ex) { console.error('loadmap() exception', ex); } } @@ -3967,18 +3971,16 @@ //text: new ol.style.Text({ text: 'bob!', textAlign: 'right', offsetX: -10, fill: new ol.style.Fill({ color: '#000' }), stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) }) }); - /* - deviceMark.setStyle(new ol.style.Style({ - text: new ol.style.Text({ - //font: '12px helvetica,sans-serif', - text: currentNode.name, - textAlign: 'right', - offsetX: -10, - fill: new ol.style.Fill({ color: '#000' }), - stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) - }), - image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) })); - */ + //deviceMark.setStyle(new ol.style.Style({ + // text: new ol.style.Text({ + // //font: '12px helvetica,sans-serif', + // text: currentNode.name, + // textAlign: 'right', + // offsetX: -10, + // fill: new ol.style.Fill({ color: '#000' }), + // stroke: new ol.style.Stroke({ color: '#fff', width: 2 }) + // }), + // image: new ol.style.Icon(({ color: [113, 140, 0], src: 'images/dot.png' })) })); return [ style ]; } @@ -4125,18 +4127,16 @@ QV(nodes[i]._id + '-rowid', visible); } QV('noNodesMapPlace', count == 0); - /* - console.log(selected); - for (var i in nodes) { - if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) { - console.log(selected.indexOf(nodes[i]._id)); - x += '
= 0)?'checked':'') + ' />'; - x += '
' + nodes[i].name + '
'; - } - } - if (x == '') { x = '
No devices found.
'; } - QH('placenode', ''); - */ + //console.log(selected); + //for (var i in nodes) { + // if ((nodes[i].name.toLowerCase().indexOf(inputSearch) >= 0 || inputSearch == '') || (nodes[i].rnamel != null && nodes[i].rnamel.toLowerCase().indexOf(inputSearch) >= 0)) { + // console.log(selected.indexOf(nodes[i]._id)); + // x += '
= 0)?'checked':'') + ' />'; + // x += '
' + nodes[i].name + '
'; + // } + //} + //if (x == '') { x = '
No devices found.
'; } + //QH('placenode', ''); } // Called when a user clicks on a device to toggle selection for placement on map. @@ -4152,42 +4152,38 @@ // Add option for available meshes in mesh Dropdown function addMeshOptions(addMeshid, meshName) { - /* - var meshOptions = Q('select-mesh'); - if (addMeshid && meshName) { - var option = document.createElement('option'); - option.value =addMeshid; - option.text = meshName; - meshOptions.add(option); // Add specific option - } - else { - for (var i in meshes) { // Add all options - var option = document.createElement('option'); - option.value = i; - option.text = meshes[i].name; - meshOptions.add(option); - } - } - */ + //var meshOptions = Q('select-mesh'); + //if (addMeshid && meshName) { + // var option = document.createElement('option'); + // option.value =addMeshid; + // option.text = meshName; + // meshOptions.add(option); // Add specific option + //} + //else { + // for (var i in meshes) { // Add all options + // var option = document.createElement('option'); + // option.value = i; + // option.text = meshes[i].name; + // meshOptions.add(option); + // } + //} } // Remove/Modify options in Mesh dropdown (if modMeshname is defined then Modify else Remove) function meshOptionRmvMod(delMeshid, modMeshname){ - /* - var meshOptions = Q('select-mesh'); - if (delMeshid) { - var index=-1; - for (var i = 1; i < meshOptions.options.length; i++) { - if (meshOptions[i].value === delMeshid) { index=i; } - } - if (index > 0) { - if (modMeshname) { - meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified - } - else { meshOptions.remove(index); } - } - } - */ + //var meshOptions = Q('select-mesh'); + //if (delMeshid) { + // var index=-1; + // for (var i = 1; i < meshOptions.options.length; i++) { + // if (meshOptions[i].value === delMeshid) { index=i; } + // } + // if (index > 0) { + // if (modMeshname) { + // meshOptions[index].innerHTML=modMeshname; // If Mesh name is Modified + // } + // else { meshOptions.remove(index); } + // } + //} } //Check if there is any mesh created @@ -4205,10 +4201,8 @@ // Clear all mesh options except 'All' function clearMeshOptions() { - /* - var meshOptions=Q('select-mesh'); - for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); } - */ + //var meshOptions=Q('select-mesh'); + //for(var i = meshOptions.options.length - 1 ; i > 0 ; i--) { meshOptions.remove(i); } } // Make a http get call- Replace this with AJAX get if jquery is used @@ -4285,7 +4279,8 @@ var boundingExtent = ol.proj.transformExtent(extent, ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857')); xxmap.map.getView().fit(boundingExtent, xxmap.map.getSize()); } - + + {{{EndGeoLocationJS}}} // // MY DEVICE diff --git a/views/translations/default-min_cs.handlebars b/views/translations/default-min_cs.handlebars index fa9c63b0..157e8f47 100644 --- a/views/translations/default-min_cs.handlebars +++ b/views/translations/default-min_cs.handlebars @@ -1,4 +1,4 @@ -{{{title}}}
{{{title}}}
{{{title2}}}

 

{{{StartGeoLocation}}}{{{EndGeoLocation}}}{{{title}}}
{{{title}}}
{{{title2}}}

 

{{{title}}}
{{{title}}}
{{{title2}}}

 

{{{StartGeoLocation}}}{{{EndGeoLocation}}}{{{title}}}
{{{title}}}
{{{title2}}}

 

+ {{{StartGeoLocation}}} + {{{EndGeoLocation}}} {{{title}}} - - + +