alsmanager_lib 1.0.74 → 1.0.76
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 +275 -37
- 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,254 @@ 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
|
-
|
|
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
|
+
query += "order by date_conf desc"
|
|
712
|
+
return query;
|
|
635
713
|
}
|
|
636
|
-
function getDeviceConfigurationsMySQL(id_device
|
|
637
|
-
|
|
714
|
+
function getDeviceConfigurationsMySQL(id_device) {
|
|
715
|
+
var query = "select id, date_conf, note from device_changes ";
|
|
716
|
+
query += "where id_device = :id_device ";
|
|
717
|
+
query += "order by date_conf desc"
|
|
718
|
+
return query;
|
|
719
|
+
}
|
|
720
|
+
function getDeviceConfigurations(db_used, id_device) {
|
|
721
|
+
var query = "";
|
|
722
|
+
if (db_used) {
|
|
723
|
+
switch (db_used) {
|
|
724
|
+
case 'SQLITE':
|
|
725
|
+
query = getDeviceConfigurationsSQLite(id_device);
|
|
726
|
+
break;
|
|
727
|
+
case 'MYSQL':
|
|
728
|
+
query = getDeviceConfigurationsMySQL(id_device);
|
|
729
|
+
break;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
return query;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
function getLastDeviceConfigurationSQLite(id_device) {
|
|
736
|
+
var query = "select id, date_conf, note from device_changes ";
|
|
737
|
+
query += "where id_device = " + id_device + " ";
|
|
738
|
+
query += "order by date_conf desc LIMIT 1";
|
|
739
|
+
return query;
|
|
740
|
+
}
|
|
741
|
+
function getLastDeviceConfigurationMySQL(id_device) {
|
|
742
|
+
var query = "select id, date_conf, note from device_changes ";
|
|
743
|
+
query += "where id_device = :id_device ";
|
|
744
|
+
query += "order by date_conf desc LIMIT 1";
|
|
745
|
+
return query;
|
|
638
746
|
}
|
|
639
|
-
function
|
|
747
|
+
function getLastDeviceConfiguration(db_used, id_device) {
|
|
640
748
|
var query = "";
|
|
641
749
|
if (db_used) {
|
|
642
750
|
switch (db_used) {
|
|
643
751
|
case 'SQLITE':
|
|
644
|
-
query =
|
|
752
|
+
query = getLastDeviceConfigurationSQLite(id_device);
|
|
645
753
|
break;
|
|
646
754
|
case 'MYSQL':
|
|
647
|
-
query =
|
|
755
|
+
query = getLastDeviceConfigurationMySQL(id_device);
|
|
648
756
|
break;
|
|
649
757
|
}
|
|
650
758
|
}
|
|
651
759
|
return query;
|
|
652
760
|
}
|
|
653
761
|
|
|
654
|
-
function setDeviceConfigurationsSQLite(id_device, date_ref) {
|
|
655
762
|
|
|
763
|
+
function getDeviceConfigurationByIdSQLite(id_conf) {
|
|
764
|
+
var query = "select id, id_device, date_conf, note from device_changes ";
|
|
765
|
+
query += "where id = " + id_conf;
|
|
766
|
+
return query;
|
|
656
767
|
}
|
|
657
|
-
function
|
|
658
|
-
|
|
768
|
+
function getDeviceConfigurationByIdMySQL(id_conf) {
|
|
769
|
+
var query = "select id, id_device, date_conf, note from device_changes ";
|
|
770
|
+
query += "where id = :id_conf";
|
|
771
|
+
return query;
|
|
659
772
|
}
|
|
660
|
-
function
|
|
773
|
+
function getDeviceConfigurationById(db_used, id_conf) {
|
|
661
774
|
var query = "";
|
|
662
775
|
if (db_used) {
|
|
663
776
|
switch (db_used) {
|
|
664
777
|
case 'SQLITE':
|
|
665
|
-
query =
|
|
778
|
+
query = getDeviceConfigurationByIdSQLite(id_conf);
|
|
666
779
|
break;
|
|
667
780
|
case 'MYSQL':
|
|
668
|
-
query =
|
|
781
|
+
query = getDeviceConfigurationByIdMySQL(id_conf);
|
|
669
782
|
break;
|
|
670
783
|
}
|
|
671
784
|
}
|
|
672
785
|
return query;
|
|
673
786
|
}
|
|
674
787
|
|
|
675
|
-
function
|
|
788
|
+
function insertDeviceConfigurationSQLite(id_device, data, note) {
|
|
789
|
+
var query = "insert into device_changes (id_device, date_conf, note) values (";
|
|
790
|
+
query += id_device + ", '" + data + "', '" + note + "')";
|
|
791
|
+
return query;
|
|
792
|
+
}
|
|
793
|
+
function insertDeviceConfigurationMySQL(id_device, data, note) {
|
|
794
|
+
var query = "insert into device_changes (id_device, date_conf, note) values (";
|
|
795
|
+
query += ":id_device, :data, :note)";
|
|
796
|
+
return query;
|
|
797
|
+
}
|
|
798
|
+
function insertDeviceConfiguration(db_used, id_device, data, note) {
|
|
799
|
+
var query = "";
|
|
800
|
+
if (db_used) {
|
|
801
|
+
switch (db_used) {
|
|
802
|
+
case 'SQLITE':
|
|
803
|
+
query = insertDeviceConfigurationSQLite(id_device, data, note);
|
|
804
|
+
break;
|
|
805
|
+
case 'MYSQL':
|
|
806
|
+
query = insertDeviceConfigurationMySQL(id_device, data, note);
|
|
807
|
+
break;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
return query;
|
|
811
|
+
}
|
|
676
812
|
|
|
813
|
+
function updateDeviceConfigurationSQLite(id_conf, data, note) {
|
|
814
|
+
var query = "update device_changes set ";
|
|
815
|
+
query += "date_conf = '" + data +"',";
|
|
816
|
+
query += "note = '" + note + "' ";
|
|
817
|
+
query += "where id = " + id_conf;
|
|
818
|
+
return query;
|
|
677
819
|
}
|
|
678
|
-
function
|
|
679
|
-
|
|
820
|
+
function updateDeviceConfigurationMySQL(id_conf, data, note) {
|
|
821
|
+
var query = "update device_changes set ";
|
|
822
|
+
query += "date_conf = :data,";
|
|
823
|
+
query += "note = :note ";
|
|
824
|
+
query += "where id = :id_conf";
|
|
825
|
+
return query;
|
|
826
|
+
}
|
|
827
|
+
function updateDeviceConfiguration(db_used, id_conf, data, note) {
|
|
828
|
+
var query = "";
|
|
829
|
+
if (db_used) {
|
|
830
|
+
switch (db_used) {
|
|
831
|
+
case 'SQLITE':
|
|
832
|
+
query = updateDeviceConfigurationSQLite(id_conf, data, note);
|
|
833
|
+
break;
|
|
834
|
+
case 'MYSQL':
|
|
835
|
+
query = updateDeviceConfigurationMySQL(id_conf, data, note);
|
|
836
|
+
break;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
return query;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
function removeDeviceConfigurationSQLite(id_conf) {
|
|
843
|
+
var query = "delete from device_changes ";
|
|
844
|
+
query += "where id = " + id_conf;
|
|
845
|
+
return query;
|
|
846
|
+
}
|
|
847
|
+
function removeDeviceConfigurationMySQL(id_conf) {
|
|
848
|
+
var query = "delete from device_changes ";
|
|
849
|
+
query += "where id = :id_conf";
|
|
850
|
+
return query;
|
|
851
|
+
}
|
|
852
|
+
function removeDeviceConfiguration(db_used, id_conf) {
|
|
853
|
+
var query = "";
|
|
854
|
+
if (db_used) {
|
|
855
|
+
switch (db_used) {
|
|
856
|
+
case 'SQLITE':
|
|
857
|
+
query = removeDeviceConfigurationSQLite(id_conf);
|
|
858
|
+
break;
|
|
859
|
+
case 'MYSQL':
|
|
860
|
+
query = removeDeviceConfigurationMySQL(id_conf);
|
|
861
|
+
break;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
return query;
|
|
865
|
+
}
|
|
866
|
+
//
|
|
867
|
+
function insertPartChangedSQLite(id_conf, part_type, id_part, operation, id_part_replaced) {
|
|
868
|
+
var query = "insert into change_config (id_conf, part_type, id_part, operation, id_part_replaced) values (";
|
|
869
|
+
query += id_conf + ", ";
|
|
870
|
+
query += "'" + part_type + "', ";
|
|
871
|
+
query += id_part + ", ";
|
|
872
|
+
query += "'" + operation + "', ";
|
|
873
|
+
query += id_part_replaced;
|
|
874
|
+
query += ")";
|
|
875
|
+
return query;
|
|
876
|
+
}
|
|
877
|
+
function insertPartChangedMySQL() {
|
|
878
|
+
|
|
680
879
|
}
|
|
681
|
-
function
|
|
880
|
+
function insertPartChanged(db_used, id_conf, part_type, id_part, operation, id_part_replaced) {
|
|
682
881
|
var query = "";
|
|
683
882
|
if (db_used) {
|
|
684
883
|
switch (db_used) {
|
|
685
884
|
case 'SQLITE':
|
|
686
|
-
query =
|
|
885
|
+
query = insertPartChangedSQLite(id_conf, part_type, id_part, operation, id_part_replaced);
|
|
687
886
|
break;
|
|
688
887
|
case 'MYSQL':
|
|
689
|
-
query =
|
|
888
|
+
query = insertPartChangedMySQL(id_conf, part_type, id_part, operation, id_part_replaced);
|
|
690
889
|
break;
|
|
691
890
|
}
|
|
692
891
|
}
|
|
693
892
|
return query;
|
|
694
893
|
}
|
|
894
|
+
|
|
895
|
+
function updatePartChangedSQLite(id_change, id_conf, part_type, id_part, operation, id_part_replaced) {
|
|
896
|
+
var query = "update change_config set ";
|
|
897
|
+
query += "id_conf = " + id_conf + ", ";
|
|
898
|
+
query += "part_type = '" + part_type + "', ";
|
|
899
|
+
query += "id_part = " + id_part + ", ";
|
|
900
|
+
query += "operation = '" + operation + "', ";
|
|
901
|
+
query += "id_part_replaced = '" + id_part_replaced + "', ";
|
|
902
|
+
query += "where id = " + id_change;
|
|
903
|
+
return query;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
function updatePartChangedMySQL(id_change, id_conf, part_type, id_part, operation) {
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
function updatePartChanged(db_used, id_change, id_conf, part_type, id_part, operation, id_part_replaced) {
|
|
910
|
+
var query = "";
|
|
911
|
+
if (db_used) {
|
|
912
|
+
switch (db_used) {
|
|
913
|
+
case 'SQLITE':
|
|
914
|
+
query = updatePartChangedSQLite(id_change, id_conf, part_type, id_part, operation, id_part_replaced);
|
|
915
|
+
break;
|
|
916
|
+
case 'MYSQL':
|
|
917
|
+
query = updatePartChangedMySQL(id_change, id_conf, part_type, id_part, operation, id_part_replaced);
|
|
918
|
+
break;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
return query;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
|
|
695
925
|
//End Device configurations
|
|
696
926
|
|
|
697
927
|
//Manage PC Properties
|
|
@@ -8018,22 +8248,30 @@ module.exports = {
|
|
|
8018
8248
|
insertStorage,
|
|
8019
8249
|
updateStorage,
|
|
8020
8250
|
removeStorage,
|
|
8251
|
+
getStoragesByConfig,
|
|
8021
8252
|
getNetworkByIdDevice,
|
|
8022
8253
|
getNetworkById,
|
|
8023
8254
|
createNetworkObjMySQL,
|
|
8024
8255
|
insertNetwork,
|
|
8025
8256
|
updateNetwork,
|
|
8026
8257
|
removeNetwork,
|
|
8258
|
+
getNetworksByConfig,
|
|
8027
8259
|
getAddOnByIdDevice,
|
|
8028
8260
|
getAddOnById,
|
|
8029
8261
|
createAddOnObjMySQL,
|
|
8030
8262
|
insertAddOn,
|
|
8031
8263
|
updateAddOn,
|
|
8032
8264
|
removeAddOn,
|
|
8265
|
+
getAddonsByConfig,
|
|
8033
8266
|
//
|
|
8034
8267
|
getDeviceConfigurations,
|
|
8035
|
-
|
|
8036
|
-
|
|
8268
|
+
getLastDeviceConfiguration,
|
|
8269
|
+
getDeviceConfigurationById,
|
|
8270
|
+
insertDeviceConfiguration,
|
|
8271
|
+
updateDeviceConfiguration,
|
|
8272
|
+
removeDeviceConfiguration,
|
|
8273
|
+
insertPartChanged,
|
|
8274
|
+
updatePartChanged,
|
|
8037
8275
|
//
|
|
8038
8276
|
selectBeneDaInventario,
|
|
8039
8277
|
getDevicesSelectForInventarioRaw,
|