alsmanager_lib 2.0.67 → 2.0.69

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 +49 -12
  2. package/package.json +1 -1
package/lib/modules.js CHANGED
@@ -507,7 +507,7 @@ function getStoragesByConfigSQLite(id_device, id_conf) {
507
507
  query += "and ds.id in (select id_part from change_config where id_conf = " + id_conf + ")";
508
508
  }
509
509
  else {
510
- query += "and ds.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'STORAGE' order by id desc LIMIT 1)"
510
+ query += "and ds.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'STORAGE' order by id desc)"
511
511
  }
512
512
  return query;
513
513
  }
@@ -519,7 +519,19 @@ function getStoragesByConfigMySQL(id_device, id_conf) {
519
519
  query += "and ds.id in (select id_part from change_config where id_conf = :id_conf)";
520
520
  }
521
521
  else {
522
- query += "and ds.id in (select id_part from change_config where id_device = :id_device and part_type = 'STORAGE' order by id desc LIMIT 1)"
522
+ query += "and ds.id in (select id_part from change_config where id_device = :id_device and part_type = 'STORAGE' order by id desc)"
523
+ }
524
+ return query;
525
+ }
526
+ function getStoragesByConfigMySQL2(id_device, id_conf) {
527
+ var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
528
+ query += "join storage_types st on st.id = ds.storage_type ";
529
+ query += "where id_device = " + id_device + " ";
530
+ if (id_conf > 0) {
531
+ query += "and ds.id in (select id_part from change_config where id_conf = " + id_conf + ")";
532
+ }
533
+ else {
534
+ query += "and ds.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'STORAGE' order by id desc)"
523
535
  }
524
536
  return query;
525
537
  }
@@ -534,7 +546,7 @@ function getStoragesByConfig(db_used, id_device, id_conf) {
534
546
  query = getStoragesByConfigMySQL(id_device, id_conf);
535
547
  break;
536
548
  case 'MYSQL2':
537
- query = getStoragesByConfigSQLite(id_device, id_conf);
549
+ query = getStoragesByConfigMySQL2(id_device, id_conf);
538
550
  break;
539
551
  }
540
552
  }
@@ -810,7 +822,7 @@ function getNetworksByConfigSQLite(id_device, id_conf) {
810
822
  query += "and dn.id in (select id_part from change_config where id_conf = " + id_conf + ")";
811
823
  }
812
824
  else {
813
- query += "and dn.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'NETWORK' order by id desc LIMIT 1)"
825
+ query += "and dn.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'NETWORK' order by id desc)"
814
826
  }
815
827
  return query;
816
828
  }
@@ -821,10 +833,21 @@ function getNetworksByConfigMySQL(id_device, id_conf) {
821
833
  query += "and dn.id in (select id_part from change_config where id_conf = :id_conf)";
822
834
  }
823
835
  else {
824
- query += "and dn.id in (select id_part from change_config where id_device = :id_device and part_type = 'NETWORK' order by id desc LIMIT 1)"
836
+ query += "and dn.id in (select id_part from change_config where id_device = :id_device and part_type = 'NETWORK' order by id desc)"
825
837
  }
826
838
  return query;
827
839
  }
840
+ function getNetworksByConfigMySQL2(id_device, id_conf) {
841
+ var query = "select dn.id, dn.net_type as Tipo, dn.mac_address as MAC, dn.ipv4_static as IP4, dn.ipv6_static as IP6 from device_networks dn ";
842
+ query += "where dn.id_device = " + id_device + " ";
843
+ if (id_conf > 0) {
844
+ query += "and dn.id in (select id_part from change_config where id_conf = " + id_conf + ")";
845
+ }
846
+ else {
847
+ query += "and dn.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'NETWORK' order by id desc)"
848
+ }
849
+ return query;
850
+ }
828
851
  function getNetworksByConfig(db_used, id_device, id_conf) {
829
852
  var query = "";
830
853
  if (db_used) {
@@ -836,7 +859,7 @@ function getNetworksByConfig(db_used, id_device, id_conf) {
836
859
  query = getNetworksByConfigMySQL(id_device, id_conf);
837
860
  break;
838
861
  case 'MYSQL2':
839
- query = getNetworksByConfigSQLite(id_device, id_conf);
862
+ query = getNetworksByConfigMySQL2(id_device, id_conf);
840
863
  break;
841
864
  }
842
865
  }
@@ -1142,7 +1165,7 @@ function getAddOnsByConfigSQLite(id_device, id_conf) {
1142
1165
  query += "and da.id in (select id_part from change_config where id_conf = " + id_conf + ")";
1143
1166
  }
1144
1167
  else {
1145
- query += "and da.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'ADDON' order by id desc LIMIT 1)"
1168
+ query += "and da.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'ADDON' order by id desc)"
1146
1169
  }
1147
1170
  return query;
1148
1171
  }
