alsmanager_lib 3.0.103 → 3.0.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/modules.js +58 -15
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -11450,41 +11450,79 @@ function getTipiPorta() {
|
|
|
11450
11450
|
return query;
|
|
11451
11451
|
}
|
|
11452
11452
|
|
|
11453
|
-
function insertMatchPortToDevice(id_device, id_network, id_port
|
|
11454
|
-
var query = "insert into
|
|
11453
|
+
function insertMatchPortToDevice(id_device, id_network, id_port) {
|
|
11454
|
+
var query = "insert into device_lan_ports (id_device, id_card, id_port) values ";
|
|
11455
11455
|
query += "(";
|
|
11456
|
-
query += id_device + ", " + id_network + ", " + id_port
|
|
11456
|
+
query += id_device + ", " + id_network + ", " + id_port;
|
|
11457
11457
|
query += ")";
|
|
11458
11458
|
return query;
|
|
11459
11459
|
}
|
|
11460
11460
|
|
|
11461
|
-
function updateMatchPortToDevice(id_match, id_device, id_network, id_port
|
|
11462
|
-
var query = "update
|
|
11461
|
+
function updateMatchPortToDevice(id_match, id_device, id_network, id_port) {
|
|
11462
|
+
var query = "update device_lan_ports set ";
|
|
11463
11463
|
query += "id_device = " + id_device + ", ";
|
|
11464
|
-
query += "
|
|
11464
|
+
query += "id_card = " + id_network + ", ";
|
|
11465
11465
|
query += "id_port = " + id_port + ", ";
|
|
11466
|
-
query += "'" + date_start + "', ";
|
|
11467
|
-
query += "'" + date_end + "', ";
|
|
11468
|
-
query += "'" + note + "' ";
|
|
11469
11466
|
query += "where id = " + id_match;
|
|
11470
11467
|
return query;
|
|
11471
11468
|
}
|
|
11472
11469
|
|
|
11473
11470
|
function deleteMatchPortToDevice(id_match) {
|
|
11474
|
-
var query = "delete from
|
|
11471
|
+
var query = "delete from device_lan_ports ";
|
|
11475
11472
|
query += "where id = " + id_match;
|
|
11476
11473
|
return query;
|
|
11477
11474
|
}
|
|
11478
11475
|
|
|
11479
|
-
function
|
|
11480
|
-
var query = "select
|
|
11476
|
+
function getCurrentMatchByIdDeviceIdNetwork(id_device, id_network) {
|
|
11477
|
+
var query = "select id from device_lan_ports ";
|
|
11478
|
+
query += "where id_device = " + id_device + " and id_card = " + id_network;
|
|
11479
|
+
return query;
|
|
11480
|
+
}
|
|
11481
|
+
|
|
11482
|
+
function getPorteByIdDevice(id_device, id_network) {
|
|
11483
|
+
var query = "select dp.id, sp.port_type as Tipo, sp.port_sign as Porta, sp.note as Note from device_lan_ports dp ";
|
|
11481
11484
|
query += "join site_ports sp on sp.id = dp.id_port "
|
|
11482
11485
|
query += "where dp.id_device = " + id_device + " ";
|
|
11483
|
-
query += "and dp.
|
|
11486
|
+
query += "and dp.id_card = " + id_network + " ";
|
|
11484
11487
|
query += "order by sp.port_type, sp.port_sign";
|
|
11485
11488
|
return query;
|
|
11486
11489
|
}
|
|
11487
11490
|
|
|
11491
|
+
function getPorteComboByIdSiteDevice(id_device) {
|
|
11492
|
+
var query = "select distinct sp.id, concat(sp.port_type, ' - ', sp.port_sign) as description from devices d ";
|
|
11493
|
+
query += "join device_site ds on ds.id_device = d.id ";
|
|
11494
|
+
query += "join site_ports sp on sp.id_site = ds.id_site ";
|
|
11495
|
+
query += "where d.id = " + id_device + " ";
|
|
11496
|
+
query += "and date('now') >= ds.date_in and date('now') <= ds.date_out ";
|
|
11497
|
+
query += "and sp.port_type = 'LAN' ";
|
|
11498
|
+
query += "and sp.port_sign is not null "
|
|
11499
|
+
query += "order by port_type, port_sign";
|
|
11500
|
+
return query;
|
|
11501
|
+
}
|
|
11502
|
+
|
|
11503
|
+
function getNetworksAndPortOnDevice(id_device) {
|
|
11504
|
+
var query = "";
|
|
11505
|
+
query += "select dn.id, sp.port_sign as Porta, dn.net_type as Tipo, dn.ipv4_static as IP4, dn.ipv6_static as IP6, dn.mac_address as MAC from device_networks dn ";
|
|
11506
|
+
query += "left join device_lan_ports dlp on dn.id = dlp.id_card ";
|
|
11507
|
+
query += "left join site_ports sp on dlp.id_port = sp.id ";
|
|
11508
|
+
query += "where dn.id_device = " + id_device;
|
|
11509
|
+
return query;
|
|
11510
|
+
}
|
|
11511
|
+
|
|
11512
|
+
function getNetworksAndPortByConfig(id_device, id_conf) {
|
|
11513
|
+
var query = "select dn.id, sp.port_sign as Porta, dn.net_type as Tipo, dn.mac_address as MAC, dn.ipv4_static as IP4, dn.ipv6_static as IP6 from device_networks dn ";
|
|
11514
|
+
query += "left join device_lan_ports dlp on dn.id = dlp.id_card ";
|
|
11515
|
+
query += "left join site_ports sp on dlp.id_port = sp.id ";
|
|
11516
|
+
query += "where dn.id_device = " + id_device + " ";
|
|
11517
|
+
if (id_conf > 0) {
|
|
11518
|
+
query += "and dn.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
11519
|
+
}
|
|
11520
|
+
else {
|
|
11521
|
+
query += "and dn.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'NETWORK' order by id desc)"
|
|
11522
|
+
}
|
|
11523
|
+
return query;
|
|
11524
|
+
}
|
|
11525
|
+
|
|
11488
11526
|
//End Manage ports
|
|
11489
11527
|
|
|
11490
11528
|
// Manage updateDevicesSite
|
|
@@ -15072,8 +15110,13 @@ module.exports = {
|
|
|
15072
15110
|
getSwitches,
|
|
15073
15111
|
getTipiPorta,
|
|
15074
15112
|
insertMatchPortToDevice,
|
|
15075
|
-
updateMatchPortToDevice,
|
|
15076
|
-
|
|
15113
|
+
updateMatchPortToDevice,
|
|
15114
|
+
deleteMatchPortToDevice,
|
|
15115
|
+
getCurrentMatchByIdDeviceIdNetwork,
|
|
15116
|
+
getPorteByIdDevice,
|
|
15117
|
+
getPorteComboByIdSiteDevice,
|
|
15118
|
+
getNetworksAndPortOnDevice,
|
|
15119
|
+
getNetworksAndPortByConfig,
|
|
15077
15120
|
//
|
|
15078
15121
|
queryStatistic,
|
|
15079
15122
|
queryStatisticInventary,
|