alsmanager_lib 3.0.82 → 3.0.83
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 +42 -2
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -4288,13 +4288,15 @@ function writeDeviceProperties(db_used, id_device, raw_data) {
|
|
|
4288
4288
|
//Read Device properties
|
|
4289
4289
|
function readDevicePropertiesSQLite(id_device) {
|
|
4290
4290
|
var query = "select raw_properties from device_properties ";
|
|
4291
|
-
query += "where id_device = " + id_device;
|
|
4291
|
+
query += "where id_device = " + id_device + " ";
|
|
4292
|
+
query += "and (is_imported is null or is_imported = 0)"
|
|
4292
4293
|
return query;
|
|
4293
4294
|
}
|
|
4294
4295
|
|
|
4295
4296
|
function readDevicePropertiesMySQL() {
|
|
4296
4297
|
var query = "select raw_properties from device_properties ";
|
|
4297
|
-
query += "where id_device = :id_device";
|
|
4298
|
+
query += "where id_device = :id_device ";
|
|
4299
|
+
query += "and (is_imported is null or is_imported = 0)"
|
|
4298
4300
|
return query;
|
|
4299
4301
|
}
|
|
4300
4302
|
function readDeviceProperties(db_used, id_device) {
|
|
@@ -4315,7 +4317,44 @@ function readDeviceProperties(db_used, id_device) {
|
|
|
4315
4317
|
return query;
|
|
4316
4318
|
}
|
|
4317
4319
|
//End Read Device properties
|
|
4320
|
+
//Update Device Properties after import
|
|
4321
|
+
function updateDevicePropertiesSQLite(id_prop, is_imported, id_config) {
|
|
4322
|
+
var query = "update device_properties set ";
|
|
4323
|
+
query += "is_imported " + is_imported + " ";
|
|
4324
|
+
if (id_config) {
|
|
4325
|
+
query += ", id_config = " + id_config + " ";
|
|
4326
|
+
}
|
|
4327
|
+
query += "where id = " + id_prop;
|
|
4328
|
+
return query;
|
|
4329
|
+
}
|
|
4318
4330
|
|
|
4331
|
+
function updateDevicePropertiesMySQL(id_prop, is_imported, id_config) {
|
|
4332
|
+
var query = "update device_properties set ";
|
|
4333
|
+
query += "is_imported :is_imported ";
|
|
4334
|
+
if (id_config) {
|
|
4335
|
+
query += ", id_config = :id_config ";
|
|
4336
|
+
}
|
|
4337
|
+
query += "where id = :id_prop";
|
|
4338
|
+
return query;
|
|
4339
|
+
}
|
|
4340
|
+
function updateDeviceProperties(db_used, id_prop, is_imported, id_config) {
|
|
4341
|
+
var query = "";
|
|
4342
|
+
if (db_used) {
|
|
4343
|
+
switch (db_used) {
|
|
4344
|
+
case 'SQLITE':
|
|
4345
|
+
query = updateDevicePropertiesSQLite(id_prop, is_imported, id_config);
|
|
4346
|
+
break;
|
|
4347
|
+
case 'MYSQL':
|
|
4348
|
+
query = updateDevicePropertiesMySQL(id_prop, is_imported, id_config);
|
|
4349
|
+
break;
|
|
4350
|
+
case 'MYSQL2':
|
|
4351
|
+
query = updateDevicePropertiesSQLite(id_prop, is_imported, id_config);
|
|
4352
|
+
break;
|
|
4353
|
+
}
|
|
4354
|
+
}
|
|
4355
|
+
return query;
|
|
4356
|
+
}
|
|
4357
|
+
//End Update Device Properties after import
|
|
4319
4358
|
// Get Devices with properties
|
|
4320
4359
|
function getDevicesWithPropertiesSQLite(id_device) {
|
|
4321
4360
|
var query = "select ";
|
|
@@ -14344,6 +14383,7 @@ module.exports = {
|
|
|
14344
14383
|
getDeviceMySQLPayload,
|
|
14345
14384
|
writeDeviceProperties,
|
|
14346
14385
|
readDeviceProperties,
|
|
14386
|
+
updateDeviceProperties,
|
|
14347
14387
|
//
|
|
14348
14388
|
getDiskUsagesByIdStorage,
|
|
14349
14389
|
getLastDiskUsagesByIdStorage,
|