diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index 141f04c..8d69a46 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -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 = `

Station: ${this.config.stationName}

Line: ${this.config.lineNumber}

Model: ${pid}

-

RAM: ${mem + ' bytes'} (default: ${configRam.ram})

+

RAM: ${mem ? `${mem + ' bytes'} (default: ${configRam.ram})` : ''}

+

FLASH: ${flash ? `${flash + ' bytes'} (default: ${configRam.flash})` : ''}


- ${escapeHtml(output).replace('show ver', '').replace('sh ver', '').replace('show version', '').replace('sh version', '').replace(mem, `${mem}`)}
+ ${escapeHtml(output).replace('show ver', '').replace('sh ver', '').replace('show version', '').replace('sh version', '').replace(mem, `${mem}`).replace(flash, `${flash}`)} ` await sendMessageToMail(subject, body) } diff --git a/BACKEND/app/ultils/helper.ts b/BACKEND/app/ultils/helper.ts index 2727f84..eaf473c 100644 --- a/BACKEND/app/ultils/helper.ts +++ b/BACKEND/app/ultils/helper.ts @@ -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[]