alsmanager_lib 1.0.84 → 1.0.86
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 +96 -5
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -381,6 +381,33 @@ function removeStorage(db_used, id_device, storage_obj) {
|
|
|
381
381
|
}
|
|
382
382
|
return query;
|
|
383
383
|
}
|
|
384
|
+
|
|
385
|
+
function getLastStorageInsertedSQLite(id_device) {
|
|
386
|
+
var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_manifacturer, storage_model from device_storages ";
|
|
387
|
+
query += "where id_device = " + id_device + " ";
|
|
388
|
+
query += "order by id desc LIMIT 1";
|
|
389
|
+
return query;
|
|
390
|
+
}
|
|
391
|
+
function getLastStorageInsertedMySQL(id_device) {
|
|
392
|
+
var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_manifacturer, storage_model from device_storages ";
|
|
393
|
+
query += "where id_device = :id_device ";
|
|
394
|
+
query += "order by id desc LIMIT 1";
|
|
395
|
+
return query;
|
|
396
|
+
}
|
|
397
|
+
function getLastStorageInserted(db_used, id_device) {
|
|
398
|
+
var query = "";
|
|
399
|
+
if (db_used) {
|
|
400
|
+
switch (db_used) {
|
|
401
|
+
case 'SQLITE':
|
|
402
|
+
query = getLastStorageInsertedSQLite(id_device);
|
|
403
|
+
break;
|
|
404
|
+
case 'MYSQL':
|
|
405
|
+
query = getLastStorageInsertedMySQL(id_device);
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return query;
|
|
410
|
+
}
|
|
384
411
|
//
|
|
385
412
|
function getStoragesByConfigSQLite(id_device, id_conf) {
|
|
386
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 ";
|
|
@@ -621,6 +648,33 @@ function removeNetwork(db_used, id_device, network_obj) {
|
|
|
621
648
|
}
|
|
622
649
|
return query;
|
|
623
650
|
}
|
|
651
|
+
|
|
652
|
+
function getLastNetworkInsertedSQLite(id_device) {
|
|
653
|
+
var query = "select id, id_device, net_type, mac_address, ipv4_static, ipv6_static from device_networks ";
|
|
654
|
+
query += "where id_device = " + id_device + " ";
|
|
655
|
+
query += "order by id desc LIMIT 1";
|
|
656
|
+
return query;
|
|
657
|
+
}
|
|
658
|
+
function getLastNetworkInsertedMySQL(id_device) {
|
|
659
|
+
var query = "select id, id_device, net_type, mac_address, ipv4_static, ipv6_static from device_networks ";
|
|
660
|
+
query += "where id_device = :id_device ";
|
|
661
|
+
query += "order by id desc LIMIT 1";
|
|
662
|
+
return query;
|
|
663
|
+
}
|
|
664
|
+
function getLastNetworkInserted(db_used, id_device) {
|
|
665
|
+
var query = "";
|
|
666
|
+
if (db_used) {
|
|
667
|
+
switch (db_used) {
|
|
668
|
+
case 'SQLITE':
|
|
669
|
+
query = getLastNetworkInsertedSQLite(id_device);
|
|
670
|
+
break;
|
|
671
|
+
case 'MYSQL':
|
|
672
|
+
query = getLastNetworkInsertedMySQL(id_device);
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
return query;
|
|
677
|
+
}
|
|
624
678
|
//
|
|
625
679
|
function getNetworksByConfigSQLite(id_device, id_conf) {
|
|
626
680
|
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 ";
|
|
@@ -885,6 +939,33 @@ function removeAddOn(db_used, id_device, addon_obj) {
|
|
|
885
939
|
}
|
|
886
940
|
return query;
|
|
887
941
|
}
|
|
942
|
+
|
|
943
|
+
function getLastAddOnInsertedSQLite(id_device) {
|
|
944
|
+
var query = "select id, id_device, addon_type, maker, model, description from device_addons ";
|
|
945
|
+
query += "where id_device = " + id_device + " ";
|
|
946
|
+
query += "order by id desc LIMIT 1";
|
|
947
|
+
return query;
|
|
948
|
+
}
|
|
949
|
+
function getLastAddOnInsertedMySQL(id_device) {
|
|
950
|
+
var query = "select id, id_device, addon_type, maker, model, description from device_addons ";
|
|
951
|
+
query += "where id_device = :id_device ";
|
|
952
|
+
query += "order by id desc LIMIT 1";
|
|
953
|
+
return query;
|
|
954
|
+
}
|
|
955
|
+
function getLastAddOnInserted(db_used, id_device) {
|
|
956
|
+
var query = "";
|
|
957
|
+
if (db_used) {
|
|
958
|
+
switch (db_used) {
|
|
959
|
+
case 'SQLITE':
|
|
960
|
+
query = getLastAddOnInsertedSQLite(id_device);
|
|
961
|
+
break;
|
|
962
|
+
case 'MYSQL':
|
|
963
|
+
query = getLastAddOnInsertedMySQL(id_device);
|
|
964
|
+
break;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
return query;
|
|
968
|
+
}
|
|
888
969
|
//
|
|
889
970
|
function getAddOnsByConfigSQLite(id_device, id_conf) {
|
|
890
971
|
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 ";
|
|
@@ -1075,7 +1156,7 @@ function removeDeviceConfiguration(db_used, id_conf) {
|
|
|
1075
1156
|
return query;
|
|
1076
1157
|
}
|
|
1077
1158
|
//
|
|
1078
|
-
function insertPartChangedSQLite(id_conf,
|
|
1159
|
+
function insertPartChangedSQLite(id_conf, id_part, part_type, operation, id_part_replaced) {
|
|
1079
1160
|
var query = "insert into change_config (id_conf, part_type, id_part, operation, id_part_replaced) values (";
|
|
1080
1161
|
query += id_conf + ", ";
|
|
1081
1162
|
query += "'" + part_type + "', ";
|
|
@@ -1086,17 +1167,24 @@ function insertPartChangedSQLite(id_conf, part_type, id_part, operation, id_part
|
|
|
1086
1167
|
return query;
|
|
1087
1168
|
}
|
|
1088
1169
|
function insertPartChangedMySQL() {
|
|
1089
|
-
|
|
1170
|
+
var query = "insert into change_config (id_conf, part_type, id_part, operation, id_part_replaced) values (";
|
|
1171
|
+
query += ":id_conf, ";
|
|
1172
|
+
query += ":part_type, ";
|
|
1173
|
+
query += ":id_part, ";
|
|
1174
|
+
query += ":operation, ";
|
|
1175
|
+
query += ":id_part_replaced";
|
|
1176
|
+
query += ")";
|
|
1177
|
+
return query;
|
|
1090
1178
|
}
|
|
1091
|
-
function insertPartChanged(db_used, id_conf,
|
|
1179
|
+
function insertPartChanged(db_used, id_conf, id_part, part_type, operation, id_part_replaced) {
|
|
1092
1180
|
var query = "";
|
|
1093
1181
|
if (db_used) {
|
|
1094
1182
|
switch (db_used) {
|
|
1095
1183
|
case 'SQLITE':
|
|
1096
|
-
query = insertPartChangedSQLite(id_conf,
|
|
1184
|
+
query = insertPartChangedSQLite(id_conf, id_part, part_type, operation, id_part_replaced);
|
|
1097
1185
|
break;
|
|
1098
1186
|
case 'MYSQL':
|
|
1099
|
-
query = insertPartChangedMySQL(id_conf,
|
|
1187
|
+
query = insertPartChangedMySQL(id_conf, id_part, part_type, operation, id_part_replaced);
|
|
1100
1188
|
break;
|
|
1101
1189
|
}
|
|
1102
1190
|
}
|
|
@@ -8716,6 +8804,7 @@ module.exports = {
|
|
|
8716
8804
|
insertStorage,
|
|
8717
8805
|
updateStorage,
|
|
8718
8806
|
removeStorage,
|
|
8807
|
+
getLastStorageInserted,
|
|
8719
8808
|
getStoragesByConfig,
|
|
8720
8809
|
getNetworkByIdDevice,
|
|
8721
8810
|
getNetworkComboByIdDevice,
|
|
@@ -8725,6 +8814,7 @@ module.exports = {
|
|
|
8725
8814
|
insertNetwork,
|
|
8726
8815
|
updateNetwork,
|
|
8727
8816
|
removeNetwork,
|
|
8817
|
+
getLastNetworkInserted,
|
|
8728
8818
|
getNetworksByConfig,
|
|
8729
8819
|
getAddOnTypes,
|
|
8730
8820
|
getAddOnByIdDevice,
|
|
@@ -8735,6 +8825,7 @@ module.exports = {
|
|
|
8735
8825
|
insertAddOn,
|
|
8736
8826
|
updateAddOn,
|
|
8737
8827
|
removeAddOn,
|
|
8828
|
+
getLastAddOnInserted,
|
|
8738
8829
|
getAddOnsByConfig,
|
|
8739
8830
|
//
|
|
8740
8831
|
getDeviceConfigurations,
|