New virual machine icon, MeshCtrl.js fixes.

This commit is contained in:
Ylian Saint-Hilaire 2020-04-16 13:18:45 -07:00
parent 901bb6529e
commit 882c79ce16
11 changed files with 85 additions and 33 deletions

Binary file not shown.

View File

@ -213,7 +213,8 @@ if (args['_'].length == 0) {
console.log(" MeshCtrl ListDevices"); console.log(" MeshCtrl ListDevices");
console.log(" MeshCtrl ListDevices -id [groupid] --json"); console.log(" MeshCtrl ListDevices -id [groupid] --json");
console.log("\r\nOptional arguments:\r\n"); console.log("\r\nOptional arguments:\r\n");
console.log(" --id [groupid] - Filter by device group identifier."); console.log(" --id [groupid] - Filter by group identifier (or --group).");
console.log(" --group [groupname] - Filter by group name (or --id).");
console.log(" --count - Only return the device count."); console.log(" --count - Only return the device count.");
console.log(" --json - Show result as JSON."); console.log(" --json - Show result as JSON.");
break; break;
@ -565,7 +566,9 @@ function serverConnect() {
case 'listdevicegroups': { ws.send(JSON.stringify({ action: 'meshes' })); break; } case 'listdevicegroups': { ws.send(JSON.stringify({ action: 'meshes' })); break; }
case 'listusersofdevicegroup': { ws.send(JSON.stringify({ action: 'meshes' })); break; } case 'listusersofdevicegroup': { ws.send(JSON.stringify({ action: 'meshes' })); break; }
case 'listdevices': { case 'listdevices': {
if (args.id) { if (args.group) {
ws.send(JSON.stringify({ action: 'nodes', meshname: args.group, responseid: 'meshctrl' })); break;
} else if (args.id) {
ws.send(JSON.stringify({ action: 'nodes', meshid: args.id, responseid: 'meshctrl' })); break; ws.send(JSON.stringify({ action: 'nodes', meshid: args.id, responseid: 'meshctrl' })); break;
} else { } else {
ws.send(JSON.stringify({ action: 'meshes' })); ws.send(JSON.stringify({ action: 'meshes' }));

View File

@ -482,32 +482,46 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
case 'nodes': case 'nodes':
{ {
var links = [], extraids = null, err = null; var links = [], extraids = null, err = null;
try {
if (command.meshid == null) {
// Request a list of all meshes this user as rights to
links = parent.GetAllMeshIdWithRights(user);
// Add any nodes with direct rights or any nodes with user group direct rights // Resolve the device group name if needed
if (obj.user.links != null) { if ((typeof command.meshname == 'string') && (command.meshid == null)) {
for (var i in obj.user.links) { for (var i in parent.meshes) {
if (i.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(i); } var m = parent.meshes[i];
else if (i.startsWith('ugrp/')) { if ((m.mtype == 2) && (m.name == command.meshname) && parent.IsMeshViewable(user, m)) {
const g = parent.userGroups[i]; if (command.meshid == null) { command.meshid = m._id; } else { err = 'Duplicate device groups found'; }
if ((g != null) && (g.links != null)) { }
for (var j in g.links) { if (j.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(j); } } }
if (command.meshid == null) { err = 'Invalid group id'; }
}
if (err == null) {
try {
if (command.meshid == null) {
// Request a list of all meshes this user as rights to
links = parent.GetAllMeshIdWithRights(user);
// Add any nodes with direct rights or any nodes with user group direct rights
if (obj.user.links != null) {
for (var i in obj.user.links) {
if (i.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(i); }
else if (i.startsWith('ugrp/')) {
const g = parent.userGroups[i];
if ((g != null) && (g.links != null)) {
for (var j in g.links) { if (j.startsWith('node/')) { if (extraids == null) { extraids = []; } extraids.push(j); } }
}
} }
} }
} }
} else {
// Request list of all nodes for one specific meshid
meshid = command.meshid;
if (common.validateString(meshid, 0, 128) == false) { err = 'Invalid group id'; } else {
if (meshid.split('/').length == 1) { meshid = 'mesh/' + domain.id + '/' + command.meshid; }
if (parent.IsMeshViewable(user, meshid)) { links.push(meshid); } else { err = 'Invalid group id'; }
}
} }
} else { } catch (ex) { err = 'Validation exception: ' + ex; }
// Request list of all nodes for one specific meshid }
meshid = command.meshid;
if (common.validateString(meshid, 0, 128) == false) { err = 'Invalid group id'; } else {
if (meshid.split('/').length == 1) { meshid = 'mesh/' + domain.id + '/' + command.meshid; }
if (obj.IsMeshViewable(user, meshid)) { links.push(meshid); } else { err = 'Invalid group id'; }
}
}
} catch (ex) { err = 'Validation exception: ' + ex; }
// Handle any errors // Handle any errors
if (err != null) { if (err != null) {

View File

@ -1,6 +1,6 @@
{ {
"name": "meshcentral", "name": "meshcentral",
"version": "0.5.1-x", "version": "0.5.1-y",
"keywords": [ "keywords": [
"Remote Management", "Remote Management",
"Intel AMT", "Intel AMT",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -1194,6 +1194,14 @@ a {
border: none; border: none;
} }
.i8 {
background: url(../images/icons50.png) -350px 0px;
height: 50px;
width: 50px;
cursor: pointer;
border: none;
}
.j1 { .j1 {
background: url(../images/icons16.png) 0px 0px; background: url(../images/icons16.png) 0px 0px;
height: 16px; height: 16px;
@ -1250,6 +1258,14 @@ a {
border: none; border: none;
} }
.j8 {
background: url(../images/icons16.png) -112px 0px;
height: 16px;
width: 16px;
cursor: pointer;
border: none;
}
.relayIcon16 { .relayIcon16 {
background: url(../images/icon-relay.png); background: url(../images/icon-relay.png);
height: 16px; height: 16px;
@ -1458,6 +1474,14 @@ a {
float: left; float: left;
} }
.si8 {
background: url(../images/icons16.png) -112px 0px;
height: 16px;
width: 16px;
border: none;
float: left;
}
.mi { .mi {
background: url(../images/meshicon50.png) 0px 0px; background: url(../images/meshicon50.png) 0px 0px;
height: 50px; height: 50px;

View File

@ -85,6 +85,13 @@
border: none; border: none;
} }
.i8 {
background: url(../images/icons50.png) -350px 0px;
height: 50px;
width: 50px;
border: none;
}
.m0 { .m0 {
background: url(../images/images16.png) -32px 0px; background: url(../images/images16.png) -32px 0px;
height: 16px; height: 16px;
@ -2264,7 +2271,8 @@
x += '<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div><br />'; x += '<div style=display:inline-block class=i4 onclick=p10setIcon(4)></div><br />';
x += '<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>'; x += '<div style=display:inline-block class=i5 onclick=p10setIcon(5)></div>';
x += '<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div>'; x += '<div style=display:inline-block class=i6 onclick=p10setIcon(6)></div>';
x += '<div style=display:inline-block class=i7 onclick=p10setIcon(7)></div></table>'; x += '<div style=display:inline-block class=i7 onclick=p10setIcon(7)></div>';
x += '<div style=display:inline-block class=i8 onclick=p10setIcon(8)></div></table>';
setDialogMode(2, "Icon Selection", 0, null, x); setDialogMode(2, "Icon Selection", 0, null, x);
QV('id_dialogclose', true); QV('id_dialogclose', true);
} }

View File

@ -5607,14 +5607,17 @@
if (xxdialogMode) return; if (xxdialogMode) return;
if ((GetNodeRights(currentNode) & 4) == 0) return; if ((GetNodeRights(currentNode) & 4) == 0) return;
var x = '<br><div style=display:inline-block;width:16px></div>'; var x = '<div style=text-align:center><br />';
x += '<div tabindex=0 style=display:inline-block class=i1 onclick=p10setIcon(1) onkeypress="if (event.key==\'Enter\') p10setIcon(1)"></div>'; 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>';
x += '<div tabindex=0 style=display:inline-block class=i2 onclick=p10setIcon(2) onkeypress="if (event.key==\'Enter\') p10setIcon(2)"></div>'; 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>';
x += '<div tabindex=0 style=display:inline-block class=i3 onclick=p10setIcon(3) onkeypress="if (event.key==\'Enter\') p10setIcon(3)"></div>'; 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>';
x += '<div tabindex=0 style=display:inline-block class=i4 onclick=p10setIcon(4) onkeypress="if (event.key==\'Enter\') p10setIcon(4)"></div>'; 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>';
x += '<div tabindex=0 style=display:inline-block class=i5 onclick=p10setIcon(5) onkeypress="if (event.key==\'Enter\') p10setIcon(5)"></div>'; x += '<br />';
x += '<div tabindex=0 style=display:inline-block class=i6 onclick=p10setIcon(6) onkeypress="if (event.key==\'Enter\') p10setIcon(6)"></div>'; 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>';
x += '<div tabindex=0 style=display:inline-block class=i7 onclick=p10setIcon(7) onkeypress="if (event.key==\'Enter\') p10setIcon(7)"></div><br><br>'; 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>';
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>';
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>';
x += '<br /><br /></div>';
setDialogMode(2, "Icon Selection", 0, null, x); setDialogMode(2, "Icon Selection", 0, null, x);
QV('id_dialogclose', true); QV('id_dialogclose', true);
} }