Update view IOS
This commit is contained in:
parent
75acf0ed8c
commit
8612d88858
|
|
@ -79,6 +79,7 @@ interface LineConfig {
|
|||
runningScenario: string
|
||||
runningPhysical: boolean
|
||||
listFeatureTested: string[]
|
||||
isReady: boolean
|
||||
// history: string
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +141,6 @@ export default class LineConnection {
|
|||
private testingPortPoE: boolean
|
||||
private outputTestingPortPoE: string
|
||||
private debounceSendSummaryReport: NodeJS.Timeout | null = null
|
||||
public isReady: boolean
|
||||
|
||||
constructor(config: LineConfig, socketIO: any, handleClearLine: () => void) {
|
||||
this.config = config
|
||||
|
|
@ -174,7 +174,6 @@ export default class LineConnection {
|
|||
this.debounceSendSummaryReport = null
|
||||
this.testingPortPoE = false
|
||||
this.outputTestingPortPoE = ''
|
||||
this.isReady = false
|
||||
}
|
||||
/**
|
||||
* Connect to line with socket
|
||||
|
|
@ -251,8 +250,8 @@ export default class LineConnection {
|
|||
}
|
||||
this.config.output += cleanData(rawData)
|
||||
this.config.output = this.config.output.slice(-15000)
|
||||
if (!this.isReady && canInputCommand(message)) {
|
||||
this.isReady = true
|
||||
if (!this.config.isReady && canInputCommand(message)) {
|
||||
this.config.isReady = true
|
||||
this.socketIO.emit('update_status_ready', {
|
||||
stationId,
|
||||
lineId: id,
|
||||
|
|
@ -300,7 +299,7 @@ export default class LineConnection {
|
|||
this.config.listFeatureTested = []
|
||||
this.config.latestScenario = undefined
|
||||
this.physicalTest = new PhysicalPortTest([])
|
||||
this.isReady = false
|
||||
this.config.isReady = false
|
||||
// this.config.inventory = undefined
|
||||
this.socketIO.emit('line_disconnected', {
|
||||
stationId,
|
||||
|
|
@ -406,7 +405,7 @@ export default class LineConnection {
|
|||
this.outputBuffer = ''
|
||||
return
|
||||
}
|
||||
if (!this.isReady) {
|
||||
if (!this.config.isReady) {
|
||||
console.log('Device is not ready')
|
||||
return
|
||||
}
|
||||
|
|
@ -1845,6 +1844,7 @@ ${log}
|
|||
runningScenario: '',
|
||||
runningPhysical: false,
|
||||
listFeatureTested: [],
|
||||
isReady: false,
|
||||
}
|
||||
this.physicalTest = new PhysicalPortTest([])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -617,7 +617,7 @@ export class WebSocketIo {
|
|||
let lineIds: number[] = []
|
||||
for (const lineId of dataLines) {
|
||||
const line = this.lineMap.get(lineId)
|
||||
if (line && line.isReady) {
|
||||
if (line && line.config.isReady) {
|
||||
lineIds.push(lineId)
|
||||
}
|
||||
}
|
||||
|
|
@ -905,6 +905,7 @@ export class WebSocketIo {
|
|||
runningScenario: '',
|
||||
latestScenario: latestScenario,
|
||||
listFeatureTested: [],
|
||||
isReady: false,
|
||||
},
|
||||
socket,
|
||||
async () => {
|
||||
|
|
|
|||
|
|
@ -125,11 +125,19 @@ const CardLine = ({
|
|||
|
||||
useEffect(() => {
|
||||
if (line?.latestScenario?.detectAI) {
|
||||
const data =
|
||||
line?.latestScenario?.detectAI?.issue &&
|
||||
Array.isArray(line?.latestScenario?.detectAI?.issue)
|
||||
? "- " + line?.latestScenario?.detectAI?.issue?.join("\n- ")
|
||||
: "";
|
||||
if (
|
||||
!line?.latestScenario?.detectAI?.issue ||
|
||||
line?.latestScenario?.detectAI?.issue.length === 0
|
||||
) {
|
||||
setIsShowIssue(false);
|
||||
return;
|
||||
}
|
||||
const data = Array.isArray(line?.latestScenario?.detectAI?.issue)
|
||||
? "- " +
|
||||
line?.latestScenario?.detectAI?.issue
|
||||
.filter((i: string) => i.trim())
|
||||
.join("\n- ")
|
||||
: "";
|
||||
if (data && !data.includes("No issues detected")) setIsShowIssue(true);
|
||||
else setIsShowIssue(false);
|
||||
} else setIsShowIssue(false);
|
||||
|
|
|
|||
|
|
@ -40,28 +40,31 @@ const ModalSelectIOS = ({
|
|||
const [isDisable, setIsDisable] = useState<boolean>(false);
|
||||
|
||||
const filterIos = (type: string = "") => {
|
||||
// Switch: Ưu tiên các dòng 4 chữ số cụ thể
|
||||
// c2960, c3560, c3750, c3850, c4500, c9xxx
|
||||
const switchRegex = /^(c2960|c3560|c3750|c3850|c4500|c9\d{3})/i;
|
||||
const name = (str: string) => str.toLowerCase();
|
||||
|
||||
// Router: Các dòng ISR đời cũ và mới
|
||||
// c18xx, c19xx, c28xx, c29xx (nhưng không phải 2960), c38xx (nhưng không phải 3850), c39xx, isr, asr
|
||||
// SWITCH families
|
||||
const switchRegex =
|
||||
/^(c29(60|50)|c35(60|70)|c37(50)|c38(50)|c45(00)|c9\d{3}|cat\d+k|cat\d{4}|catalyst)/i;
|
||||
|
||||
// ROUTER families
|
||||
const routerRegex =
|
||||
/^(c8\d{2}|c18|c19|c28|c29(?!60)|c38(?!50)|c39|isr|asr)/i;
|
||||
/^(c8\d{2}|c18\d{2}|c19\d{2}|c28\d{2}|c29(?!60)\d{2}|c38(?!50)\d{2}|c39\d{2}|isr\d*|asr\d*|csr\d*|ir\d*)/i;
|
||||
|
||||
return listIos
|
||||
.filter((ios) => {
|
||||
const iosName = name(ios.name);
|
||||
|
||||
if (type === "switch") {
|
||||
return switchRegex.test(ios.name);
|
||||
return switchRegex.test(iosName);
|
||||
}
|
||||
|
||||
if (type === "router") {
|
||||
return routerRegex.test(ios.name);
|
||||
return routerRegex.test(iosName);
|
||||
}
|
||||
return false;
|
||||
|
||||
return true; // nếu không truyền type thì trả hết
|
||||
})
|
||||
.filter((ios) =>
|
||||
ios.name.toLowerCase().includes(inputSearch.toLowerCase())
|
||||
);
|
||||
.filter((ios) => name(ios.name).includes(inputSearch.toLowerCase()));
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in New Issue