alsmanager_lib 1.0.72 → 1.0.75
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 +229 -36
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -156,14 +156,14 @@ function removeConnector(db_used, id_device, conn_obj) {
|
|
|
156
156
|
//End Manage connectors
|
|
157
157
|
// Manage Storage
|
|
158
158
|
function getStorageByIdDeviceSQLite(id_device) {
|
|
159
|
-
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile from device_storages ds ";
|
|
159
|
+
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
|
|
160
160
|
query += "join storage_types st on st.id = ds.storage_type ";
|
|
161
161
|
query += "where id_device = " + id_device;
|
|
162
162
|
return query;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
function getStorageByIdDeviceMySQL(id_device) {
|
|
166
|
-
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile from device_storages ds ";
|
|
166
|
+
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
|
|
167
167
|
query += "join storage_types st on st.id = ds.storage_type ";
|
|
168
168
|
query += "where id_device = :id_device";
|
|
169
169
|
return query;
|
|
@@ -184,13 +184,13 @@ function getStorageByIdDevice(db_used, id_device) {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
function getStorageByIdSQLite(id_storage) {
|
|
187
|
-
var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_available from device_storages ";
|
|
187
|
+
var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_available, storage_manifacturer, storage_model from device_storages ";
|
|
188
188
|
query += "where id = " + id_storage;
|
|
189
189
|
return query;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
function getStorageByIdMySQL() {
|
|
193
|
-
var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_available from device_storages ";
|
|
193
|
+
var query = "select id, id_device, storage_type, storage_size_unit, storage_totsize, storage_available, storage_manifacturer, storage_model from device_storages ";
|
|
194
194
|
query += "where id = :id_storage";
|
|
195
195
|
return query;
|
|
196
196
|
}
|
|
@@ -322,6 +322,35 @@ function removeStorage(db_used, id_device, storage_obj) {
|
|
|
322
322
|
}
|
|
323
323
|
return query;
|
|
324
324
|
}
|
|
325
|
+
//
|
|
326
|
+
function getStoragesByConfigSQLite(id_device, id_conf) {
|
|
327
|
+
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
|
|
328
|
+
query += "join storage_types st on st.id = ds.storage_type ";
|
|
329
|
+
query += "where id_device = " + id_device + " ";
|
|
330
|
+
query += "and ds.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
331
|
+
return query;
|
|
332
|
+
}
|
|
333
|
+
function getStoragesByConfigMySQL(id_device, id_conf) {
|
|
334
|
+
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
|
|
335
|
+
query += "join storage_types st on st.id = ds.storage_type ";
|
|
336
|
+
query += "where id_device = " + id_device + " ";
|
|
337
|
+
query += "and ds.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
338
|
+
return query;
|
|
339
|
+
}
|
|
340
|
+
function getStoragesByConfig(db_used, id_device, id_conf) {
|
|
341
|
+
var query = "";
|
|
342
|
+
if (db_used) {
|
|
343
|
+
switch (db_used) {
|
|
344
|
+
case 'SQLITE':
|
|
345
|
+
query = getStoragesByConfigSQLite(id_device, id_conf);
|
|
346
|
+
break;
|
|
347
|
+
case 'MYSQL':
|
|
348
|
+
query = getStoragesByConfigMySQL(id_device, id_conf);
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
return query;
|
|
353
|
+
}
|
|
325
354
|
|
|
326
355
|
//End Manage Storage
|
|
327
356
|
// Manage Network
|
|
@@ -470,6 +499,35 @@ function removeNetwork(db_used, id_device, network_obj) {
|
|
|
470
499
|
}
|
|
471
500
|
return query;
|
|
472
501
|
}
|
|
502
|
+
//
|
|
503
|
+
function getNetworksByConfigSQLite(id_device, id_conf) {
|
|
504
|
+
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
|
|
505
|
+
query += "join storage_types st on st.id = ds.storage_type ";
|
|
506
|
+
query += "where id_device = " + id_device + " ";
|
|
507
|
+
query += "and ds.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
508
|
+
return query;
|
|
509
|
+
}
|
|
510
|
+
function getNetworksByConfigMySQL(id_device, id_conf) {
|
|
511
|
+
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
|
|
512
|
+
query += "join storage_types st on st.id = ds.storage_type ";
|
|
513
|
+
query += "where id_device = " + id_device + " ";
|
|
514
|
+
query += "and ds.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
515
|
+
return query;
|
|
516
|
+
}
|
|
517
|
+
function getNetworksByConfig(db_used, id_device, id_conf) {
|
|
518
|
+
var query = "";
|
|
519
|
+
if (db_used) {
|
|
520
|
+
switch (db_used) {
|
|
521
|
+
case 'SQLITE':
|
|
522
|
+
query = getNetworksByConfigSQLite(id_device, id_conf);
|
|
523
|
+
break;
|
|
524
|
+
case 'MYSQL':
|
|
525
|
+
query = getNetworksByConfigMySQL(id_device, id_conf);
|
|
526
|
+
break;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return query;
|
|
530
|
+
}
|
|
473
531
|
//End Manage Network
|
|
474
532
|
// Manage AddOns
|
|
475
533
|
function getAddOnByIdDeviceSQLite(id_device) {
|
|
@@ -616,82 +674,209 @@ function removeAddOn(db_used, id_device, addon_obj) {
|
|
|
616
674
|
}
|
|
617
675
|
return query;
|
|
618
676
|
}
|
|
677
|
+
//
|
|
678
|
+
function getAddonsByConfigSQLite(id_device, id_conf) {
|
|
679
|
+
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
|
|
680
|
+
query += "join storage_types st on st.id = ds.storage_type ";
|
|
681
|
+
query += "where id_device = " + id_device + " ";
|
|
682
|
+
query += "and ds.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
683
|
+
return query;
|
|
684
|
+
}
|
|
685
|
+
function getAddonsByConfigMySQL(id_device, id_conf) {
|
|
686
|
+
var query = "select ds.id, st.name as Tipo, ds.storage_size_unit as Unit, ds.storage_totsize as Dimensione, ds.storage_available as Disponibile, ds.storage_manifacturer as Marca, ds.storage_model as Modello from device_storages ds ";
|
|
687
|
+
query += "join storage_types st on st.id = ds.storage_type ";
|
|
688
|
+
query += "where id_device = " + id_device + " ";
|
|
689
|
+
query += "and ds.id in (select id_part from change_config where id_conf = " + id_conf + ")";
|
|
690
|
+
return query;
|
|
691
|
+
}
|
|
692
|
+
function getAddonsByConfig(db_used, id_device, id_conf) {
|
|
693
|
+
var query = "";
|
|
694
|
+
if (db_used) {
|
|
695
|
+
switch (db_used) {
|
|
696
|
+
case 'SQLITE':
|
|
697
|
+
query = getAddonsByConfigSQLite(id_device, id_conf);
|
|
698
|
+
break;
|
|
699
|
+
case 'MYSQL':
|
|
700
|
+
query = getAddonsByConfigMySQL(id_device, id_conf);
|
|
701
|
+
break;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
return query;
|
|
705
|
+
}
|
|
619
706
|
//End Manage AddOns
|
|
620
707
|
// Device configurations
|
|
621
|
-
function getDeviceConfigurationsSQLite(id_device
|
|
622
|
-
var query = "select id,
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
"id" INTEGER,
|
|
626
|
-
"id_device" INTEGER,
|
|
627
|
-
"date_conf" TEXT,
|
|
628
|
-
"id_storage" INTEGER,
|
|
629
|
-
"id_network" INTEGER,
|
|
630
|
-
"id_addon" INTEGER,
|
|
631
|
-
"note" TEXT,
|
|
632
|
-
PRIMARY KEY("id" AUTOINCREMENT)
|
|
633
|
-
)
|
|
634
|
-
*/
|
|
708
|
+
function getDeviceConfigurationsSQLite(id_device) {
|
|
709
|
+
var query = "select id, date_conf, note from device_changes ";
|
|
710
|
+
query += "where id_device = " + id_device;
|
|
711
|
+
return query;
|
|
635
712
|
}
|
|
636
|
-
function getDeviceConfigurationsMySQL(id_device
|
|
713
|
+
function getDeviceConfigurationsMySQL(id_device) {
|
|
714
|
+
var query = "select id, date_conf, note from device_changes ";
|
|
715
|
+
query += "where id_device = :id_device";
|
|
716
|
+
return query;
|
|
717
|
+
}
|
|
718
|
+
function getDeviceConfigurations(db_used, id_device) {
|
|
719
|
+
var query = "";
|
|
720
|
+
if (db_used) {
|
|
721
|
+
switch (db_used) {
|
|
722
|
+
case 'SQLITE':
|
|
723
|
+
query = getDeviceConfigurationsSQLite(id_device);
|
|
724
|
+
break;
|
|
725
|
+
case 'MYSQL':
|
|
726
|
+
query = getDeviceConfigurationsMySQL(id_device);
|
|
727
|
+
break;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
return query;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
function getDeviceConfigurationByIdSQLite(id_conf) {
|
|
735
|
+
var query = "select id, id_device, date_conf, note from device_changes ";
|
|
736
|
+
query += "where id = " + id_conf;
|
|
737
|
+
return query;
|
|
738
|
+
}
|
|
739
|
+
function getDeviceConfigurationByIdMySQL(id_conf) {
|
|
740
|
+
var query = "select id, id_device, date_conf, note from device_changes ";
|
|
741
|
+
query += "where id = " + id_conf;
|
|
742
|
+
return query;
|
|
743
|
+
}
|
|
744
|
+
function getDeviceConfigurationById(db_used, id_conf) {
|
|
745
|
+
var query = "";
|
|
746
|
+
if (db_used) {
|
|
747
|
+
switch (db_used) {
|
|
748
|
+
case 'SQLITE':
|
|
749
|
+
query = getDeviceConfigurationByIdSQLite(id_conf);
|
|
750
|
+
break;
|
|
751
|
+
case 'MYSQL':
|
|
752
|
+
query = getDeviceConfigurationByIdMySQL(id_conf);
|
|
753
|
+
break;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return query;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
function insertDeviceConfigurationSQLite(id_device, date_ref, note) {
|
|
760
|
+
|
|
761
|
+
}
|
|
762
|
+
function insertDeviceConfigurationMySQL(id_device, date_ref, note) {
|
|
637
763
|
|
|
638
764
|
}
|
|
639
|
-
function
|
|
765
|
+
function insertDeviceConfiguration(db_used, id_device, date_ref) {
|
|
640
766
|
var query = "";
|
|
641
767
|
if (db_used) {
|
|
642
768
|
switch (db_used) {
|
|
643
769
|
case 'SQLITE':
|
|
644
|
-
query =
|
|
770
|
+
query = insertDeviceConfigurationSQLite(id_device, date_ref);
|
|
645
771
|
break;
|
|
646
772
|
case 'MYSQL':
|
|
647
|
-
query =
|
|
773
|
+
query = insertDeviceConfigurationMySQL(id_device, date_ref);
|
|
648
774
|
break;
|
|
649
775
|
}
|
|
650
776
|
}
|
|
651
777
|
return query;
|
|
652
778
|
}
|
|
653
779
|
|
|
654
|
-
function
|
|
780
|
+
function updateDeviceConfigurationSQLite(id_device, date_ref, note) {
|
|
655
781
|
|
|
656
782
|
}
|
|
657
|
-
function
|
|
783
|
+
function updateDeviceConfigurationMySQL(id_device, date_ref, note) {
|
|
658
784
|
|
|
659
785
|
}
|
|
660
|
-
function
|
|
786
|
+
function updateDeviceConfiguration(db_used, id_conf, id_device, date_ref) {
|
|
661
787
|
var query = "";
|
|
662
788
|
if (db_used) {
|
|
663
789
|
switch (db_used) {
|
|
664
790
|
case 'SQLITE':
|
|
665
|
-
query =
|
|
791
|
+
query = updateDeviceConfigurationSQLite(id_conf, id_device, date_ref);
|
|
666
792
|
break;
|
|
667
793
|
case 'MYSQL':
|
|
668
|
-
query =
|
|
794
|
+
query = updateDeviceConfigurationMySQL(id_conf, id_device, date_ref);
|
|
669
795
|
break;
|
|
670
796
|
}
|
|
671
797
|
}
|
|
672
798
|
return query;
|
|
673
799
|
}
|
|
674
800
|
|
|
675
|
-
function
|
|
801
|
+
function removeDeviceConfigurationSQLite(id_conf, id_device, date_ref) {
|
|
676
802
|
|
|
677
803
|
}
|
|
678
|
-
function
|
|
804
|
+
function removeDeviceConfigurationMySQL(id_conf, id_device, date_ref) {
|
|
679
805
|
|
|
680
806
|
}
|
|
681
|
-
function
|
|
807
|
+
function removeDeviceConfiguration(db_used, id_conf, id_device, date_ref) {
|
|
682
808
|
var query = "";
|
|
683
809
|
if (db_used) {
|
|
684
810
|
switch (db_used) {
|
|
685
811
|
case 'SQLITE':
|
|
686
|
-
query =
|
|
812
|
+
query = removeDeviceConfigurationSQLite(id_conf, id_device, date_ref);
|
|
687
813
|
break;
|
|
688
814
|
case 'MYSQL':
|
|
689
|
-
query =
|
|
815
|
+
query = removeDeviceConfigurationMySQL(id_conf, id_device, date_ref);
|
|
690
816
|
break;
|
|
691
817
|
}
|
|
692
818
|
}
|
|
693
819
|
return query;
|
|
694
820
|
}
|
|
821
|
+
//
|
|
822
|
+
function insertPartChangedSQLite(id_conf, part_type, id_part, operation, id_part_replaced) {
|
|
823
|
+
var query = "insert into change_config (id_conf, part_type, id_part, operation, id_part_replaced) values (";
|
|
824
|
+
query += id_conf + ", ";
|
|
825
|
+
query += "'" + part_type + "', ";
|
|
826
|
+
query += id_part + ", ";
|
|
827
|
+
query += "'" + operation + "', ";
|
|
828
|
+
query += id_part_replaced;
|
|
829
|
+
query += ")";
|
|
830
|
+
return query;
|
|
831
|
+
}
|
|
832
|
+
function insertPartChangedMySQL() {
|
|
833
|
+
|
|
834
|
+
}
|
|
835
|
+
function insertPartChanged(db_used, id_conf, part_type, id_part, operation, id_part_replaced) {
|
|
836
|
+
var query = "";
|
|
837
|
+
if (db_used) {
|
|
838
|
+
switch (db_used) {
|
|
839
|
+
case 'SQLITE':
|
|
840
|
+
query = insertPartChangedSQLite(id_conf, part_type, id_part, operation, id_part_replaced);
|
|
841
|
+
break;
|
|
842
|
+
case 'MYSQL':
|
|
843
|
+
query = insertPartChangedMySQL(id_conf, part_type, id_part, operation, id_part_replaced);
|
|
844
|
+
break;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
return query;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
function updatePartChangedSQLite(id_change, id_conf, part_type, id_part, operation, id_part_replaced) {
|
|
851
|
+
var query = "update change_config set ";
|
|
852
|
+
query += "id_conf = " + id_conf + ", ";
|
|
853
|
+
query += "part_type = '" + part_type + "', ";
|
|
854
|
+
query += "id_part = " + id_part + ", ";
|
|
855
|
+
query += "operation = '" + operation + "', ";
|
|
856
|
+
query += "id_part_replaced = '" + id_part_replaced + "', ";
|
|
857
|
+
query += "where id = " + id_change;
|
|
858
|
+
return query;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
function updatePartChangedMySQL(id_change, id_conf, part_type, id_part, operation) {
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
function updatePartChanged(db_used, id_change, id_conf, part_type, id_part, operation, id_part_replaced) {
|
|
865
|
+
var query = "";
|
|
866
|
+
if (db_used) {
|
|
867
|
+
switch (db_used) {
|
|
868
|
+
case 'SQLITE':
|
|
869
|
+
query = updatePartChangedSQLite(id_change, id_conf, part_type, id_part, operation, id_part_replaced);
|
|
870
|
+
break;
|
|
871
|
+
case 'MYSQL':
|
|
872
|
+
query = updatePartChangedMySQL(id_change, id_conf, part_type, id_part, operation, id_part_replaced);
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
return query;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
|
|
695
880
|
//End Device configurations
|
|
696
881
|
|
|
697
882
|
//Manage PC Properties
|
|
@@ -7906,6 +8091,7 @@ function exportDBSQLSQLite(db_path, dump_path, dump_filename) {
|
|
|
7906
8091
|
fileName = dump_filename;
|
|
7907
8092
|
}
|
|
7908
8093
|
|
|
8094
|
+
|
|
7909
8095
|
var fileOut = path.join(dump_path, fileName);
|
|
7910
8096
|
|
|
7911
8097
|
let cmd = "sqlite3 " + db_path + " ";
|
|
@@ -7933,10 +8119,10 @@ function exportDBSQL(db_used, db_path, dump_path, dump_filename) {
|
|
|
7933
8119
|
if (db_used) {
|
|
7934
8120
|
switch (db_used) {
|
|
7935
8121
|
case 'SQLITE':
|
|
7936
|
-
query = exportDBSQLSQLite(db_path,
|
|
8122
|
+
query = exportDBSQLSQLite(db_path, dump_path, dump_filename);
|
|
7937
8123
|
break;
|
|
7938
8124
|
case 'MYSQL':
|
|
7939
|
-
query = exportDBSQLMySQL(db_path,
|
|
8125
|
+
query = exportDBSQLMySQL(db_path, dump_path, dump_filename);
|
|
7940
8126
|
break;
|
|
7941
8127
|
}
|
|
7942
8128
|
}
|
|
@@ -8017,22 +8203,29 @@ module.exports = {
|
|
|
8017
8203
|
insertStorage,
|
|
8018
8204
|
updateStorage,
|
|
8019
8205
|
removeStorage,
|
|
8206
|
+
getStoragesByConfig,
|
|
8020
8207
|
getNetworkByIdDevice,
|
|
8021
8208
|
getNetworkById,
|
|
8022
8209
|
createNetworkObjMySQL,
|
|
8023
8210
|
insertNetwork,
|
|
8024
8211
|
updateNetwork,
|
|
8025
8212
|
removeNetwork,
|
|
8213
|
+
getNetworksByConfig,
|
|
8026
8214
|
getAddOnByIdDevice,
|
|
8027
8215
|
getAddOnById,
|
|
8028
8216
|
createAddOnObjMySQL,
|
|
8029
8217
|
insertAddOn,
|
|
8030
8218
|
updateAddOn,
|
|
8031
8219
|
removeAddOn,
|
|
8220
|
+
getAddonsByConfig,
|
|
8032
8221
|
//
|
|
8033
8222
|
getDeviceConfigurations,
|
|
8034
|
-
|
|
8035
|
-
|
|
8223
|
+
getDeviceConfigurationById,
|
|
8224
|
+
insertDeviceConfiguration,
|
|
8225
|
+
updateDeviceConfiguration,
|
|
8226
|
+
removeDeviceConfiguration,
|
|
8227
|
+
insertPartChanged,
|
|
8228
|
+
updatePartChanged,
|
|
8036
8229
|
//
|
|
8037
8230
|
selectBeneDaInventario,
|
|
8038
8231
|
getDevicesSelectForInventarioRaw,
|