alsmanager_lib 3.0.110 → 3.0.111

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.
Files changed (2) hide show
  1. package/lib/modules.js +39 -8
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -2318,7 +2318,7 @@ function existsSwitchPatchProperties(db_used, id_device) {
2318
2318
  }
2319
2319
  function getSwitchPatchPropertiesSQLite(id_device) {
2320
2320
  var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
2321
- query += "ds.num_ports as NumeroPorte, ds.num_poe as NumPOE ";
2321
+ query += "ds.num_ports as NumeroPorte, ds.num_poe as NumPOE, ds.rete_appartenenza ";
2322
2322
  query += "from devices d ";
2323
2323
  query += "left join device_switch ds on d.id = ds.id_device ";
2324
2324
  query += "where d.id = " + id_device;
@@ -2326,7 +2326,7 @@ function getSwitchPatchPropertiesSQLite(id_device) {
2326
2326
  }
2327
2327
  function getSwitchPatchPropertiesMySQL(id_device) {
2328
2328
  var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
2329
- query += "ds.num_ports as NumeroPorte, ds.num_poe as NumPOE ";
2329
+ query += "ds.num_ports as NumeroPorte, ds.num_poe as NumPOE, ds.rete_appartenenza ";
2330
2330
  query += "from devices d ";
2331
2331
  query += "left join device_switch ds on d.id = ds.id_device ";
2332
2332
  query += "where d.id = :id_device";
@@ -2353,16 +2353,18 @@ function createSwitchPatchPropertiesMySQLObj(id_device, dev_prop) {
2353
2353
  var obj = {};
2354
2354
  obj.id_device = id_device;
2355
2355
  obj.num_ports = dev_prop.num_ports;
2356
+ obj.num_poe = dev_prop.num_poe;
2357
+ obj.rete_appartenenza = dev_prop.rete_appartenenza;
2356
2358
  return obj;
2357
2359
  }
2358
2360
  function insertSwitchPatchPropertiesSQLite(id_device, dev_prop) {
2359
- var query = "insert into device_switch (id_device, num_ports, num_poe, tipo) values ";
2360
- query += "(" + id_device + ", " + dev_prop.num_ports + ", " + dev_prop.num_poe + ", '" + dev_prop.tipo + "')";
2361
+ var query = "insert into device_switch (id_device, num_ports, num_poe, tipo, rete_appartenenza) values ";
2362
+ query += "(" + id_device + ", " + dev_prop.num_ports + ", " + dev_prop.num_poe + ", '" + dev_prop.tipo + ", '" + dev_prop.rete_appartenenza + "')";
2361
2363
  return query;
2362
2364
  }
2363
2365
  function insertSwitchPatchPropertiesMySQL() {
2364
- var query = "insert into device_switch (id_device, num_ports, num_poe, tipo) values ";
2365
- query += "(:id_device, :num_ports, :num_poe, :tipo)";
2366
+ var query = "insert into device_switch (id_device, num_ports, num_poe, tipo, rete_appartenenza) values ";
2367
+ query += "(:id_device, :num_ports, :num_poe, :tipo, :rete_appartenenza)";
2366
2368
  }
2367
2369
  function insertSwitchPatchProperties(db_used, id_device, dev_prop) {
2368
2370
  var query = "";
@@ -2386,7 +2388,8 @@ function updateSwitchPatchPropertiesSQLite(id_device, dev_prop) {
2386
2388
  var query = "update device_switch set ";
2387
2389
  query += "id_device = " + id_device + ", ";
2388
2390
  query += "num_ports = " + dev_prop.num_ports + ", ";
2389
- query += "num_poe = " + dev_prop.num_poe + " ";
2391
+ query += "num_poe = " + dev_prop.num_poe + ", ";
2392
+ query += "rete_appartenenza = '" + dev_prop.rete_appartenenza + " ";
2390
2393
  query += "where id_device = " + id_device;
2391
2394
  return query;
2392
2395
  }
@@ -2395,7 +2398,8 @@ function updateSwitchPatchPropertiesMySQL() {
2395
2398
  var query = "update device_switch set ";
2396
2399
  query += "id_device = :id_device, ";
2397
2400
  query += "num_ports = :num_ports, ";
2398
- query += "num_poe = :num_poe ";
2401
+ query += "num_poe = :num_poe, ";
2402
+ query += "rete_appartenenza = :rete_appartenenza ";
2399
2403
  query += "where id_device = :id_device";
2400
2404
  return query;
2401
2405
  }
@@ -12510,7 +12514,31 @@ function removeBenchmarkById(db_used, id_device) {
12510
12514
  }
12511
12515
 
12512
12516
  //End benchmarking
12517
+ // Manage Armadio
12518
+ function getArmadioStructure(id_place, date_ref) {
12519
+ var query = "select d.id, d.type, d.manifacturer, d.model, ds.num_ports from armadio_structure ast ";
12520
+ query += "join devices d on d.id = ast.id_device ";
12521
+ query += "left join device_switch ds on ast.id_device = ds.id_device ";
12522
+ query += "join device_site dt on dt.id_device = ast.id_device ";
12523
+ query += "where dt.id_place = '" + id_place + "' ";
12524
+ if (date_ref) {
12525
+ var dt_ref = convertDateToStringDB(date_ref);
12526
+ query += "and '" + dt_ref + "' >= dt.date_in and '" + dt_ref + "' <= dt.date_out ";
12527
+ }
12528
+ else {
12529
+ query += "and date('now') >= dt.date_in and date('now') <= dt.date_out ";
12530
+ }
12531
+ query += "order by ast.level ";
12532
+ return query;
12533
+ }
12513
12534
 
12535
+ function getConnectedDevices(id_device) {
12536
+ var query = "";
12537
+ query += "";
12538
+ return query;
12539
+ }
12540
+
12541
+ // End Manage Armadio
12514
12542
  //Get Devices Statistics bt Status
12515
12543
  function queryStatisticsDeviceStatusSQLite() {
12516
12544
  var query = "select case when ds.status is null then 0 else ds.status end as Stato, sd.name as Descrizione, count(*) as Numero from devices d ";
@@ -15140,6 +15168,9 @@ module.exports = {
15140
15168
  getNetworksAndPortOnDevice,
15141
15169
  getNetworksAndPortByConfig,
15142
15170
  //
15171
+ getArmadioStructure,
15172
+ getConnectedDevices,
15173
+ //
15143
15174
  queryStatistic,
15144
15175
  queryStatisticInventary,
15145
15176
  queryStatisticsDeviceStatus,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./lib/modules.js",
5
5
  "./dbconn": "./lib/dbconn.js"
6
6
  },
7
- "version": "3.0.110",
7
+ "version": "3.0.111",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",