alsmanager_lib 1.0.86 → 1.0.88
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 +95 -13
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -413,14 +413,24 @@ function getStoragesByConfigSQLite(id_device, id_conf) {
|
|
|
413
413
|
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 ";
|
|
414
414
|
query += "join storage_types st on st.id = ds.storage_type ";
|
|
415
415
|
query += "where id_device = " + id_device + " ";
|
|
416
|
-
|
|
416
|
+
if (id_conf > 0) {
|
|
417
|
+
query += "and ds.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
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)"
|
|
421
|
+
}
|
|
417
422
|
return query;
|
|
418
423
|
}
|
|
419
424
|
function getStoragesByConfigMySQL(id_device, id_conf) {
|
|
420
425
|
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 ";
|
|
421
426
|
query += "join storage_types st on st.id = ds.storage_type ";
|
|
422
427
|
query += "where id_device = :id_device ";
|
|
423
|
-
|
|
428
|
+
if (id_conf > 0) {
|
|
429
|
+
query += "and ds.id in (select id_part from change_config where id_conf = :id_conf)";
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
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)"
|
|
433
|
+
}
|
|
424
434
|
return query;
|
|
425
435
|
}
|
|
426
436
|
function getStoragesByConfig(db_used, id_device, id_conf) {
|
|
@@ -679,13 +689,23 @@ function getLastNetworkInserted(db_used, id_device) {
|
|
|
679
689
|
function getNetworksByConfigSQLite(id_device, id_conf) {
|
|
680
690
|
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 ";
|
|
681
691
|
query += "where dn.id_device = " + id_device + " ";
|
|
682
|
-
|
|
692
|
+
if (id_conf > 0) {
|
|
693
|
+
query += "and dn.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
694
|
+
}
|
|
695
|
+
else {
|
|
696
|
+
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)"
|
|
697
|
+
}
|
|
683
698
|
return query;
|
|
684
699
|
}
|
|
685
700
|
function getNetworksByConfigMySQL(id_device, id_conf) {
|
|
686
701
|
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 ";
|
|
687
702
|
query += "where dn.id_device = :id_device ";
|
|
688
|
-
|
|
703
|
+
if (id_conf > 0) {
|
|
704
|
+
query += "and dn.id in (select id_part from change_config where id_conf = :id_conf)";
|
|
705
|
+
}
|
|
706
|
+
else {
|
|
707
|
+
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)"
|
|
708
|
+
}
|
|
689
709
|
return query;
|
|
690
710
|
}
|
|
691
711
|
function getNetworksByConfig(db_used, id_device, id_conf) {
|
|
@@ -971,14 +991,24 @@ function getAddOnsByConfigSQLite(id_device, id_conf) {
|
|
|
971
991
|
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 ";
|
|
972
992
|
query += "join addon_types a on a.id = da.addon_type ";
|
|
973
993
|
query += "where da.id_device = " + id_device + " ";
|
|
974
|
-
|
|
994
|
+
if (id_conf > 0) {
|
|
995
|
+
query += "and da.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
996
|
+
}
|
|
997
|
+
else {
|
|
998
|
+
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)"
|
|
999
|
+
}
|
|
975
1000
|
return query;
|
|
976
1001
|
}
|
|
977
1002
|
function getAddOnsByConfigMySQL(id_device, id_conf) {
|
|
978
1003
|
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 ";
|
|
979
1004
|
query += "join addon_types a on a.id = da.addon_type ";
|
|
980
1005
|
query += "where da.id_device = :id_device ";
|
|
981
|
-
|
|
1006
|
+
if (id_conf > 0) {
|
|
1007
|
+
query += "and da.id in (select id_part from change_config where id_conf = :id_conf)";
|
|
1008
|
+
}
|
|
1009
|
+
else {
|
|
1010
|
+
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)"
|
|
1011
|
+
}
|
|
982
1012
|
return query;
|
|
983
1013
|
}
|
|
984
1014
|
function getAddOnsByConfig(db_used, id_device, id_conf) {
|
|
@@ -1222,27 +1252,31 @@ function updatePartChanged(db_used, id_change, operation, id_part_replaced) {
|
|
|
1222
1252
|
return query;
|
|
1223
1253
|
}
|
|
1224
1254
|
|
|
1225
|
-
function removePartChangedSQLite(
|
|
1255
|
+
function removePartChangedSQLite(id_conf, id_part, part_type) {
|
|
1226
1256
|
var query = "delete from change_config ";
|
|
1227
|
-
query += "where
|
|
1257
|
+
query += "where id_device = " + id_part + " ";
|
|
1258
|
+
query += "and id_conf = " + id_conf + " ";
|
|
1259
|
+
query += "and part_type = '" + part_type + "'";
|
|
1228
1260
|
return query;
|
|
1229
1261
|
}
|
|
1230
1262
|
|
|
1231
|
-
function removePartChangedMySQL(
|
|
1263
|
+
function removePartChangedMySQL(id_conf, id_part) {
|
|
1232
1264
|
var query = "delete from change_config ";
|
|
1233
|
-
query += "where
|
|
1265
|
+
query += "where id_device = :id_part ";
|
|
1266
|
+
query += "and id_conf = :id_conf ";
|
|
1267
|
+
query += "and part_type = :part_type";
|
|
1234
1268
|
return query;
|
|
1235
1269
|
}
|
|
1236
1270
|
|
|
1237
|
-
function removePartChanged(db_used,
|
|
1271
|
+
function removePartChanged(db_used, id_conf, id_part, part_type) {
|
|
1238
1272
|
var query = "";
|
|
1239
1273
|
if (db_used) {
|
|
1240
1274
|
switch (db_used) {
|
|
1241
1275
|
case 'SQLITE':
|
|
1242
|
-
query = removePartChangedSQLite(
|
|
1276
|
+
query = removePartChangedSQLite(id_conf, id_part, part_type);
|
|
1243
1277
|
break;
|
|
1244
1278
|
case 'MYSQL':
|
|
1245
|
-
query = removePartChangedMySQL(
|
|
1279
|
+
query = removePartChangedMySQL(id_conf, id_part, part_type);
|
|
1246
1280
|
break;
|
|
1247
1281
|
}
|
|
1248
1282
|
}
|
|
@@ -1608,6 +1642,53 @@ function updatePCProperties(db_used, id_device, dev_prop) {
|
|
|
1608
1642
|
}
|
|
1609
1643
|
return query;
|
|
1610
1644
|
}
|
|
1645
|
+
//
|
|
1646
|
+
function getPCPropertiesByConfigSQLite(id_device, id_conf) {
|
|
1647
|
+
var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
|
|
1648
|
+
query += "dp.pc_name as Name, dp.CPU as CPU, dp.CPU_arch as CPUArch, dp.OS_arch as OSArch, dp.OS as OS, dp.OS_version as OSVersion, ";
|
|
1649
|
+
query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
|
|
1650
|
+
query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
|
|
1651
|
+
query += "from devices d ";
|
|
1652
|
+
query += "left join device_pc dp on d.id = dp.id_device ";
|
|
1653
|
+
query += "where d.id = " + id_device;
|
|
1654
|
+
if (id_conf > 0) {
|
|
1655
|
+
query += "and d.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
1656
|
+
}
|
|
1657
|
+
else {
|
|
1658
|
+
query += "and d.id in (select id_part from change_config where id_device = " + id_device + " and part_type = 'PC' order by id desc LIMIT 1)"
|
|
1659
|
+
}
|
|
1660
|
+
return query;
|
|
1661
|
+
}
|
|
1662
|
+
function getPCPropertiesByConfigMySQL(id_device, id_conf) {
|
|
1663
|
+
var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
|
|
1664
|
+
query += "dp.pc_name as Name, dp.CPU as CPU, dp.CPU_arch as CPUArch, dp.OS_arch as OSArch, dp.OS as OS, dp.OS_version as OSVersion, ";
|
|
1665
|
+
query += "dp.smartboard_ready as SB_Ready, dp.video_card as VideoCardAdded, ";
|
|
1666
|
+
query += "dp.RAM_GB as RAM, dp.note, dp.da_properties ";
|
|
1667
|
+
query += "from devices d ";
|
|
1668
|
+
query += "left join device_pc dp on d.id = dp.id_device ";
|
|
1669
|
+
query += "where d.id = :id_device ";
|
|
1670
|
+
if (id_conf > 0) {
|
|
1671
|
+
query += "and d.id in (select id_part from change_config where id_conf = :id_conf)";
|
|
1672
|
+
}
|
|
1673
|
+
else {
|
|
1674
|
+
query += "and d.id in (select id_part from change_config where id_device = :id_device and part_type = 'PC' order by id desc LIMIT 1)"
|
|
1675
|
+
}
|
|
1676
|
+
return query;
|
|
1677
|
+
}
|
|
1678
|
+
function getPCPropertiesByConfig(db_used, id_device, id_conf) {
|
|
1679
|
+
var query = "";
|
|
1680
|
+
if (db_used) {
|
|
1681
|
+
switch (db_used) {
|
|
1682
|
+
case 'SQLITE':
|
|
1683
|
+
query = getPCPropertiesByConfigSQLite(id_device, id_conf);
|
|
1684
|
+
break;
|
|
1685
|
+
case 'MYSQL':
|
|
1686
|
+
query = getPCPropertiesByConfigMySQL(id_device, id_conf);
|
|
1687
|
+
break;
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
return query;
|
|
1691
|
+
}
|
|
1611
1692
|
//End Manage PC Properties
|
|
1612
1693
|
// Manage Display Part Properties
|
|
1613
1694
|
function getDisplayPartPropertiesSQLite(id_device) {
|
|
@@ -8780,6 +8861,7 @@ module.exports = {
|
|
|
8780
8861
|
createPCPropertiesMySQLObj,
|
|
8781
8862
|
insertPCProperties,
|
|
8782
8863
|
updatePCProperties,
|
|
8864
|
+
getPCPropertiesByConfig,
|
|
8783
8865
|
existsDisplayProperties,
|
|
8784
8866
|
getDisplayProperties,
|
|
8785
8867
|
createDisplayPropertiesMySQLObj,
|