mirror of
https://github.com/hansjone/netx.git
synced 2026-10-10 18:03:14 +08:00
fix(webcrt): replay login banner/prompt on attach
Drain and nudge the device prompt after Netmiko login, replay bootstrap stdout when the WebSocket attaches, and surface connect errors in the terminal pane. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
8e3bed562f
commit
30f2db9708
6 changed files with 87 additions and 9 deletions
|
|
@ -22,6 +22,7 @@ type TermTab = {
|
|||
wsUrl: string;
|
||||
target: CliTargetItem;
|
||||
status: "connecting" | "connected" | "error" | "closed";
|
||||
errorMessage?: string;
|
||||
};
|
||||
|
||||
function targetKey(t: Pick<CliTargetItem, "source" | "id">): string {
|
||||
|
|
@ -120,8 +121,9 @@ export function WebcrtPage() {
|
|||
updateTab(key, { sessionId: sess.session_id, wsUrl, status: "connecting" });
|
||||
showOk(t("webcrt.opened", { name: target.name || target.ip_address }));
|
||||
} catch (err) {
|
||||
updateTab(key, { status: "error" });
|
||||
showError(webcrtErrorMessage(err, t));
|
||||
const message = webcrtErrorMessage(err, t);
|
||||
updateTab(key, { status: "error", errorMessage: message });
|
||||
showError(message);
|
||||
} finally {
|
||||
connectingKeysRef.current.delete(key);
|
||||
}
|
||||
|
|
@ -344,7 +346,8 @@ export function WebcrtPage() {
|
|||
) : null}
|
||||
{tab.status === "error" && !tab.wsUrl ? (
|
||||
<div className="webcrt-main__placeholder webcrt-main__placeholder--error">
|
||||
{t("webcrt.status.error")}
|
||||
<div>{t("webcrt.status.error")}</div>
|
||||
{tab.errorMessage ? <pre className="webcrt-error-detail">{tab.errorMessage}</pre> : null}
|
||||
</div>
|
||||
) : null}
|
||||
{tab.wsUrl ? (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue