alsmanager_lib 3.0.102 → 3.0.103
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 +62 -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,61 @@ 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, date_start, date_end, note) {
|
|
11454
|
+
var query = "insert into device_port (id_device, id_network, id_port, date_start, date_end, note) values ";
|
|
11455
|
+
query += "(";
|
|
11456
|
+
query += id_device + ", " + id_network + ", " + id_port + ", '" + date_start + "', '" + date_end + "', '" + note + "'";
|
|
11457
|
+
query += ")";
|
|
11458
|
+
return query;
|
|
11459
|
+
}
|
|
11460
|
+
|
|
11461
|
+
function updateMatchPortToDevice(id_match, id_device, id_network, id_port, date_start, date_end, 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 += "'" + date_start + "', ";
|
|
11467
|
+
query += "'" + date_end + "', ";
|
|
11468
|
+
query += "'" + note + "' ";
|
|
11469
|
+
query += "where id = " + id_match;
|
|
11470
|
+
return query;
|
|
11471
|
+
}
|
|
11472
|
+
|
|
11473
|
+
function deleteMatchPortToDevice(id_match) {
|
|
11474
|
+
var query = "delete from device_port ";
|
|
11475
|
+
query += "where id = " + id_match;
|
|
11476
|
+
return query;
|
|
11477
|
+
}
|
|
11478
|
+
|
|
11479
|
+
function getPortByIdDevice(id_device, id_network) {
|
|
11480
|
+
var query = "select dp.id, sp.port_type as Tipo, sp.port_sign as Porta, sp.note as Note from device_port dp ";
|
|
11481
|
+
query += "join site_ports sp on sp.id = dp.id_port "
|
|
11482
|
+
query += "where dp.id_device = " + id_device + " ";
|
|
11483
|
+
query += "and dp.id_network = " + id_network + " ";
|
|
11484
|
+
query += "order by sp.port_type, sp.port_sign";
|
|
11485
|
+
return query;
|
|
11486
|
+
}
|
|
11487
|
+
|
|
11488
|
+
//End Manage ports
|
|
11489
|
+
|
|
11434
11490
|
// Manage updateDevicesSite
|
|
11435
11491
|
function verifyPrevDeviceSiteSQLite(id_device) {
|
|
11436
11492
|
var query = "select count(id_site) as numero from device_site ";
|
|
@@ -15007,11 +15063,17 @@ module.exports = {
|
|
|
15007
15063
|
getSitesFromDevice,
|
|
15008
15064
|
getSitesWithDatesFromDevice,
|
|
15009
15065
|
querySitesWithDefaults,
|
|
15066
|
+
//
|
|
15010
15067
|
getPorteByIdSite,
|
|
15011
15068
|
getPortById,
|
|
15012
15069
|
writePortPerSite,
|
|
15013
15070
|
updatePortPerSite,
|
|
15014
15071
|
deletePortPerSite,
|
|
15072
|
+
getSwitches,
|
|
15073
|
+
getTipiPorta,
|
|
15074
|
+
insertMatchPortToDevice,
|
|
15075
|
+
updateMatchPortToDevice,deleteMatchPortToDevice,
|
|
15076
|
+
getPortByIdDevice,
|
|
15015
15077
|
//
|
|
15016
15078
|
queryStatistic,
|
|
15017
15079
|
queryStatisticInventary,
|