@@ -1154,7 +1177,19 @@ function getAddOnsByConfigMySQL(id_device, id_conf) {
1154
1177
  query += "and da.id in (select id_part from change_config where id_conf = :id_conf)";
1155
1178
  }
1156
1179
  else {
1157
- query += "and da.id in (select id_part from change_config where id_device = :id_device and part_type = 'ADDON' order by id desc LIMIT 1)"
1180
+ query += "and da.id in (select id_part from change_config where id_device = :id_device and part_type = 'ADDON' order by id desc)"
1181
+ }
1182
+ return query;
1183
+ }
1184
+ function getAddOnsByConfigMySQL2(id_device, id_conf) {
1185
+ var query = "select da.id, a.name as Tipo, da.maker as Marca, da.model as Modello, da.description as Descrizione from device_addons da ";
1186
+ query += "join addon_types a on a.id = da.addon_type ";
1187
+ query += "where da.id_device = " + id_device + " ";
1188
+ if (id_conf > 0) {
1189
+ query += "and da.id in (select id_part from change_config where id_conf = " + id_conf + ")";
1190
+ }
1191
+ else {
1192
+ query += "and da.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'ADDON' order by id desc)"
1158
1193
  }
1159
1194
  return query;
1160
1195
  }
@@ -1169,7 +1204,7 @@ function getAddOnsByConfig(db_used, id_device, id_conf) {
1169
1204
  query = getAddOnsByConfigMySQL(id_device, id_conf);
1170
1205
  break;
1171
1206
  case 'MYSQL2':
1172
- query = getAddOnsByConfigSQLite(id_device, id_conf);
1207
+ query = getAddOnsByConfigMySQL2(id_device, id_conf);
1173
1208
  break;
1174
1209
  }
1175
1210
  }
@@ -1584,12 +1619,14 @@ function existPartInConfig(db_used, id_device, id_conf, id_part, part_type) {
1584
1619
  // Disk usage
1585
1620
  function getDiskUsagesByIdStorageSQLite(id_storage) {
1586
1621
  var query = "select id, date_ref, id_device, id_storage, size_unit, available_space from disk_usage ";
1587
- query += "where id_storage = " + id_storage;
1622
+ query += "where id_storage = " + id_storage + " ";
1623
+ query += "order by id desc";
1588
1624
  return query
1589
1625
  }
1590
1626
  function getDiskUsagesByIdStorageMySQL(id_storage) {
1591
1627
  var query = "select id, date_ref, id_device, id_storage, size_unit, available_space from disk_usage ";
1592
- query += "where id_storage = :id_storage";
1628
+ query += "where id_storage = :id_storage ";
1629
+ query += "order by id desc";
1593
1630
  return query
1594
1631
  }
1595
1632
  function getDiskUsagesByIdStorage(db_used, id_storage) {
@@ -6128,7 +6165,7 @@ function queryConsegne(db_used,data_da, data_a, data_filter) {
6128
6165
  query = queryConsegneMySQL(data_da, data_a, data_filter);
6129
6166
  break;
6130
6167
  case 'MYSQL2':
6131
- query = queryConsegneMySQL2(data_da, data_a, data_filter);
6168
+ query = queryConsegneSQLite(data_da, data_a, data_filter);
6132
6169
  break;
6133
6170
  }
6134
6171
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  ".": "./lib/modules.js",
5
5
  "./dbconn": "./lib/dbconn.js"
6
6
  },
7
- "version": "2.0.67",
7
+ "version": "2.0.69",
8
8
  "description": "Funzioni per ALSManager",
9
9
  "license": "ISC",
10
10
  "author": "Luca Cattani",