small updates

This commit is contained in:
sawka 2022-06-16 01:08:56 -07:00
parent 45cd98ef00
commit 4f2c75af0c
2 changed files with 7 additions and 7 deletions

View File

@ -112,7 +112,7 @@ class LineCmd extends React.Component<{line : LineType}, {}> {
let {line, sessionid} = this.props;
let termElem = document.getElementById(this.getId());
this.termWrap.connectToElem(termElem);
this.termWrap.reloadTerminal();
this.termWrap.reloadTerminal(0);
if (line.isnew) {
setTimeout(() => {
let lineElem = document.getElementById("line-" + this.getId());
@ -122,7 +122,7 @@ class LineCmd extends React.Component<{line : LineType}, {}> {
})();
}, 100);
setTimeout(() => {
this.termWrap.reloadTerminal();
this.termWrap.reloadTerminal(0);
}, 1000);
}
}
@ -134,7 +134,7 @@ class LineCmd extends React.Component<{line : LineType}, {}> {
@boundMethod
doRefresh() {
this.termWRap.reloadTerminal();
this.termWrap.reloadTerminal(500);
}
@boundMethod

View File

@ -6,7 +6,7 @@ import {GlobalWS} from "./ws";
var TermMap : Record<string, TermWrap>;
function loadPtyOut(term : Terminal, sessionId : string, cmdId : string, callback?: () => void) {
function loadPtyOut(term : Terminal, sessionId : string, cmdId : string, delayMs : number, callback?: () => void) {
term.clear()
let url = sprintf("http://localhost:8080/api/ptyout?sessionid=%s&cmdid=%s", sessionId, cmdId);
fetch(url).then((resp) => {
@ -15,7 +15,7 @@ function loadPtyOut(term : Terminal, sessionId : string, cmdId : string, callbac
}
return resp.text()
}).then((resptext) => {
setTimeout(() => term.write(resptext, callback), 0);
setTimeout(() => term.write(resptext, callback), delayMs);
});
}
@ -68,8 +68,8 @@ class TermWrap {
mobx.action(() => this.renderVersion.set(this.renderVersion.get() + 1))();
}
reloadTerminal() {
loadPtyOut(this.terminal, this.sessionId, this.cmdId, this.incRenderVersion);
reloadTerminal(delayMs : number) {
loadPtyOut(this.terminal, this.sessionId, this.cmdId, delayMs, this.incRenderVersion);
}
connectToElem(elem : Element) {