update catch SPE PID
This commit is contained in:
parent
c121ff6bc5
commit
66690e3d5d
|
|
@ -154,17 +154,17 @@ export const sendDeviceInfora = async () => {
|
|||
);
|
||||
|
||||
showInventoryContent.map((u, index) => {
|
||||
const PID = u
|
||||
let PID = u
|
||||
?.split("VID:")[0]
|
||||
?.split("PID:")[1]
|
||||
?.replace(/,/g, "")
|
||||
.trim();
|
||||
const VID = u
|
||||
let VID = u
|
||||
?.split("VID:")[1]
|
||||
?.split("SN:")[0]
|
||||
?.replace(/,/g, "")
|
||||
.trim();
|
||||
const SN = u?.split("SN:")[1]?.replace(/,/g, "").trim();
|
||||
let SN = u?.split("SN:")[1]?.replace(/,/g, "").trim();
|
||||
if (index > 0) {
|
||||
if (PID !== "" && SN !== "") {
|
||||
listInformation.push({
|
||||
|
|
@ -186,25 +186,33 @@ export const sendDeviceInfora = async () => {
|
|||
PID.includes(i.split(":")[0])
|
||||
)[0]
|
||||
: PID + ":N/A:N/A";
|
||||
|
||||
const regexSPE = /\S*-SPE\S*(?=\s)/;
|
||||
|
||||
const stringMem = showVersion.filter(
|
||||
(line) =>
|
||||
line.includes("bytes of memory") ||
|
||||
line.includes("bytes of physical memory")
|
||||
)
|
||||
const mathches = stringMem[0].match(regexSPE)
|
||||
|
||||
if(mathches && stringMem[0].includes("CHASSIS")){
|
||||
console.log(mathches)
|
||||
PID = mathches[0].trim();
|
||||
SN = showInventoryContent.filter((i)=>i.includes(mathches[0].trim()))[0]?.split("SN:")[1]?.replace(/,/g, "").trim();
|
||||
VID = showInventoryContent.filter((i)=>i.includes(mathches[0].trim()))[0]?.split("VID:")[1]
|
||||
?.split("SN:")[0]
|
||||
?.replace(/,/g, "")
|
||||
.trim();
|
||||
}
|
||||
|
||||
let RAM =
|
||||
showVersion
|
||||
.filter(
|
||||
(line) =>
|
||||
line.includes("bytes of memory") ||
|
||||
line.includes("bytes of physical memory")
|
||||
)
|
||||
stringMem
|
||||
.join("<br>")
|
||||
.match(regexMemory) !== null
|
||||
? (
|
||||
parseInt(
|
||||
showVersion
|
||||
.filter(
|
||||
(line) =>
|
||||
line.includes("bytes of memory") ||
|
||||
line.includes(
|
||||
"bytes of physical memory"
|
||||
)
|
||||
)
|
||||
stringMem
|
||||
.join("<br>")
|
||||
.match(regexMemory)[0]
|
||||
) /
|
||||
|
|
@ -312,8 +320,8 @@ export const sendDeviceInfora = async () => {
|
|||
});
|
||||
const options = {
|
||||
from: "admin@apactech.io",
|
||||
// to: "joseph@apactech.io, ips@ipsupply.com.au",
|
||||
to: "joseph@apactech.io",
|
||||
to: "joseph@apactech.io, ips@ipsupply.com.au",
|
||||
// to: "joseph@apactech.io",
|
||||
subject: "(AUTO-REPORT) SERIAL NUMBER",
|
||||
html:
|
||||
"<table border='1'>\
|
||||
|
|
|
|||
Loading…
Reference in New Issue