alsmanager_lib 3.0.102 → 3.0.104
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 +81 -0
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -11364,6 +11364,7 @@ function querySitesWithDefaults(db_used, def_values) {
|
|
|
11364
11364
|
return query;
|
|
11365
11365
|
}
|
|
11366
11366
|
|
|
11367
|
+
// Manage ports
|
|
11367
11368
|
function getPorteByIdSiteSQLite(id_site) {
|
|
11368
11369
|
var query = "select id, port_type as Tipo, port_sign as Porta, note as Note from site_ports sp ";
|
|
11369
11370
|
query += "where sp.id_site = " + id_site + " ";
|
|
@@ -11431,6 +11432,77 @@ function deletePortPerSite(id_port) {
|
|
|
11431
11432
|
return query;
|
|
11432
11433
|
}
|
|
11433
11434
|
|
|
11435
|
+
function getSwitches(id_place) {
|
|
11436
|
+
var query = "select d.id, dw.rete_appartenenza, concat(d.manifacturer, ' - ', d.model, ' - ', dw.rete_appartenenza) as description from devices d ";
|
|
11437
|
+
query += "join device_site ds on ds.id_device = d.id ";
|
|
11438
|
+
query += "join device_switch dw on dw.id_device = d.id ";
|
|
11439
|
+
query += "join site_destinations sd on sd.id_site = ds.id_site ";
|
|
11440
|
+
query += "where sd.type = 'SERVER' and date ('now') >= sd.date_start and date ('now') <= sd.date_end ";
|
|
11441
|
+
query += "and date ('now') >= ds.date_in and date ('now') <= ds.date_out ";
|
|
11442
|
+
query += "and d.type = 'SWITCH' ";
|
|
11443
|
+
query += "and sd.id_place = '" + id_place + "' ";
|
|
11444
|
+
return query;
|
|
11445
|
+
}
|
|
11446
|
+
|
|
11447
|
+
function getTipiPorta() {
|
|
11448
|
+
var query = "select DISTINCT port_type from site_ports ";
|
|
11449
|
+
query += "order by port_type";
|
|
11450
|
+
return query;
|
|
11451
|
+
}
|
|
11452
|
+
|
|
11453
|
+
function insertMatchPortToDevice(id_device, id_network, id_port, note) {
|
|
11454
|
+
var query = "insert into device_port (id_device, id_network, id_port, note) values ";
|
|
11455
|
+
query += "(";
|
|
11456
|
+
query += id_device + ", " + id_network + ", " + id_port + ", '" + note + "'";
|
|
11457
|
+
query += ")";
|
|
11458
|
+
return query;
|
|
11459
|
+
}
|
|
11460
|
+
|
|
11461
|
+
function updateMatchPortToDevice(id_match, id_device, id_network, id_port, note) {
|
|
11462
|
+
var query = "update device_port set ";
|
|
11463
|
+
query += "id_device = " + id_device + ", ";
|
|
11464
|
+
query += "id_network = " + id_network + ", ";
|
|
11465
|
+
query += "id_port = " + id_port + ", ";
|
|
11466
|
+
query += "'" + note + "' ";
|
|
11467
|
+
query += "where id = " + id_match;
|
|
11468
|
+
return query;
|
|
11469
|
+
}
|
|
11470
|
+
|
|
11471
|
+
function deleteMatchPortToDevice(id_match) {
|
|
11472
|
+
var query = "delete from device_port ";
|
|
11473
|
+
query += "where id = " + id_match;
|
|
11474
|
+
return query;
|
|
11475
|
+
}
|
|
11476
|
+
|
|
11477
|
+
function getCurrentMatchByIdDeviceIdNetwork(id_device, id_network) {
|
|
11478
|
+
var query = "select id from device_port ";
|
|
11479
|
+
query += "where id_device = " + id_device + " and id_network = " + id_network;
|
|
11480
|
+
return query;
|
|
11481
|
+
}
|
|
11482
|
+
|
|
11483
|
+
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 device_port dp ";
|
|
11485
|
+
query += "join site_ports sp on sp.id = dp.id_port "
|
|
11486
|
+
query += "where dp.id_device = " + id_device + " ";
|
|
11487
|
+
query += "and dp.id_network = " + id_network + " ";
|
|
11488
|
+
query += "order by sp.port_type, sp.port_sign";
|
|
11489
|
+
return query;
|
|
11490
|
+
}
|
|
11491
|
+
|
|
11492
|
+
function getPorteComboByIdSiteDevice(id_device) {
|
|
11493
|
+
var query = "select distinct sp.id, concat(sp.port_type, ' - ', sp.port_sign) as description from devices d ";
|
|
11494
|
+
query += "join device_site ds on ds.id_device = d.id ";
|
|
11495
|
+
query += "join site_ports sp on sp.id_site = ds.id_site ";
|
|
11496
|
+
query += "where d.id = " + id_device + " ";
|
|
11497
|
+
query += "and date('now') >= ds.date_in and date('now') <= ds.date_out ";
|
|
11498
|
+
query += "and sp.port_type = 'LAN' ";
|
|
11499
|
+
query += "and sp.port_sign is not null "
|
|
11500
|
+
query += "order by port_type, port_sign";
|
|
11501
|
+
return query;
|
|
11502
|
+
}
|
|
11503
|
+
|
|
11504
|
+
//End Manage ports
|
|
11505
|
+
|
|
11434
11506
|
// Manage updateDevicesSite
|
|
11435
11507
|
function verifyPrevDeviceSiteSQLite(id_device) {
|
|
11436
11508
|
var query = "select count(id_site) as numero from device_site ";
|
|
@@ -15007,11 +15079,20 @@ module.exports = {
|
|
|
15007
15079
|
getSitesFromDevice,
|
|
15008
15080
|
getSitesWithDatesFromDevice,
|
|
15009
15081
|
querySitesWithDefaults,
|
|
15082
|
+
//
|
|
15010
15083
|
getPorteByIdSite,
|
|
15011
15084
|
getPortById,
|
|
15012
15085
|
writePortPerSite,
|
|
15013
15086
|
updatePortPerSite,
|
|
15014
15087
|
deletePortPerSite,
|
|
15088
|
+
getSwitches,
|
|
15089
|
+
getTipiPorta,
|
|
15090
|
+
insertMatchPortToDevice,
|
|
15091
|
+
updateMatchPortToDevice,
|
|
15092
|
+
deleteMatchPortToDevice,
|
|
15093
|
+
getCurrentMatchByIdDeviceIdNetwork,
|
|
15094
|
+
getPorteByIdDevice,
|
|
15095
|
+
getPorteComboByIdSiteDevice,
|
|
15015
15096
|
//
|
|
15016
15097
|
queryStatistic,
|
|
15017
15098
|
queryStatisticInventary,
|