alsmanager_lib 3.0.16 → 3.0.18
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 +38 -8
- package/package.json +1 -1
package/lib/modules.js
CHANGED
|
@@ -2089,9 +2089,36 @@ function getPCPropertiesByConfig(db_used, id_device, id_conf) {
|
|
|
2089
2089
|
}
|
|
2090
2090
|
//End Manage PC Properties
|
|
2091
2091
|
// Switch/Patch Properties
|
|
2092
|
+
function existsSwitchPatchPropertiesSQLite(id_device) {
|
|
2093
|
+
var query = "select count(*) as num from device_switch ";
|
|
2094
|
+
query += "where id_device = " + id_device;
|
|
2095
|
+
return query;
|
|
2096
|
+
}
|
|
2097
|
+
function existsSwitchPatchPropertiesMySQL(id_device) {
|
|
2098
|
+
var query = "select count(*) as num from device_switch ";
|
|
2099
|
+
query += "where id_device = :id_device";
|
|
2100
|
+
return query;
|
|
2101
|
+
}
|
|
2102
|
+
function existsSwitchPatchProperties(db_used, id_device) {
|
|
2103
|
+
var query = "";
|
|
2104
|
+
if (db_used) {
|
|
2105
|
+
switch (db_used) {
|
|
2106
|
+
case 'SQLITE':
|
|
2107
|
+
query = existsSwitchPatchPropertiesSQLite(id_device);
|
|
2108
|
+
break;
|
|
2109
|
+
case 'MYSQL':
|
|
2110
|
+
query = existsSwitchPatchPropertiesMySQL(id_device);
|
|
2111
|
+
break;
|
|
2112
|
+
case 'MYSQL2':
|
|
2113
|
+
query = existsSwitchPatchPropertiesSQLite(id_device);
|
|
2114
|
+
break;
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
return query;
|
|
2118
|
+
}
|
|
2092
2119
|
function getSwitchPatchPropertiesSQLite(id_device) {
|
|
2093
2120
|
var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
|
|
2094
|
-
query += "ds.num_ports as NumeroPorte ";
|
|
2121
|
+
query += "ds.num_ports as NumeroPorte, ds.num_poe as NumPOE ";
|
|
2095
2122
|
query += "from devices d ";
|
|
2096
2123
|
query += "left join device_switch ds on d.id = ds.id_device ";
|
|
2097
2124
|
query += "where d.id = " + id_device;
|
|
@@ -2099,7 +2126,7 @@ function getSwitchPatchPropertiesSQLite(id_device) {
|
|
|
2099
2126
|
}
|
|
2100
2127
|
function getSwitchPatchPropertiesMySQL(id_device) {
|
|
2101
2128
|
var query = "select d.id as Id, d.type as Tipo, d.manifacturer as Marca, d.model as Modello,";
|
|
2102
|
-
query += "ds.num_ports as NumeroPorte ";
|
|
2129
|
+
query += "ds.num_ports as NumeroPorte, ds.num_poe as NumPOE ";
|
|
2103
2130
|
query += "from devices d ";
|
|
2104
2131
|
query += "left join device_switch ds on d.id = ds.id_device ";
|
|
2105
2132
|
query += "where d.id = :id_device";
|
|
@@ -2129,13 +2156,13 @@ function createSwitchPatchPropertiesMySQLObj(id_device, dev_prop) {
|
|
|
2129
2156
|
return obj;
|
|
2130
2157
|
}
|
|
2131
2158
|
function insertSwitchPatchPropertiesSQLite(id_device, dev_prop) {
|
|
2132
|
-
var query = "insert into device_switch (id_device, num_ports) values ";
|
|
2133
|
-
query += "(" + id_device + ", " + dev_prop.num_ports + ")";
|
|
2159
|
+
var query = "insert into device_switch (id_device, num_ports, num_poe) values ";
|
|
2160
|
+
query += "(" + id_device + ", " + dev_prop.num_ports + ", " + dev_prop.num_poe + ", '" + dev_prop.tipo + "')";
|
|
2134
2161
|
return query;
|
|
2135
2162
|
}
|
|
2136
2163
|
function insertSwitchPatchPropertiesMySQL() {
|
|
2137
|
-
var query = "insert into device_switch (id_device, num_ports) values ";
|
|
2138
|
-
query += "(:id_device, :num_ports)";
|
|
2164
|
+
var query = "insert into device_switch (id_device, num_ports, num_poe, tipo) values ";
|
|
2165
|
+
query += "(:id_device, :num_ports, :num_poe, :tipo)";
|
|
2139
2166
|
}
|
|
2140
2167
|
function insertSwitchPatchProperties(db_used, id_device, dev_prop) {
|
|
2141
2168
|
var query = "";
|
|
@@ -2158,7 +2185,8 @@ function insertSwitchPatchProperties(db_used, id_device, dev_prop) {
|
|
|
2158
2185
|
function updateSwitchPatchPropertiesSQLite(id_device, dev_prop) {
|
|
2159
2186
|
var query = "update device_switch set ";
|
|
2160
2187
|
query += "id_device = " + id_device + ", ";
|
|
2161
|
-
query += "num_ports = " + dev_prop.num_ports + " ";
|
|
2188
|
+
query += "num_ports = " + dev_prop.num_ports + ", ";
|
|
2189
|
+
query += "num_poe = " + dev_prop.num_poe + " ";
|
|
2162
2190
|
query += "where id_device = " + id_device;
|
|
2163
2191
|
return query;
|
|
2164
2192
|
}
|
|
@@ -2166,7 +2194,8 @@ function updateSwitchPatchPropertiesSQLite(id_device, dev_prop) {
|
|
|
2166
2194
|
function updateSwitchPatchPropertiesMySQL() {
|
|
2167
2195
|
var query = "update device_switch set ";
|
|
2168
2196
|
query += "id_device = :id_device, ";
|
|
2169
|
-
query += "num_ports = :num_ports ";
|
|
2197
|
+
query += "num_ports = :num_ports, ";
|
|
2198
|
+
query += "num_poe = :num_poe ";
|
|
2170
2199
|
query += "where id_device = :id_device";
|
|
2171
2200
|
return query;
|
|
2172
2201
|
}
|
|
@@ -13097,6 +13126,7 @@ module.exports = {
|
|
|
13097
13126
|
updatePCProperties,
|
|
13098
13127
|
getLastPCPropertiesInserted,
|
|
13099
13128
|
getPCPropertiesByConfig,
|
|
13129
|
+
existsSwitchPatchProperties,
|
|
13100
13130
|
getSwitchPatchProperties,
|
|
13101
13131
|
createSwitchPatchPropertiesMySQLObj,
|
|
13102
13132
|
insertSwitchPatchProperties,
|