more progress on remotes

This commit is contained in:
sawka 2022-09-15 00:37:52 -07:00
parent 0e04a32e29
commit 98d956b7c8
3 changed files with 34 additions and 2 deletions

View File

@ -690,6 +690,16 @@ class InfoMsg extends React.Component<{}, {}> {
inputModel.remoteTermWrap.terminal.focus();
}
}
@boundMethod
connectRemote(remoteId : string) {
GlobalCommandRunner.connectRemote(remoteId);
}
@boundMethod
disconnectRemote(remoteId : string) {
GlobalCommandRunner.disconnectRemote(remoteId);
}
render() {
let model = GlobalModel;
@ -701,7 +711,10 @@ class InfoMsg extends React.Component<{}, {}> {
let idx : number = 0;
let ptyRemoteId = (infoMsg == null ? null : infoMsg.ptyremoteid);
let isTermFocused = (inputModel.remoteTermWrap == null ? false : inputModel.remoteTermWrap.isFocused.get());
console.log("ptyremoteid", ptyRemoteId);
let remote : RemoteType;
if (ptyRemoteId != null) {
remote = GlobalModel.getRemote(ptyRemoteId);
}
return (
<div className="cmd-input-info" style={{display: (infoShow ? "block" : "none")}}>
<If condition={infoMsg && infoMsg.infotitle != null}>
@ -721,7 +734,17 @@ class InfoMsg extends React.Component<{}, {}> {
</For>
</div>
</If>
<div className={cn("terminal-wrapper", {"focus": isTermFocused})} style={{overflowY: "hidden", display: (ptyRemoteId == null ? "none" : "block"), width: CellWidthPx*RemotePtyCols}}>
<If condition={ptyRemoteId != null && remote != null}>
<div>
<If condition={remote.status != "connected"}>
<div onClick={() => this.connectRemote(ptyRemoteId)} className="button is-small is-success">Connect</div>
</If>
<If condition={remote.status == "connected"}>
<div onClick={() => this.disconnectRemote(ptyRemoteId)} className="button is-small is-danger">Disconnect</div>
</If>
</div>
</If>
<div className={cn("terminal-wrapper", {"focus": isTermFocused})} style={{overflowY: "hidden", display: (ptyRemoteId == null ? "none" : "block"), width: CellWidthPx*RemotePtyCols+15}}>
<If condition={!isTermFocused}>
<div className="term-block" onClick={this.clickTermBlock}></div>
</If>

View File

@ -1840,6 +1840,14 @@ class CommandRunner {
showRemote(remoteid : string) {
GlobalModel.submitCommand("remote", "show", null, {"nohist": "1", "remote": remoteid}, true);
}
connectRemote(remoteid : string) {
GlobalModel.submitCommand("remote", "connect", null, {"nohist": "1", "remote": remoteid}, false);
}
disconnectRemote(remoteid : string) {
GlobalModel.submitCommand("remote", "disconnect", null, {"nohist": "1", "remote": remoteid}, false);
}
};
let GlobalModel : Model = null;

View File

@ -764,6 +764,7 @@ body .xterm .xterm-viewport {
.cmd-input-info {
flex-shrink: 1;
overflow-y: auto;
margin-bottom: 5px;
.info-msg {
font-family: 'JetBrains Mono', monospace;