New virual machine icon, MeshCtrl.js fixes.

Ylian Saint-Hilaire committed Apr 16, 2020 at 13:18 UTC 882c79ce168a25464d2c3306263a85de04709782
11 files changed +86 -34
agents/MeshCentralRouter.exe
Binary files a/agents/MeshCentralRouter.exe and b/agents/MeshCentralRouter.exe differ
meshctrl.js
+5 -2
@@ -213,7 +213,8 @@ if (args['_'].length == 0) {
213 console.log(" MeshCtrl ListDevices");
214 console.log(" MeshCtrl ListDevices -id [groupid] --json");
215 console.log("\r\nOptional arguments:\r\n");
216 - console.log(" --id [groupid] - Filter by device group identifier.");
216 + console.log(" --id [groupid] - Filter by group identifier (or --group).");
217 + console.log(" --group [groupname] - Filter by group name (or --id).");
218 console.log(" --count - Only return the device count.");
219 console.log(" --json - Show result as JSON.");
220 break;
@@ -565,7 +566,9 @@ function serverConnect() {
566 case 'listdevicegroups': { ws.send(JSON.stringify({ action: 'meshes' })); break; }
567 case 'listusersofdevicegroup': { ws.send(JSON.stringify({ action: 'meshes' })); break; }
568 case 'listdevices': {
568 - if (args.id) {
569 + if (args.group) {
570 + ws.send(JSON.stringify({ action: 'nodes', meshname: args.group, responseid: 'meshctrl' })); break;
571 + } else if (args.id) {
572 ws.send(JSON.stringify({ action: 'nodes', meshid: args.id, responseid: 'meshctrl' })); break;
573 } else {
574 ws.send(JSON.stringify({ action: 'meshes' }));
meshuser.js
+36 -22
@@ -482,32 +482,46 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
482 case 'nodes':
483 {
484 var links = [], extraids = null, err = null;
485 - try {
486 - if (command.meshid == null) {
487 - // Request a list of all meshes this user as rights to
488 - links = parent.GetAllMeshIdWithRights(user);
489 -
490 - // Add any nodes with direct rights or any nodes with user group direct rights
491 - if (obj.user.links != null) {
492 - for (var i in obj.user.links) {
493 - if (i.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(i); }
494 - else if (i.startsWith('ugrp/')) {
495 - const g = parent.userGroups[i];
496 - if ((g != null) && (g.links != null)) {
497 - for (var j in g.links) { if (j.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(j); } }
485 +
486 + // Resolve the device group name if needed
487 + if ((typeof command.meshname == 'string') && (command.meshid == null)) {
488 + for (var i in parent.meshes) {
489 + var m = parent.meshes[i];
490 + if ((m.mtype == 2) && (m.name == command.meshname) && parent.IsMeshViewable(user, m)) {
491 + if (command.meshid == null) { command.meshid = m._id; } else { err = 'Duplicate device groups found'; }
492 + }
493 + }
494 + if (command.meshid == null) { err = 'Invalid group id'; }
495 + }
496 +
497 + if (err == null) {
498 + try {
499 + if (command.meshid == null) {
500 + // Request a list of all meshes this user as rights to
501 + links = parent.GetAllMeshIdWithRights(user);
502 +
503 + // Add any nodes with direct rights or any nodes with user group direct rights
504 + if (obj.user.links != null) {
505 + for (var i in obj.user.links) {
506 + if (i.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(i); }
507 + else if (i.startsWith('ugrp/')) {
508 + const g = parent.userGroups[i];
509 + if ((g != null) && (g.links != null)) {
510 + for (var j in g.links) { if (j.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(j); } }
511 + }
512 }
513 }
514 }
515 + } else {
516 + // Request list of all nodes for one specific meshid
517 + meshid = command.meshid;
518 + if (common.validateString(meshid, 0, 128) == false) { err = 'Invalid group id'; } else {
519 + if (meshid.split('/').length == 1) { meshid = 'mesh/' + domain.id + '/' + command.meshid; }
520 + if (parent.IsMeshViewable(user, meshid)) { links.push(meshid); } else { err = 'Invalid group id'; }
521 + }
522 }
502 - } else {
503 - // Request list of all nodes for one specific meshid
504 - meshid = command.meshid;
505 - if (common.validateString(meshid, 0, 128) == false) { err = 'Invalid group id'; } else {
506 - if (meshid.split('/').length == 1) { meshid = 'mesh/' + domain.id + '/' + command.meshid; }
507 - if (obj.IsMeshViewable(user, meshid)) { links.push(meshid); } else { err = 'Invalid group id'; }
508 - }
509 - }
510 - } catch (ex) { err = 'Validation exception: ' + ex; }
523 + } catch (ex) { err = 'Validation exception: ' + ex; }
524 + }
525
526 // Handle any errors
527 if (err != null) {
package.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "name": "meshcentral",
3 - "version": "0.5.1-x",
3 + "version": "0.5.1-y",
4 "keywords": [
5 "Remote Management",
6 "Intel AMT",
public/images/icons16.png
Binary files a/public/images/icons16.png and b/public/images/icons16.png differ
public/images/icons256-8-1.png
Binary files /dev/null and b/public/images/icons256-8-1.png differ
public/images/icons50.png
Binary files a/public/images/icons50.png and b/public/images/icons50.png differ
public/images/icons64.png
Binary files a/public/images/icons64.png and b/public/images/icons64.png differ
public/styles/style.css
+24
@@ -1194,6 +1194,14 @@ a {
1194 border: none;
1195 }
1196
1197 +.i8 {
1198 + background: url(../images/icons50.png) -350px 0px;
1199 + height: 50px;
1200 + width: 50px;
1201 + cursor: pointer;
1202 + border: none;
1203 +}
1204 +
1205 .j1 {
1206 background: url(../images/icons16.png) 0px 0px;
1207 height: 16px;
@@ -1250,6 +1258,14 @@ a {
1258 border: none;
1259 }
1260
1261 +.j8 {
1262 + background: url(../images/icons16.png) -112px 0px;
1263 + height: 16px;
1264 + width: 16px;
1265 + cursor: pointer;
1266 + border: none;
1267 +}
1268 +
1269 .relayIcon16 {
1270 background: url(../images/icon-relay.png);
1271 height: 16px;
@@ -1458,6 +1474,14 @@ a {
1474 float: left;
1475 }
1476
1477 +.si8 {
1478 + background: url(../images/icons16.png) -112px 0px;
1479 + height: 16px;
1480 + width: 16px;
1481 + border: none;
1482 + float: left;
1483 +}
1484 +
1485 .mi {
1486 background: url(../images/meshicon50.png) 0px 0px;
1487 height: 50px;
views/default-mobile.handlebars
+9 -1
@@ -85,6 +85,13 @@
85 border: none;
86 }
87
88 + .i8 {
89 + background: url(../images/icons50.png) -350px 0px;
90 + height: 50px;
91 + width: 50px;
92 + border: none;
93 + }
94 +
95 .m0 {
96 background: url(../images/images16.png) -32px 0px;
97 height: 16px;
@@ -2264,7 +2271,8 @@
2271 x += '<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div><br />';
2272 x += '<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>';
2273 x += '<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div>';
2267 - x += '<div style=display:inline-block class=i7 onclick=p10setIcon(7)></div></table>';
2274 + x += '<div style=display:inline-block class=i7 onclick=p10setIcon(7)></div>';
2275 + x += '<div style=display:inline-block class=i8 onclick=p10setIcon(8)></div></table>';
2276 setDialogMode(2, "Icon Selection", 0, null, x);
2277 QV('id_dialogclose', true);
2278 }
views/default.handlebars
+11 -8
@@ -5607,14 +5607,17 @@
5607 if (xxdialogMode) return;
5608 if ((GetNodeRights(currentNode) & 4) == 0) return;
5609
5610 - var x = '<br><div style=display:inline-block;width:16px></div>';
5611 - x += '<div tabindex=0 style=display:inline-block class=i1 onclick=p10setIcon(1) onkeypress="if (event.key==\'Enter\') p10setIcon(1)"></div>';
5612 - x += '<div tabindex=0 style=display:inline-block class=i2 onclick=p10setIcon(2) onkeypress="if (event.key==\'Enter\') p10setIcon(2)"></div>';
5613 - x += '<div tabindex=0 style=display:inline-block class=i3 onclick=p10setIcon(3) onkeypress="if (event.key==\'Enter\') p10setIcon(3)"></div>';
5614 - x += '<div tabindex=0 style=display:inline-block class=i4 onclick=p10setIcon(4) onkeypress="if (event.key==\'Enter\') p10setIcon(4)"></div>';
5615 - x += '<div tabindex=0 style=display:inline-block class=i5 onclick=p10setIcon(5) onkeypress="if (event.key==\'Enter\') p10setIcon(5)"></div>';
5616 - x += '<div tabindex=0 style=display:inline-block class=i6 onclick=p10setIcon(6) onkeypress="if (event.key==\'Enter\') p10setIcon(6)"></div>';
5617 - x += '<div tabindex=0 style=display:inline-block class=i7 onclick=p10setIcon(7) onkeypress="if (event.key==\'Enter\') p10setIcon(7)"></div><br><br>';
5610 + var x = '<div style=text-align:center><br />';
5611 + x += '<div tabindex=0 style="display:inline-block;margin:0 10px 0 10px" class=i1 onclick=p10setIcon(1) onkeypress="if (event.key==\'Enter\') p10setIcon(1)"></div>';
5612 + x += '<div tabindex=0 style="display:inline-block;margin:0 10px 0 10px" class=i2 onclick=p10setIcon(2) onkeypress="if (event.key==\'Enter\') p10setIcon(2)"></div>';
5613 + x += '<div tabindex=0 style="display:inline-block;margin:0 10px 0 10px" class=i3 onclick=p10setIcon(3) onkeypress="if (event.key==\'Enter\') p10setIcon(3)"></div>';
5614 + x += '<div tabindex=0 style="display:inline-block;margin:0 10px 0 10px" class=i4 onclick=p10setIcon(4) onkeypress="if (event.key==\'Enter\') p10setIcon(4)"></div>';
5615 + x += '<br />';
5616 + x += '<div tabindex=0 style="display:inline-block;margin:0 10px 0 10px" class=i5 onclick=p10setIcon(5) onkeypress="if (event.key==\'Enter\') p10setIcon(5)"></div>';
5617 + x += '<div tabindex=0 style="display:inline-block;margin:0 10px 0 10px" class=i6 onclick=p10setIcon(6) onkeypress="if (event.key==\'Enter\') p10setIcon(6)"></div>';
5618 + x += '<div tabindex=0 style="display:inline-block;margin:0 10px 0 10px" class=i7 onclick=p10setIcon(6) onkeypress="if (event.key==\'Enter\') p10setIcon(7)"></div>';
5619 + x += '<div tabindex=0 style="display:inline-block;margin:0 10px 0 10px" class=i8 onclick=p10setIcon(8) onkeypress="if (event.key==\'Enter\') p10setIcon(8)"></div>';
5620 + x += '<br /><br /></div>';
5621 setDialogMode(2, "Icon Selection", 0, null, x);
5622 QV('id_dialogclose', true);
5623 }