Update check flash
This commit is contained in:
parent
0ce936b685
commit
9fcf03e3a7
|
|
@ -523,8 +523,13 @@ export default class LineConnection {
|
|||
this.config.inventory = this.config.inventory
|
||||
? { ...this.config.inventory, ...dataVer }
|
||||
: dataVer
|
||||
if (pid && dataVer?.MEMORY) {
|
||||
await this.checkConfigRam(dataVer?.MEMORY, pid, cleanData(item.output))
|
||||
if (pid && (dataVer?.MEMORY || dataVer?.USB_FLASH)) {
|
||||
await this.checkConfigRam(
|
||||
dataVer?.MEMORY || '',
|
||||
dataVer?.USB_FLASH || '',
|
||||
pid,
|
||||
cleanData(item.output)
|
||||
)
|
||||
}
|
||||
}
|
||||
if (
|
||||
|
|
@ -1598,20 +1603,22 @@ ${log}
|
|||
return ''
|
||||
}
|
||||
|
||||
async checkConfigRam(mem: string, pid: string, output: string) {
|
||||
async checkConfigRam(mem: string, flash: string, pid: string, output: string) {
|
||||
const configRam = await detectConfigRamByModel(pid)
|
||||
if (configRam) {
|
||||
const isWarningRAM = isRamSufficient(mem, configRam.ram)
|
||||
if (isWarningRAM) {
|
||||
const subject = `[ATC] - [${this.config.stationName} - Line: ${this.config.lineNumber}] - Warning RAM Configuration`
|
||||
const isWarningFlash = isRamSufficient(flash, configRam.flash)
|
||||
if (isWarningRAM || isWarningFlash) {
|
||||
const subject = `[ATC] - [${this.config.stationName} - Line: ${this.config.lineNumber}] - Warning RAM, Flash Configuration`
|
||||
const body = `
|
||||
<p>Station: <b>${this.config.stationName}</b></p>
|
||||
<p>Line: <b>${this.config.lineNumber}</b></p>
|
||||
<p>Model: <b>${pid}</b></p>
|
||||
<p>RAM: <b>${mem + ' bytes'} (<span style="color: red;">default: ${configRam.ram}</span>)</b></p>
|
||||
<p>RAM: ${mem ? `<b>${mem + ' bytes'} (<span style="color: red;">default: ${configRam.ram}</span>)</b>` : ''}</p>
|
||||
<p>FLASH: ${flash ? `<b>${flash + ' bytes'} (<span style="color: red;">default: ${configRam.flash}</span>)</b>` : ''}</p>
|
||||
<hr />
|
||||
<div style="white-space: break-spaces; background-color: #f5f5f5; color: black; padding: 8px; max-height: 500px; overflow-y: scroll; border: 1px #ccc solid;"><span style="color: black;">
|
||||
${escapeHtml(output).replace('show ver', '').replace('sh ver', '').replace('show version', '').replace('sh version', '').replace(mem, `<span style="color: red;">${mem}</span>`)}</span></div>
|
||||
${escapeHtml(output).replace('show ver', '').replace('sh ver', '').replace('show version', '').replace('sh version', '').replace(mem, `<span style="color: red;">${mem}</span>`).replace(flash, `<span style="color: red;">${flash}</span>`)}</span></div>
|
||||
`
|
||||
await sendMessageToMail(subject, body)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ import Station from '#models/station'
|
|||
import ConfigRam from '#models/config_ram'
|
||||
|
||||
const mailTo = 'andrew.ng@apactech.io'
|
||||
// const mailCC = [
|
||||
// 'ips@ipsupply.com.au',
|
||||
// 'kay@ipsupply.com.au',
|
||||
// 'joseph@apactech.io',
|
||||
// 'kiet.phan@apactech.io',
|
||||
// ]
|
||||
const mailCC = ''
|
||||
const mailCC = [
|
||||
'ips@ipsupply.com.au',
|
||||
'kay@ipsupply.com.au',
|
||||
'joseph@apactech.io',
|
||||
'kiet.phan@apactech.io',
|
||||
]
|
||||
// const mailCC = ''
|
||||
|
||||
type DetectAI = {
|
||||
status: string[]
|
||||
|
|
|
|||
Loading…
Reference in New Issue