From 509a90381b38dfae350c53e5ab36fd009ba730c9 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Tue, 30 Jul 2019 13:15:23 -0700 Subject: [PATCH] Fixed numeric typing and device list view. --- package.json | 2 +- views/default-min.handlebars | 2 +- views/default.handlebars | 61 ++++++++++++++++++++++++++---------- 3 files changed, 46 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index c26f1adb..e274ee66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "meshcentral", - "version": "0.3.8-v", + "version": "0.3.8-w", "keywords": [ "Remote Management", "Intel AMT", diff --git a/views/default-min.handlebars b/views/default-min.handlebars index 26512207..cbe90332 100644 --- a/views/default-min.handlebars +++ b/views/default-min.handlebars @@ -1 +1 @@ - {{{title}}}
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file + {{{title}}}
{{{title}}}
{{{title2}}}

{{{logoutControl}}}

 

\ No newline at end of file diff --git a/views/default.handlebars b/views/default.handlebars index 46251784..bf1615cf 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -295,7 +295,7 @@   -   +   @@ -693,7 +693,7 @@ - + @@ -747,7 +748,7 @@
  Show +  
- + @@ -783,7 +785,7 @@
  -
+ @@ -2319,7 +2321,7 @@ var deviceBoxWidth = Math.floor(totalDeviceViewWidth / 301); deviceBoxWidth = 301 + Math.floor((totalDeviceViewWidth - (deviceBoxWidth * 301)) / deviceBoxWidth); - if (view == 2) { + if ((view == 2) && (sort != 3)) { r += '
  Show +  
'; } if (r != '') { r += '
UserAddressConnectivity'; //State'; } @@ -2354,7 +2356,10 @@ if (pwr !== current) { deviceHeaderSet(); if ((view == 1) && (current !== null)) { if (c == 2) { r += '
'; } } + + if (view == 2) { r += ''; } r += '
' + PowerStateStr2(node.pwr) + '
'; + current = pwr; c = 0; } @@ -2423,11 +2428,18 @@ // If displaying devices by groups, sort the group names and display the devices. if (sort == 3) { + if (view == 2) { r = '
UserAddressConnectivity'; } + var groupNames = []; for (var i in groups) { groupNames.push(i); } groupNames.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); }); for (var j in groupNames) { - var i = groupNames[j]; r += '
' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + '' + i + '
' + groups[i]; + var i = groupNames[j]; + if (view == 2) { + r += '
' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + '' + i + '
' + groups[i]; + } else { + r += '
' + groupCount[i] + ' node' + ((groupCount[i] > 1) ? 's' : '') + '' + i + '
' + groups[i]; + } } } @@ -5047,6 +5059,8 @@ if (((a >= 65) && (a <= 90)) || ((a >= 97) && (a <= 122))) { if ((a == b) && (shift == false)) { x.push([desktop.m.KeyAction.DOWN, 16]); shift = true; } // LShift down if ((a != b) && (shift == true)) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // LShift up + } else if ((a >= 48) && (a <= 57)) { + if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up } else if (DeskTypeTranslate[a]) { if (shift == true) { x.push([desktop.m.KeyAction.UP, 16]); shift = false; } // Shift up b = DeskTypeTranslate[a]; @@ -5125,7 +5139,13 @@ for (var pid in processes) { p.push( { p:parseInt(pid), c:processes[pid].cmd, d:processes[pid].cmd.toLowerCase(), u: processes[pid].user } ); } if (deskTools.sort == 0) { p.sort(sortProcessPid); } else if (deskTools.sort == 1) { p.sort(sortProcessName); } var x = ''; - for (var i in p) { if (p[i].p != 0) { x += '
' + p[i].p + '
' + (p[i].u?p[i].u:'') + '
' + p[i].c + '
'; } } + for (var i in p) { + if (p[i].p != 0) { + var c = p[i].c; + if (c.length > 30) { c = '' + c.substring(0,30) + '...' } + x += '
' + p[i].p + '
' + (p[i].u ? p[i].u : '') + '
' + c + '
'; + } + } QH('DeskToolsProcesses', x); } } @@ -7261,24 +7281,31 @@ meshserver.send({ action: 'events', limit: parseInt(p3limitdropdown.value) }); } - function p3showDownloadEventsDialog() { + function p3showDownloadEventsDialog(mode) { if (xxdialogMode) return; var x = 'Download the list of events with one of the file formats below.

'; - x += addHtmlValue('CSV Format', 'eventslist.csv'); - x += addHtmlValue('JSON Format', 'eventslist.json'); - setDialogMode(2, "Event List Export", 1, null, x); + x += addHtmlValue('CSV Format', 'eventslist.csv'); + x += addHtmlValue('JSON Format', 'eventslist.json'); + setDialogMode(2, "Event List Export", 1, null, x, mode); } - function p3downloadEventsDialogCSV() { - var csv = "time, type, action, user, message\r\n"; - for (var i in events) { csv += '\"' + events[i].time + '\",\"' + events[i].etype + '\",\"' + ((events[i].action != null)?events[i].action:'') + '\",\"' + ((events[i].username != null)?events[i].username:'') + '\",\"' + ((events[i].msg != null)?events[i].msg:'') + '\"\r\n'; } + function p3downloadEventsDialogCSV(mode) { + var csv, eventList; + if (mode == 1) { eventList = currentDeviceEvents; } + if (mode == 2) { eventList = events; } + if (mode == 3) { eventList = currentUserEvents; } + csv = "time, type, action, user, message\r\n" + for (var i in eventList) { csv += '\"' + eventList[i].time + '\",\"' + eventList[i].etype + '\",\"' + ((eventList[i].action != null) ? eventList[i].action : '') + '\",\"' + ((eventList[i].username != null) ? eventList[i].username : '') + '\",\"' + ((eventList[i].msg != null) ? eventList[i].msg : '') + '\"\r\n'; } saveAs(new Blob([csv], { type: "application/octet-stream" }), "eventslist.csv"); return false; } - function p3downloadEventsDialogJSON() { - var r = [] - for (var i in events) { r.push(events[i]); } + function p3downloadEventsDialogJSON(mode) { + var r = [], eventList; + if (mode == 1) { eventList = currentDeviceEvents; } + if (mode == 2) { eventList = events; } + if (mode == 3) { eventList = currentUserEvents; } + for (var i in eventList) { r.push(events[i]); } saveAs(new Blob([JSON.stringify(r)], { type: "application/octet-stream" }), "eventslist.json"); return false; }