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) => {
|
showInventoryContent.map((u, index) => {
|
||||||
const PID = u
|
let PID = u
|
||||||
?.split("VID:")[0]
|
?.split("VID:")[0]
|
||||||
?.split("PID:")[1]
|
?.split("PID:")[1]
|
||||||
?.replace(/,/g, "")
|
?.replace(/,/g, "")
|
||||||
.trim();
|
.trim();
|
||||||
const VID = u
|
let VID = u
|
||||||
?.split("VID:")[1]
|
?.split("VID:")[1]
|
||||||
?.split("SN:")[0]
|
?.split("SN:")[0]
|
||||||
?.replace(/,/g, "")
|
?.replace(/,/g, "")
|
||||||
.trim();
|
.trim();
|
||||||
const SN = u?.split("SN:")[1]?.replace(/,/g, "").trim();
|
let SN = u?.split("SN:")[1]?.replace(/,/g, "").trim();
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
if (PID !== "" && SN !== "") {
|
if (PID !== "" && SN !== "") {
|
||||||
listInformation.push({
|
listInformation.push({
|
||||||
|
|
@ -186,25 +186,33 @@ export const sendDeviceInfora = async () => {
|
||||||
PID.includes(i.split(":")[0])
|
PID.includes(i.split(":")[0])
|
||||||
)[0]
|
)[0]
|
||||||
: PID + ":N/A:N/A";
|
: 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 =
|
let RAM =
|
||||||
showVersion
|
stringMem
|
||||||
.filter(
|
|
||||||
(line) =>
|
|
||||||
line.includes("bytes of memory") ||
|
|
||||||
line.includes("bytes of physical memory")
|
|
||||||
)
|
|
||||||
.join("<br>")
|
.join("<br>")
|
||||||
.match(regexMemory) !== null
|
.match(regexMemory) !== null
|
||||||
? (
|
? (
|
||||||
parseInt(
|
parseInt(
|
||||||
showVersion
|
stringMem
|
||||||
.filter(
|
|
||||||
(line) =>
|
|
||||||
line.includes("bytes of memory") ||
|
|
||||||
line.includes(
|
|
||||||
"bytes of physical memory"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.join("<br>")
|
.join("<br>")
|
||||||
.match(regexMemory)[0]
|
.match(regexMemory)[0]
|
||||||
) /
|
) /
|
||||||
|
|
@ -312,8 +320,8 @@ export const sendDeviceInfora = async () => {
|
||||||
});
|
});
|
||||||
const options = {
|
const options = {
|
||||||
from: "admin@apactech.io",
|
from: "admin@apactech.io",
|
||||||
// to: "joseph@apactech.io, ips@ipsupply.com.au",
|
to: "joseph@apactech.io, ips@ipsupply.com.au",
|
||||||
to: "joseph@apactech.io",
|
// to: "joseph@apactech.io",
|
||||||
subject: "(AUTO-REPORT) SERIAL NUMBER",
|
subject: "(AUTO-REPORT) SERIAL NUMBER",
|
||||||
html:
|
html:
|
||||||
"<table border='1'>\
|
"<table border='1'>\
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue