alsmanager_lib 1.0.77 → 1.0.79
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 +269 -10
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -183,6 +183,74 @@ function getStorageByIdDevice(db_used, id_device) {
|
|
|
183
183
|
return query;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
|
|
187
|
+
function getStorageComboByIdDeviceSQLite(id_device, id_exclude) {
|
|
188
|
+
var query = "select ds.id, concat(st.name, ' - ', ds.storage_manifacturer, ' - ', ds.storage_model) as descrizione from device_storages ds ";
|
|
189
|
+
query += "join storage_types st on st.id = ds.storage_type ";
|
|
190
|
+
query += "where id_device = " + id_device;
|
|
191
|
+
if (id_exclude && id_exclude > 0) {
|
|
192
|
+
query += "and ds.id <> " + id_exclude;
|
|
193
|
+
}
|
|
194
|
+
return query;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function getStorageComboByIdDeviceMySQL(id_device, id_exclude) {
|
|
198
|
+
var query = "select ds.id, concat(st.name, ' - ', ds.storage_manifacturer, ' - ', ds.storage_model) as descrizione from device_storages ds ";
|
|
199
|
+
query += "join storage_types st on st.id = ds.storage_type ";
|
|
200
|
+
query += "where id_device = :id_device";
|
|
201
|
+
if (id_exclude && id_exclude > 0) {
|
|
202
|
+
query += "and ds.id <> :id_exclude";
|
|
203
|
+
}
|
|
204
|
+
return query;
|
|
205
|
+
}
|
|
206
|
+
function getStorageComboByIdDevice(db_used, id_device, id_exclude) {
|
|
207
|
+
var query = "";
|
|
208
|
+
if (db_used) {
|
|
209
|
+
switch (db_used) {
|
|
210
|
+
case 'SQLITE':
|
|
211
|
+
query = getStorageComboByIdDeviceSQLite(id_device, id_exclude);
|
|
212
|
+
break;
|
|
213
|
+
case 'MYSQL':
|
|
214
|
+
query = getStorageComboByIdDeviceMySQL(id_device, id_exclude);
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return query;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
function getStorageByIdPartAndIdConfSQLite(id_storage, id_conf) {
|
|
223
|
+
var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
|
|
224
|
+
query += "where part_type = 'STORAGE' ";
|
|
225
|
+
query += "and id_conf = " + id_conf + " ";
|
|
226
|
+
query += "and id_storage = " + id_storage;
|
|
227
|
+
return query;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function getStorageByIdPartAndIdConfMySQL(id_storage, id_conf) {
|
|
231
|
+
var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
|
|
232
|
+
query += "where part_type = 'STORAGE' ";
|
|
233
|
+
query += "and id_conf = :id_conf ";
|
|
234
|
+
query += "and id_storage = :id_storage";
|
|
235
|
+
return query;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function getStorageByIdPartAndIdConf(db_used, id_storage, id_conf) {
|
|
239
|
+
var query = "";
|
|
240
|
+
if (db_used) {
|
|
241
|
+
switch (db_used) {
|
|
242
|
+
case 'SQLITE':
|
|
243
|
+
query = getStorageByIdPartAndIdConfSQLite(id_storage, id_conf);
|
|
244
|
+
break;
|
|
245
|
+
case 'MYSQL':
|
|
246
|
+
query = getStorageByIdPartAndIdConfMySQL(id_storage, id_conf);
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
return query;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
|
|
186
254
|
function getStorageByIdSQLite(id_storage) {
|
|
187
255
|
var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_available, storage_manifacturer, storage_model from device_storages ";
|
|
188
256
|
query += "where id = " + id_storage;
|
|
@@ -379,6 +447,69 @@ function getNetworkByIdDevice(db_used, id_device) {
|
|
|
379
447
|
return query;
|
|
380
448
|
}
|
|
381
449
|
|
|
450
|
+
function getNetworkComboByIdDeviceSQLite(id_device, id_exclude) {
|
|
451
|
+
var query = "select dn.id, concat(dn.net_type , ' - ', dn.mac_address, ' - ', dn.ipv4_static, ' - ', dn.ipv6_static) as descrizione from device_networks dn ";
|
|
452
|
+
query += "where dn.id_device = " + id_device + " ";
|
|
453
|
+
if (id_exclude && id_exclude > 0) {
|
|
454
|
+
query += "and dn.id <> " + id_exclude;
|
|
455
|
+
}
|
|
456
|
+
return query;
|
|
457
|
+
}
|
|
458
|
+
function getNetworkComboByIdDeviceMySQL(id_device, id_exclude) {
|
|
459
|
+
var query = "select dn.id, concat(dn.net_type , ' - ', dn.mac_address, ' - ', dn.ipv4_static, ' - ', dn.ipv6_static) as descrizione from device_networks dn ";
|
|
460
|
+
query += "where dn.id_device = :id_device ";
|
|
461
|
+
if (id_exclude && id_exclude > 0) {
|
|
462
|
+
query += "and dn.id <> :id_exclude";
|
|
463
|
+
}
|
|
464
|
+
return query;
|
|
465
|
+
}
|
|
466
|
+
function getNetworkComboByIdDevice(db_used, id_device, id_exclude) {
|
|
467
|
+
var query = "";
|
|
468
|
+
if (db_used) {
|
|
469
|
+
switch (db_used) {
|
|
470
|
+
case 'SQLITE':
|
|
471
|
+
query = getNetworkComboByIdDeviceSQLite(id_device, id_exclude);
|
|
472
|
+
break;
|
|
473
|
+
case 'MYSQL':
|
|
474
|
+
query = getNetworkComboByIdDeviceMySQL(id_device, id_exclude);
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
return query;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
function getNetworkByIdPartAndIdConfSQLite(id_network, id_conf) {
|
|
482
|
+
var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
|
|
483
|
+
query += "where part_type = 'NETWORK' ";
|
|
484
|
+
query += "and id_conf = " + id_conf + " ";
|
|
485
|
+
query += "and id_storage = " + id_network;
|
|
486
|
+
return query;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function getNetworkByIdPartAndIdConfMySQL(id_network, id_conf) {
|
|
490
|
+
var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
|
|
491
|
+
query += "where part_type = 'NETWORK' ";
|
|
492
|
+
query += "and id_conf = :id_conf ";
|
|
493
|
+
query += "and id_storage = :id_network";
|
|
494
|
+
return query;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
function getNetworkByIdPartAndIdConf(db_used, id_network, id_conf) {
|
|
498
|
+
var query = "";
|
|
499
|
+
if (db_used) {
|
|
500
|
+
switch (db_used) {
|
|
501
|
+
case 'SQLITE':
|
|
502
|
+
query = getNetworkByIdPartAndIdConfSQLite(id_network, id_conf);
|
|
503
|
+
break;
|
|
504
|
+
case 'MYSQL':
|
|
505
|
+
query = getNetworkByIdPartAndIdConfMySQL(id_network, id_conf);
|
|
506
|
+
break;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return query;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
|
|
382
513
|
function getNetworkByIdSQLite(id_network) {
|
|
383
514
|
var query = "select id, id_device, net_type, mac_address, ipv4_static, ipv6_static from device_networks ";
|
|
384
515
|
query += "where id = " + id_network;
|
|
@@ -528,6 +659,32 @@ function getNetworksByConfig(db_used, id_device, id_conf) {
|
|
|
528
659
|
}
|
|
529
660
|
//End Manage Network
|
|
530
661
|
// Manage AddOns
|
|
662
|
+
//get addon types
|
|
663
|
+
function getAddOnTypesSQLite() {
|
|
664
|
+
var query = "select id, name, description from addon_types";
|
|
665
|
+
return query;
|
|
666
|
+
}
|
|
667
|
+
function getAddOnTypesMySQL() {
|
|
668
|
+
var query = "select id, name, description from addon_types";
|
|
669
|
+
return query;
|
|
670
|
+
}
|
|
671
|
+
function getAddOnTypes(db_used) {
|
|
672
|
+
var query = "";
|
|
673
|
+
if (db_used) {
|
|
674
|
+
switch (db_used) {
|
|
675
|
+
case 'SQLITE':
|
|
676
|
+
query = getAddOnTypesSQLite();
|
|
677
|
+
break;
|
|
678
|
+
case 'MYSQL':
|
|
679
|
+
query = getAddOnTypesMySQL();
|
|
680
|
+
break;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return query;
|
|
684
|
+
}
|
|
685
|
+
//end get addon types
|
|
686
|
+
|
|
687
|
+
|
|
531
688
|
function getAddOnByIdDeviceSQLite(id_device) {
|
|
532
689
|
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 ";
|
|
533
690
|
query += "join addon_types a on a.id = da.addon_type ";
|
|
@@ -554,6 +711,71 @@ function getAddOnByIdDevice(db_used, id_device) {
|
|
|
554
711
|
}
|
|
555
712
|
return query;
|
|
556
713
|
}
|
|
714
|
+
|
|
715
|
+
function getAddOnComboByIdDeviceSQLite(id_device, id_exclude) {
|
|
716
|
+
var query = "select da.id, concat(a.name, ' - ', da.maker, ' - ', da.model) as descrizione from device_addons da ";
|
|
717
|
+
query += "join addon_types a on a.id = da.addon_type ";
|
|
718
|
+
query += "where da.id_device = " + id_device + " ";
|
|
719
|
+
if (id_exclude && id_exclude > 0) {
|
|
720
|
+
query += "and da.id <> " + id_exclude;
|
|
721
|
+
}
|
|
722
|
+
return query;
|
|
723
|
+
}
|
|
724
|
+
function getAddOnComboByIdDeviceMySQL(id_device, id_exclude) {
|
|
725
|
+
var query = "select da.id, concat(a.name, ' - ', da.maker, ' - ', da.model) as descrizione from device_addons da ";
|
|
726
|
+
query += "join addon_types a on a.id = da.addon_type ";
|
|
727
|
+
query += "where da.id_device = :id_device ";
|
|
728
|
+
if (id_exclude && id_exclude > 0) {
|
|
729
|
+
query += "and da.id <> :id_exclude";
|
|
730
|
+
}
|
|
731
|
+
return query;
|
|
732
|
+
}
|
|
733
|
+
function getAddOnComboByIdDevice(db_used, id_device, id_exclude) {
|
|
734
|
+
var query = "";
|
|
735
|
+
if (db_used) {
|
|
736
|
+
switch (db_used) {
|
|
737
|
+
case 'SQLITE':
|
|
738
|
+
query = getAddOnComboByIdDeviceSQLite(id_device, id_exclude);
|
|
739
|
+
break;
|
|
740
|
+
case 'MYSQL':
|
|
741
|
+
query = getAddOnComboByIdDeviceMySQL(id_device, id_exclude);
|
|
742
|
+
break;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
return query;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
function getAddOnByIdPartAndIdConfSQLite(id_addon, id_conf) {
|
|
749
|
+
var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
|
|
750
|
+
query += "where part_type = 'ADDON' ";
|
|
751
|
+
query += "and id_conf = " + id_conf + " ";
|
|
752
|
+
query += "and id_storage = " + id_addon;
|
|
753
|
+
return query;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
function getAddOnByIdPartAndIdConfMySQL(id_addon, id_conf) {
|
|
757
|
+
var query = "select id, id_conf, part_type, id_part, operation, id_part_replaced from change_config ";
|
|
758
|
+
query += "where part_type = 'ADDON' ";
|
|
759
|
+
query += "and id_conf = :id_conf ";
|
|
760
|
+
query += "and id_storage = :id_addon";
|
|
761
|
+
return query;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
function getAddOnByIdPartAndIdConf(db_used, id_addon, id_conf) {
|
|
765
|
+
var query = "";
|
|
766
|
+
if (db_used) {
|
|
767
|
+
switch (db_used) {
|
|
768
|
+
case 'SQLITE':
|
|
769
|
+
query = getAddOnByIdPartAndIdConfSQLite(id_addon, id_conf);
|
|
770
|
+
break;
|
|
771
|
+
case 'MYSQL':
|
|
772
|
+
query = getAddOnByIdPartAndIdConfMySQL(id_addon, id_conf);
|
|
773
|
+
break;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
return query;
|
|
777
|
+
}
|
|
778
|
+
|
|
557
779
|
function getAddOnByIdSQLite(id_addon) {
|
|
558
780
|
var query = "select id, id_device, addon_type, maker, model, description from device_addons ";
|
|
559
781
|
query += "where id = " + id_addon;
|
|
@@ -655,7 +877,7 @@ function removeAddOnSQLite(id_device, addon_obj) {
|
|
|
655
877
|
}
|
|
656
878
|
function removeAddOnMySQL(id_device, addon_obj) {
|
|
657
879
|
var query = "delete from device_addons ";
|
|
658
|
-
query += "where id = id_addon";
|
|
880
|
+
query += "where id = :id_addon";
|
|
659
881
|
}
|
|
660
882
|
|
|
661
883
|
function removeAddOn(db_used, id_device, addon_obj) {
|
|
@@ -890,35 +1112,63 @@ function insertPartChanged(db_used, id_conf, part_type, id_part, operation, id_p
|
|
|
890
1112
|
return query;
|
|
891
1113
|
}
|
|
892
1114
|
|
|
893
|
-
function updatePartChangedSQLite(id_change,
|
|
1115
|
+
function updatePartChangedSQLite(id_change, operation, id_part_replaced) {
|
|
894
1116
|
var query = "update change_config set ";
|
|
895
|
-
query += "id_conf = " + id_conf + ", ";
|
|
896
|
-
query += "part_type = '" + part_type + "', ";
|
|
897
|
-
query += "id_part = " + id_part + ", ";
|
|
898
1117
|
query += "operation = '" + operation + "', ";
|
|
899
|
-
query += "id_part_replaced =
|
|
1118
|
+
query += "id_part_replaced = " + id_part_replaced + " ";
|
|
900
1119
|
query += "where id = " + id_change;
|
|
901
1120
|
return query;
|
|
902
1121
|
}
|
|
903
1122
|
|
|
904
|
-
function updatePartChangedMySQL(id_change,
|
|
1123
|
+
function updatePartChangedMySQL(id_change, operation, id_part_replaced) {
|
|
1124
|
+
var query = "update change_config set ";
|
|
1125
|
+
query += "operation = :operation, ";
|
|
1126
|
+
query += "id_part_replaced = :id_part_replaced ";
|
|
1127
|
+
query += "where id = :id_change";
|
|
1128
|
+
return query;
|
|
905
1129
|
}
|
|
906
1130
|
|
|
907
|
-
function updatePartChanged(db_used, id_change,
|
|
1131
|
+
function updatePartChanged(db_used, id_change, operation, id_part_replaced) {
|
|
908
1132
|
var query = "";
|
|
909
1133
|
if (db_used) {
|
|
910
1134
|
switch (db_used) {
|
|
911
1135
|
case 'SQLITE':
|
|
912
|
-
query = updatePartChangedSQLite(id_change,
|
|
1136
|
+
query = updatePartChangedSQLite(id_change, operation, id_part_replaced);
|
|
913
1137
|
break;
|
|
914
1138
|
case 'MYSQL':
|
|
915
|
-
query = updatePartChangedMySQL(id_change,
|
|
1139
|
+
query = updatePartChangedMySQL(id_change, operation, id_part_replaced);
|
|
916
1140
|
break;
|
|
917
1141
|
}
|
|
918
1142
|
}
|
|
919
1143
|
return query;
|
|
920
1144
|
}
|
|
921
1145
|
|
|
1146
|
+
function removePartChangedSQLite(id_change, id_conf) {
|
|
1147
|
+
var query = "delete from change_config ";
|
|
1148
|
+
query += "where id = " + id_change + " and id_conf = " + id_conf;
|
|
1149
|
+
return query;
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
function removePartChangedMySQL(id_change, id_conf) {
|
|
1153
|
+
var query = "delete from change_config ";
|
|
1154
|
+
query += "where id = :id_change and id_conf = :id_conf";
|
|
1155
|
+
return query;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
function removePartChanged(db_used, id_change, id_conf) {
|
|
1159
|
+
var query = "";
|
|
1160
|
+
if (db_used) {
|
|
1161
|
+
switch (db_used) {
|
|
1162
|
+
case 'SQLITE':
|
|
1163
|
+
query = removePartChangedSQLite(id_change, id_conf);
|
|
1164
|
+
break;
|
|
1165
|
+
case 'MYSQL':
|
|
1166
|
+
query = removePartChangedMySQL(id_change, id_conf);
|
|
1167
|
+
break;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
return query;
|
|
1171
|
+
}
|
|
922
1172
|
|
|
923
1173
|
//End Device configurations
|
|
924
1174
|
|
|
@@ -8234,6 +8484,7 @@ module.exports = {
|
|
|
8234
8484
|
existsDisplayPartProperties,
|
|
8235
8485
|
insertDisplayPartProperties,
|
|
8236
8486
|
updateDisplayPartProperties,
|
|
8487
|
+
//
|
|
8237
8488
|
getConnectorsByIdDevice,
|
|
8238
8489
|
getConnectorById,
|
|
8239
8490
|
createConnectorObjMySQL,
|
|
@@ -8241,6 +8492,8 @@ module.exports = {
|
|
|
8241
8492
|
updateConnector,
|
|
8242
8493
|
removeConnector,
|
|
8243
8494
|
getStorageByIdDevice,
|
|
8495
|
+
getStorageComboByIdDevice,
|
|
8496
|
+
getStorageByIdPartAndIdConf,
|
|
8244
8497
|
getStorageById,
|
|
8245
8498
|
createStorageObjMySQL,
|
|
8246
8499
|
insertStorage,
|
|
@@ -8248,13 +8501,18 @@ module.exports = {
|
|
|
8248
8501
|
removeStorage,
|
|
8249
8502
|
getStoragesByConfig,
|
|
8250
8503
|
getNetworkByIdDevice,
|
|
8504
|
+
getNetworkComboByIdDevice,
|
|
8505
|
+
getNetworkByIdPartAndIdConf,
|
|
8251
8506
|
getNetworkById,
|
|
8252
8507
|
createNetworkObjMySQL,
|
|
8253
8508
|
insertNetwork,
|
|
8254
8509
|
updateNetwork,
|
|
8255
8510
|
removeNetwork,
|
|
8256
8511
|
getNetworksByConfig,
|
|
8512
|
+
getAddOnTypes,
|
|
8257
8513
|
getAddOnByIdDevice,
|
|
8514
|
+
getAddOnComboByIdDevice,
|
|
8515
|
+
getAddOnByIdPartAndIdConf,
|
|
8258
8516
|
getAddOnById,
|
|
8259
8517
|
createAddOnObjMySQL,
|
|
8260
8518
|
insertAddOn,
|
|
@@ -8270,6 +8528,7 @@ module.exports = {
|
|
|
8270
8528
|
removeDeviceConfiguration,
|
|
8271
8529
|
insertPartChanged,
|
|
8272
8530
|
updatePartChanged,
|
|
8531
|
+
removePartChanged,
|
|
8273
8532
|
//
|
|
8274
8533
|
selectBeneDaInventario,
|
|
8275
8534
|
getDevicesSelectForInventarioRaw,
|