diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index 7d233ca..10a66f4 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -6,6 +6,7 @@ import { buildBody, classifyLog, cleanData, + convertFromKilobytesString, detectConfigRamByModel, detectScenarioByModel, escapeHtml, @@ -282,6 +283,7 @@ export default class LineConnection { this.client.on('close', async () => { console.log(`[${Date.now()}] 🔌 Line ${lineNumber} disconnected`) this.config.status = 'disconnected' + this.config.output += this.config.output + '[CLEAR_TERMINAL_SCROLL_BACK]' // this.config.inventory = undefined this.socketIO.emit('line_disconnected', { stationId, @@ -1693,6 +1695,9 @@ ${log} sendReportSummary = async () => { const portPhysical = Array.from(this.physicalTest.ports.values()) + const missing = portPhysical.filter((p) => !p.tested) + const missingPoE = missing.filter((p) => !p.name.includes('SFP')) + const missingSFP = missing.filter((p) => p.name.includes('SFP')) const showVersion = this.config?.data?.find( (d) => d.command?.trim()?.includes('show ver') || d.command?.trim()?.includes('sh ver') ) @@ -1718,8 +1723,8 @@ ${log} Serial Number: ${this.config?.inventory?.sn ?? 'N/A'}
MAC: ${dataShowVersion?.MAC_ADDRESS ?? ''}
IOS: ${dataShowVersion?.SOFTWARE_IMAGE ?? ''} ${dataShowVersion?.VERSION ?? ''}
- MEM: ${dataShowVersion?.MEMORY ?? ''}
- FLASH: ${dataShowVersion?.USB_FLASH ?? ''}
+ MEM: ${dataShowVersion?.MEMORY ? convertFromKilobytesString(dataShowVersion?.MEMORY) : ''}
+ FLASH: ${dataShowVersion?.USB_FLASH ? convertFromKilobytesString(dataShowVersion?.USB_FLASH) : ''}
Licenses: ${ dataShowLic ? dataShowLic @@ -1735,6 +1740,23 @@ ${log} Total Ports: ${portPhysical?.length}
Ports Tested (Link UP): ${portPhysical.filter((p) => p.tested).length}
Ports Missing/Down: ${portPhysical.filter((p) => !p.tested).length}
+ ${ + missingPoE?.length + ? ` +
Ports Missing PoE
+ ────────────────────────────────
+
${missingPoE.map((p) => this.physicalTest.normalizePortName(p.name)).join('
')}
+ ` + : '' + } + ${ + missingSFP?.length + ? ` +
Ports Missing SFP
+ ────────────────────────────────
+
${missingSFP.map((p) => this.physicalTest.normalizePortName(p.name)).join('
')}
` + : '' + } ` diff --git a/BACKEND/providers/socket_io_provider.ts b/BACKEND/providers/socket_io_provider.ts index b92f697..4acc6e2 100644 --- a/BACKEND/providers/socket_io_provider.ts +++ b/BACKEND/providers/socket_io_provider.ts @@ -140,6 +140,7 @@ export class WebSocketIo { if (config.status !== 'connected') { config.runningScenario = '' config.runningPhysical = false + config.output = config.output + '[CLEAR_TERMINAL_SCROLL_BACK]' } return config }) diff --git a/FRONTEND/src/App.tsx b/FRONTEND/src/App.tsx index 6c0b5c6..007bc49 100644 --- a/FRONTEND/src/App.tsx +++ b/FRONTEND/src/App.tsx @@ -250,7 +250,12 @@ function App() { socket.on("line_disconnected", (data) => updateValueLineStation( data?.lineId, - { status: data.status, connecting: false }, + { + status: data.status, + connecting: false, + netOutput: "[CLEAR_TERMINAL_SCROLL_BACK]", + output: "[CLEAR_TERMINAL_SCROLL_BACK]", + }, data?.stationId ) ); diff --git a/FRONTEND/src/components/TerminalXTerm.tsx b/FRONTEND/src/components/TerminalXTerm.tsx index f0a1df6..cde3710 100644 --- a/FRONTEND/src/components/TerminalXTerm.tsx +++ b/FRONTEND/src/components/TerminalXTerm.tsx @@ -142,7 +142,13 @@ const TerminalCLI: React.FC = ({ if (cliOpened && isInit) { if (terminal.current) setTimeout(() => { - terminal.current?.write(content); + const valueContent = content.replaceAll( + "[CLEAR_TERMINAL_SCROLL_BACK]", + Array(miniSize ? 20 : 70) + .fill("\r\n") + .join("") + ); + terminal.current?.write(valueContent); terminal.current?.scrollToBottom(); }, 200); @@ -166,7 +172,13 @@ const TerminalCLI: React.FC = ({ useEffect(() => { if (!loading && !isInit) { if (terminal.current) { - terminal.current?.write(initContent); + const valueContent = initContent.replaceAll( + "[CLEAR_TERMINAL_SCROLL_BACK]", + Array(miniSize ? 20 : 70) + .fill("\r\n") + .join("") + ); + terminal.current?.write(valueContent); setIsInit(true); if (!miniSize && !isDisabled) terminal.current?.focus(); setTimeout(() => {