alsmanager_lib 3.0.110 → 3.0.112

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 +57 -24
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -1224,8 +1224,8 @@ function getVoIPDevices() {
1224
1224
 
1225
1225
  // End manage Voip
1226
1226
  // Software management
1227
- function getSoftwares(db_used, maker, model, platform, licence_type) {
1228
- var query = "select id, maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura, life_licence ";
1227
+ function getSoftwares(db_used, maker, model, platform, license_type) {
1228
+ var query = "select id, maker, model, support, platform, release_year, version, build_no, license_type, license_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura, life_license, no_inventario ";
1229
1229
  query += "from softwares ";
1230
1230
  query += "where (is_removed is null or is_removed = 0) ";
1231
1231
  if (maker) {
@@ -1237,27 +1237,27 @@ function getSoftwares(db_used, maker, model, platform, licence_type) {
1237
1237
  if (platform) {
1238
1238
  query += "and platform = '" + platform + "' ";
1239
1239
  }
1240
- if (licence_type) {
1241
- query += "and licence_type = '" + licence_type + "' ";
1240
+ if (license_type) {
1241
+ query += "and license_type = '" + license_type + "' ";
1242
1242
  }
1243
1243
  return query;
1244
1244
  }
1245
1245
  function getSoftwareByCodice(db_used, codice) {
1246
- var query = "select id, maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura, life_licence ";
1246
+ var query = "select id, maker, model, support, platform, release_year, version, build_no, license_type, license_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura, life_license, no_inventario ";
1247
1247
  query += "from softwares ";
1248
1248
  query += "where (is_removed is null or is_removed = 0) ";
1249
1249
  query += "and inv_ict3_number = '" + codice + "' or serial_no = '" + codice + "'";
1250
1250
  return query;
1251
1251
  }
1252
1252
  function getSoftwareById(db_used, id_sw) {
1253
- var query = "select id, maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura, life_licence ";
1253
+ var query = "select id, maker, model, support, platform, release_year, version, build_no, license_type, license_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura, life_license, no_inventario ";
1254
1254
  query += "from softwares ";
1255
1255
  query += "where (is_removed is null or is_removed = 0) ";
1256
1256
  query += "and id = " + id_sw;
1257
1257
  return query;
1258
1258
  }
1259
1259
  function getSoftwareForConsegnaById(db_used, id_sw) {
1260
- var query = "select id, maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura, life_licence, ";
1260
+ var query = "select s.id, s.maker, s.model, s.support, s.platform, s.release_year, s.version, s.build_no, s.license_type, s.license_key, s.expired_date, s.is_pnrr, s.inv_ict3_number, s.serial_no, s.architettura, s.life_license, s.no_inventario, ";
1261
1261
  query += "case ";
1262
1262
  query += "when s.no_inventario is not null and s.no_inventario > 0 then concat(s.id,'(ID)') ";
1263
1263
  query += "when s.inv_ict3_number != '' and s.inv_ict3_number is not null then s.inv_ict3_number ";
@@ -1269,7 +1269,7 @@ function getSoftwareForConsegnaById(db_used, id_sw) {
1269
1269
  return query;
1270
1270
  }
1271
1271
  function insertSoftware(db_used, software) {
1272
- var query = "insert into softwares (maker, model, support, platform, release_year, version, build_no, licence_type, licence_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura) values (";
1272
+ var query = "insert into softwares (maker, model, support, platform, release_year, version, build_no, license_type, license_key, expired_date, is_pnrr, inv_ict3_number, serial_no, architettura, life_license, no_inventario) values (";
1273
1273
  query += "'" + software.marca + "', ";
1274
1274
  query += "'" + software.modello + "', ";
1275
1275
  query += "'" + software.supporto + "', ";
@@ -1277,14 +1277,15 @@ function insertSoftware(db_used, software) {
1277
1277
  query += "'" + software.release_year + "', ";
1278
1278
  query += "'" + software.version + "', ";
1279
1279
  query += "'" + software.build_no + "', ";
1280
- query += "'" + software.licence_type + "', ";
1281
- query += "'" + software.licence_key + "', ";
1280
+ query += "'" + software.license_type + "', ";
1281
+ query += "'" + software.license_key + "', ";
1282
1282
  query += "'" + software.data_scadenza + "', ";
1283
1283
  query += software.is_pnrr + ", ";
1284
1284
  query += "'" + software.inventario + "', ";
1285
1285
  query += "'" + software.serial_no + "', ";
1286
1286
  query += "'" + software.architettura + "', ";
1287
- query += software.life_licence + " ";
1287
+ query += software.life_license + ", ";
1288
+ query += software.no_inventario + " ";
1288
1289
  query += ")";
1289
1290
  return query;
1290
1291
  }
@@ -1298,14 +1299,15 @@ function updateSoftware(db_used, id_sw, software) {
1298
1299
  query += "release_year = '" + software.release_year + "', ";
1299
1300
  query += "version = '" + software.version + "', ";
1300
1301
  query += "build_no = '" + software.build_no + "', ";
1301
- query += "licence_type = '" + software.licence_type + "', ";
1302
- query += "licence_key = '" + software.licence_key + "', ";
1302
+ query += "license_type = '" + software.license_type + "', ";
1303
+ query += "license_key = '" + software.license_key + "', ";
1303
1304
  query += "expired_date = '" + software.data_scadenza + "', ";
1304
1305
  query += "is_pnrr = " + software.is_pnrr + ", ";
1305
1306
  query += "inv_ict3_number = '" + software.inventario + "', ";
1306
1307
  query += "serial_no = '" + software.serial_no + "', ";
1307
1308
  query += "architettura = '" + software.architettura + "', ";
1308
- query += "life_licence = " + software.life_licence + " ";
1309
+ query += "life_license = " + software.life_license + ", ";
1310
+ query += "no_inventario = " + software.no_inventario + ", ";
1309
1311
  query += "where id = " + id_sw;
1310
1312
  return query;
1311
1313
  }
@@ -2318,7 +2320,7 @@ function existsSwitchPatchProperties(db_used, id_device) {
2318
2320
  }
2319
2321
  function getSwitchPatchPropertiesSQLite(id_device) {
2320
2322
  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 ";
2323
+ query += "ds.num_ports as NumeroPorte, ds.num_poe as NumPOE, ds.rete_appartenenza ";
2322
2324
  query += "from devices d ";
2323
2325
  query += "left join device_switch ds on d.id = ds.id_device ";
2324
2326
  query += "where d.id = " + id_device;
@@ -2326,7 +2328,7 @@ function getSwitchPatchPropertiesSQLite(id_device) {
2326
2328
  }
2327
2329
  function getSwitchPatchPropertiesMySQL(id_device) {
2328
2330
  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 ";
2331
+ query += "ds.num_ports as NumeroPorte, ds.num_poe as NumPOE, ds.rete_appartenenza ";
2330
2332
  query += "from devices d ";
2331
2333
  query += "left join device_switch ds on d.id = ds.id_device ";
2332
2334
  query += "where d.id = :id_device";
@@ -2353,16 +2355,18 @@ function createSwitchPatchPropertiesMySQLObj(id_device, dev_prop) {
2353
2355
  var obj = {};
2354
2356
  obj.id_device = id_device;
2355
2357
  obj.num_ports = dev_prop.num_ports;
2358
+ obj.num_poe = dev_prop.num_poe;
2359
+ obj.rete_appartenenza = dev_prop.rete_appartenenza;
2356
2360
  return obj;
2357
2361
  }
2358
2362
  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 + "')";
2363
+ var query = "insert into device_switch (id_device, num_ports, num_poe, tipo, rete_appartenenza) values ";
2364
+ query += "(" + id_device + ", " + dev_prop.num_ports + ", " + dev_prop.num_poe + ", '" + dev_prop.tipo + ", '" + dev_prop.rete_appartenenza + "')";
2361
2365
  return query;
2362
2366
  }
2363
2367
  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)";
2368
+ var query = "insert into device_switch (id_device, num_ports, num_poe, tipo, rete_appartenenza) values ";
2369
+ query += "(:id_device, :num_ports, :num_poe, :tipo, :rete_appartenenza)";
2366
2370
  }
2367
2371
  function insertSwitchPatchProperties(db_used, id_device, dev_prop) {
2368
2372
  var query = "";
@@ -2386,7 +2390,8 @@ function updateSwitchPatchPropertiesSQLite(id_device, dev_prop) {
2386
2390
  var query = "update device_switch set ";
2387
2391
  query += "id_device = " + id_device + ", ";
2388
2392
  query += "num_ports = " + dev_prop.num_ports + ", ";
2389
- query += "num_poe = " + dev_prop.num_poe + " ";
2393
+ query += "num_poe = " + dev_prop.num_poe + ", ";
2394
+ query += "rete_appartenenza = '" + dev_prop.rete_appartenenza + " ";
2390
2395
  query += "where id_device = " + id_device;
2391
2396
  return query;
2392
2397
  }
@@ -2395,7 +2400,8 @@ function updateSwitchPatchPropertiesMySQL() {
2395
2400
  var query = "update device_switch set ";
2396
2401
  query += "id_device = :id_device, ";
2397
2402
  query += "num_ports = :num_ports, ";
2398
- query += "num_poe = :num_poe ";
2403
+ query += "num_poe = :num_poe, ";
2404
+ query += "rete_appartenenza = :rete_appartenenza ";
2399
2405
  query += "where id_device = :id_device";
2400
2406
  return query;
2401
2407
  }
@@ -8580,7 +8586,7 @@ function selectSoftwareConsegna(db_used, id_consegna, id_software) {
8580
8586
  }
8581
8587
 
8582
8588
  function selectSoftwaresInDepositoSQLite(inv_code) {
8583
- var query = "SELECT s.id, s.support, s.platform, s.version, s.licence_type, s.maker, s.model, ";
8589
+ var query = "SELECT s.id, s.support, s.platform, s.version, s.license_type, s.maker, s.model, ";
8584
8590
  query += "case ";
8585
8591
  query += "when s.inv_ict3_number != '' and s.inv_ict3_number is not null then s.inv_ict3_number ";
8586
8592
  query += "when s.serial_no != '' and s.serial_no is not null then concat(s.serial_no,'(S/N)') ";
@@ -8594,7 +8600,7 @@ function selectSoftwaresInDepositoSQLite(inv_code) {
8594
8600
  return query;
8595
8601
  }
8596
8602
  function selectSoftwaresInDepositoMySQL(inv_code) {
8597
- var query = "SELECT s.id, s.support, s.platform, s.version, s.licence_type, s.maker, s.model, ";
8603
+ var query = "SELECT s.id, s.support, s.platform, s.version, s.license_type, s.maker, s.model, ";
8598
8604
  query += "case ";
8599
8605
  query += "when s.inv_ict3_number != '' and s.inv_ict3_number is not null then s.inv_ict3_number ";
8600
8606
  query += "when s.serial_no != '' and s.serial_no is not null then concat(s.serial_no,'(S/N)') ";
@@ -12510,7 +12516,31 @@ function removeBenchmarkById(db_used, id_device) {
12510
12516
  }
12511
12517
 
12512
12518
  //End benchmarking
12519
+ // Manage Armadio
12520
+ function getArmadioStructure(id_place, date_ref) {
12521
+ var query = "select d.id, d.type, d.manifacturer, d.model, ds.num_ports from armadio_structure ast ";
12522
+ query += "join devices d on d.id = ast.id_device ";
12523
+ query += "left join device_switch ds on ast.id_device = ds.id_device ";
12524
+ query += "join device_site dt on dt.id_device = ast.id_device ";
12525
+ query += "where dt.id_place = '" + id_place + "' ";
12526
+ if (date_ref) {
12527
+ var dt_ref = convertDateToStringDB(date_ref);
12528
+ query += "and '" + dt_ref + "' >= dt.date_in and '" + dt_ref + "' <= dt.date_out ";
12529
+ }
12530
+ else {
12531
+ query += "and date('now') >= dt.date_in and date('now') <= dt.date_out ";
12532
+ }
12533
+ query += "order by ast.level ";
12534
+ return query;
12535
+ }
12513
12536
 
12537
+ function getConnectedDevices(id_device) {
12538
+ var query = "";
12539
+ query += "";
12540
+ return query;
12541
+ }
12542
+
12543
+ // End Manage Armadio
12514
12544
  //Get Devices Statistics bt Status
12515
12545
  function queryStatisticsDeviceStatusSQLite() {
12516
12546
  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 +15170,9 @@ module.exports = {
15140
15170
  getNetworksAndPortOnDevice,
15141
15171
  getNetworksAndPortByConfig,
15142
15172
  //
15173
+ getArmadioStructure,
15174
+ getConnectedDevices,
15175
+ //
15143
15176
  queryStatistic,
15144
15177
  queryStatisticInventary,
15145
15178
  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.112",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",