diff --git a/src/main.tsx b/src/main.tsx index c777c8b29..8b2573d0d 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -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 (
@@ -721,7 +734,17 @@ class InfoMsg extends React.Component<{}, {}> {
-
+ +
+ +
this.connectRemote(ptyRemoteId)} className="button is-small is-success">Connect
+
+ +
this.disconnectRemote(ptyRemoteId)} className="button is-small is-danger">Disconnect
+
+
+
+
diff --git a/src/model.ts b/src/model.ts index b706cc59e..bc7ab197e 100644 --- a/src/model.ts +++ b/src/model.ts @@ -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; diff --git a/src/sh2.less b/src/sh2.less index 85e55d9b6..e59abe8c4 100644 --- a/src/sh2.less +++ b/src/sh2.less @@ -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;