This commit is contained in:
nguyentrungthat 2025-11-10 10:01:31 +07:00
parent 788f108b6a
commit b14a21088e
3 changed files with 18 additions and 6 deletions

View File

@ -118,7 +118,11 @@ export default class LineConnection {
lineId: id, lineId: id,
data: message, data: message,
}) })
if (!this.config.inventory) this.getInventory(this.outputScenario) if (!this.config.inventory) {
setTimeout(() => {
this.getInventory()
}, 3000)
}
appendLog(message, this.config.stationId, this.config.lineNumber, this.config.port) appendLog(message, this.config.stationId, this.config.lineNumber, this.config.port)
}) })
@ -277,7 +281,8 @@ export default class LineConnection {
if ( if (
['show inventory', 'sh inventory', 'show inv', 'sh inv'].includes( ['show inventory', 'sh inventory', 'show inv', 'sh inv'].includes(
item.command item.command
) ) &&
!this.config.inventory
) { ) {
this.config.inventory = JSON.parse(item.textfsm)[0] this.config.inventory = JSON.parse(item.textfsm)[0]
} }
@ -466,8 +471,8 @@ export default class LineConnection {
} }
} }
getInventory = (log: string) => { getInventory = () => {
const data = textfsmResults(log, 'show inventory') const data = textfsmResults(this.outputScenario, 'show inventory')
try { try {
data.forEach((item) => { data.forEach((item) => {
if (item?.textfsm && isValidJson(item?.textfsm)) { if (item?.textfsm && isValidJson(item?.textfsm)) {

View File

@ -495,7 +495,7 @@ function App() {
setIsDisable(true); setIsDisable(true);
setTimeout(() => { setTimeout(() => {
setIsDisable(false); setIsDisable(false);
}, 10000); }, 5000);
}} }}
/> />
<ScrollArea h={"60vh"} style={{ paddingBottom: "12px" }}> <ScrollArea h={"60vh"} style={{ paddingBottom: "12px" }}>
@ -527,7 +527,7 @@ function App() {
setIsDisable(true); setIsDisable(true);
setTimeout(() => { setTimeout(() => {
setIsDisable(false); setIsDisable(false);
}, 10000); }, 5000);
}} }}
scenario={el} scenario={el}
/> />

View File

@ -54,6 +54,13 @@ export const ButtonDPELP = ({
repeat: "1", repeat: "1",
note: "", note: "",
}, },
{
expect: "",
send: "show version | include License",
delay: "1000",
repeat: "1",
note: "",
},
{ {
expect: "", expect: "",
send: "show diag", send: "show diag",