update catch SPE PID

This commit is contained in:
joseph le 2023-10-25 08:46:23 +07:00
parent c121ff6bc5
commit 66690e3d5d
1 changed files with 27 additions and 19 deletions

View File

@ -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'>\