alsmanager_lib 3.0.104 → 3.0.106
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 +51 -14
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -11405,14 +11405,18 @@ function getPortById(id_port) {
|
|
|
11405
11405
|
}
|
|
11406
11406
|
|
|
11407
11407
|
function writePortPerSite(id_site, id_place, port_sign, port_type, port_switch, id_switch, local_switch_exists, port_note, is_connected, installed_date, last_replaced_date) {
|
|
11408
|
+
var data_repl_str = convertDateToString(last_replaced_date);
|
|
11409
|
+
var data_inst_str = convertDateToString(installed_date);
|
|
11410
|
+
|
|
11408
11411
|
var query = "insert into site_ports (id_site, id_place, port_sign, port_type, port_switch, local_switch_exists, note, is_connected, installed_date, last_replaced_date) values ";
|
|
11409
11412
|
query += "(";
|
|
11410
|
-
query += id_site + ", '" + id_place + "', '" + port_sign + "', '" + port_type + "', '" + port_switch + "', " + local_switch_exists + ", '" + port_note + "', " + is_connected + ", " + id_switch + ", '" +
|
|
11413
|
+
query += id_site + ", '" + id_place + "', '" + port_sign + "', '" + port_type + "', '" + port_switch + "', " + local_switch_exists + ", '" + port_note + "', " + is_connected + ", " + id_switch + ", '" + data_inst_str + "', '" + data_repl_str + "'";
|
|
11411
11414
|
query += ")";
|
|
11412
11415
|
return query;
|
|
11413
11416
|
}
|
|
11414
11417
|
|
|
11415
11418
|
function updatePortPerSite(id_port, port_type, port_switch, id_switch, local_switch_exists, port_note, is_connected, last_replaced_date) {
|
|
11419
|
+
var data_repl_str = convertDateToString(last_replaced_date);
|
|
11416
11420
|
var query = "update site_ports set ";
|
|
11417
11421
|
query += "port_sign = '" + port_sign + "', ";
|
|
11418
11422
|
query += "port_type = '" + port_type + "', ";
|
|
@@ -11421,7 +11425,7 @@ function updatePortPerSite(id_port, port_type, port_switch, id_switch, local_swi
|
|
|
11421
11425
|
query += "note = '" + port_note + "', ";
|
|
11422
11426
|
query += "is_connected = " + is_connected + ", ";
|
|
11423
11427
|
query += "id_switch = " + id_switch + ", ";
|
|
11424
|
-
query += "last_replaced_date = '" +
|
|
11428
|
+
query += "last_replaced_date = '" + data_repl_str + "' ";
|
|
11425
11429
|
query += "where id = " + id_port;
|
|
11426
11430
|
return query;
|
|
11427
11431
|
}
|
|
@@ -11450,41 +11454,40 @@ function getTipiPorta() {
|
|
|
11450
11454
|
return query;
|
|
11451
11455
|
}
|
|
11452
11456
|
|
|
11453
|
-
function insertMatchPortToDevice(id_device, id_network, id_port
|
|
11454
|
-
var query = "insert into
|
|
11457
|
+
function insertMatchPortToDevice(id_device, id_network, id_port) {
|
|
11458
|
+
var query = "insert into device_lan_ports (id_device, id_card, id_port) values ";
|
|
11455
11459
|
query += "(";
|
|
11456
|
-
query += id_device + ", " + id_network + ", " + id_port
|
|
11460
|
+
query += id_device + ", " + id_network + ", " + id_port;
|
|
11457
11461
|
query += ")";
|
|
11458
11462
|
return query;
|
|
11459
11463
|
}
|
|
11460
11464
|
|
|
11461
|
-
function updateMatchPortToDevice(id_match, id_device, id_network, id_port
|
|
11462
|
-
var query = "update
|
|
11465
|
+
function updateMatchPortToDevice(id_match, id_device, id_network, id_port) {
|
|
11466
|
+
var query = "update device_lan_ports set ";
|
|
11463
11467
|
query += "id_device = " + id_device + ", ";
|
|
11464
|
-
query += "
|
|
11468
|
+
query += "id_card = " + id_network + ", ";
|
|
11465
11469
|
query += "id_port = " + id_port + ", ";
|
|
11466
|
-
query += "'" + note + "' ";
|
|
11467
11470
|
query += "where id = " + id_match;
|
|
11468
11471
|
return query;
|
|
11469
11472
|
}
|
|
11470
11473
|
|
|
11471
11474
|
function deleteMatchPortToDevice(id_match) {
|
|
11472
|
-
var query = "delete from
|
|
11475
|
+
var query = "delete from device_lan_ports ";
|
|
11473
11476
|
query += "where id = " + id_match;
|
|
11474
11477
|
return query;
|
|
11475
11478
|
}
|
|
11476
11479
|
|
|
11477
11480
|
function getCurrentMatchByIdDeviceIdNetwork(id_device, id_network) {
|
|
11478
|
-
var query = "select id from
|
|
11479
|
-
query += "where id_device = " + id_device + " and
|
|
11481
|
+
var query = "select id from device_lan_ports ";
|
|
11482
|
+
query += "where id_device = " + id_device + " and id_card = " + id_network;
|
|
11480
11483
|
return query;
|
|
11481
11484
|
}
|
|
11482
11485
|
|
|
11483
11486
|
function getPorteByIdDevice(id_device, id_network) {
|
|
11484
|
-
var query = "select dp.id, sp.port_type as Tipo, sp.port_sign as Porta, sp.note as Note from
|
|
11487
|
+
var query = "select dp.id, sp.port_type as Tipo, sp.port_sign as Porta, sp.note as Note from device_lan_ports dp ";
|
|
11485
11488
|
query += "join site_ports sp on sp.id = dp.id_port "
|
|
11486
11489
|
query += "where dp.id_device = " + id_device + " ";
|
|
11487
|
-
query += "and dp.
|
|
11490
|
+
query += "and dp.id_card = " + id_network + " ";
|
|
11488
11491
|
query += "order by sp.port_type, sp.port_sign";
|
|
11489
11492
|
return query;
|
|
11490
11493
|
}
|
|
@@ -11501,6 +11504,29 @@ function getPorteComboByIdSiteDevice(id_device) {
|
|
|
11501
11504
|
return query;
|
|
11502
11505
|
}
|
|
11503
11506
|
|
|
11507
|
+
function getNetworksAndPortOnDevice(id_device) {
|
|
11508
|
+
var query = "";
|
|
11509
|
+
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 ";
|
|
11510
|
+
query += "left join device_lan_ports dlp on dn.id = dlp.id_card ";
|
|
11511
|
+
query += "left join site_ports sp on dlp.id_port = sp.id ";
|
|
11512
|
+
query += "where dn.id_device = " + id_device;
|
|
11513
|
+
return query;
|
|
11514
|
+
}
|
|
11515
|
+
|
|
11516
|
+
function getNetworksAndPortByConfig(id_device, id_conf) {
|
|
11517
|
+
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 ";
|
|
11518
|
+
query += "left join device_lan_ports dlp on dn.id = dlp.id_card ";
|
|
11519
|
+
query += "left join site_ports sp on dlp.id_port = sp.id ";
|
|
11520
|
+
query += "where dn.id_device = " + id_device + " ";
|
|
11521
|
+
if (id_conf > 0) {
|
|
11522
|
+
query += "and dn.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
11523
|
+
}
|
|
11524
|
+
else {
|
|
11525
|
+
query += "and dn.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'NETWORK' order by id desc)"
|
|
11526
|
+
}
|
|
11527
|
+
return query;
|
|
11528
|
+
}
|
|
11529
|
+
|
|
11504
11530
|
//End Manage ports
|
|
11505
11531
|
|
|
11506
11532
|
// Manage updateDevicesSite
|
|
@@ -12532,6 +12558,15 @@ function queryStatisticsDeviceStatus(db_used) {
|
|
|
12532
12558
|
return query;
|
|
12533
12559
|
}
|
|
12534
12560
|
|
|
12561
|
+
function convertDateToString(date_to_conv) {
|
|
12562
|
+
var date_str = "";
|
|
12563
|
+
if (date_to_conv) {
|
|
12564
|
+
var d = new Date(date_to_conv);
|
|
12565
|
+
date_str = ("0" + d.getDate()).slice(-2) + '/' + ("0"+(d.getMonth()+1)).slice(-2) + '/' + d.getFullYear();
|
|
12566
|
+
}
|
|
12567
|
+
return date_str;
|
|
12568
|
+
}
|
|
12569
|
+
|
|
12535
12570
|
function tokenizer(marker, input, marker2) {
|
|
12536
12571
|
var retValue = "";
|
|
12537
12572
|
let wordRegex = new RegExp("\/*" + marker + "\/*.", "g");
|
|
@@ -15093,6 +15128,8 @@ module.exports = {
|
|
|
15093
15128
|
getCurrentMatchByIdDeviceIdNetwork,
|
|
15094
15129
|
getPorteByIdDevice,
|
|
15095
15130
|
getPorteComboByIdSiteDevice,
|
|
15131
|
+
getNetworksAndPortOnDevice,
|
|
15132
|
+
getNetworksAndPortByConfig,
|
|
15096
15133
|
//
|
|
15097
15134
|
queryStatistic,
|
|
15098
15135
|
queryStatisticInventary,
|