diff --git a/src/main.tsx b/src/main.tsx index 249c1f321..548a23c59 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -669,27 +669,22 @@ class TextAreaInput extends React.Component<{}, {}> { } @mobxReact.observer -class InfoMsg extends React.Component<{}, {}> { - getAfterSlash(s : string) : string { - if (s.startsWith("^/")) { - return s.substr(1); +class InfoShowRemote extends React.Component<{}, {}> { + getRemoteTypeStr(remote : RemoteType) : string { + let mshellStr = ""; + if (!isBlank(remote.mshellversion)) { + mshellStr = "mshell=" + remote.mshellversion; } - let slashIdx = s.lastIndexOf("/"); - if (slashIdx == s.length-1) { - slashIdx = s.lastIndexOf("/", slashIdx-1); + if (!isBlank(remote.uname)) { + if (mshellStr != "") { + mshellStr += " "; + } + mshellStr += "uname=\"" + remote.uname + "\""; } - if (slashIdx == -1) { - return s; - } - return s.substr(slashIdx+1); - } - - @boundMethod - clickTermBlock(e : any) { - let inputModel = GlobalModel.inputModel; - if (inputModel.remoteTermWrap != null) { - inputModel.remoteTermWrap.terminal.focus(); + if (mshellStr == "") { + return remote.remotetype; } + return remote.remotetype + " (" + mshellStr + ")"; } @boundMethod @@ -711,21 +706,94 @@ class InfoMsg extends React.Component<{}, {}> { } } - getRemoteTypeStr(remote : RemoteType) : string { - let mshellStr = ""; - if (!isBlank(remote.mshellversion)) { - mshellStr = "mshell=" + remote.mshellversion; + @boundMethod + clickTermBlock(e : any) { + let inputModel = GlobalModel.inputModel; + if (inputModel.remoteTermWrap != null) { + inputModel.remoteTermWrap.terminal.focus(); } - if (!isBlank(remote.uname)) { - if (mshellStr != "") { - mshellStr += " "; - } - mshellStr += "uname=\"" + remote.uname + "\""; + } + + render() { + let inputModel = GlobalModel.inputModel; + let infoMsg = inputModel.infoMsg.get(); + let ptyRemoteId = (infoMsg == null ? null : infoMsg.ptyremoteid); + let isTermFocused = (inputModel.remoteTermWrap == null ? false : inputModel.remoteTermWrap.isFocused.get()); + let remote : RemoteType; + if (ptyRemoteId != null) { + remote = GlobalModel.getRemote(ptyRemoteId); } - if (mshellStr == "") { - return remote.remotetype; + if (ptyRemoteId == null || remote == null) { + return ( + <> +
+
+
+ + ); } - return remote.remotetype + " (" + mshellStr + ")"; + return ( + <> +
+
+
remoteid
+
{remote.remoteid}
+
+
+
type
+
{this.getRemoteTypeStr(remote)}
+
+
+
alias
+
{isBlank(remote.remotealias) ? "-" : remote.remotealias}
+
+
+
canonicalname
+
{remote.remotecanonicalname}
+
+
+
connectmode
+
{remote.connectmode}
+
+
+
status
+
{remote.status} | {this.renderConnectButton(remote)}
+
+ +
+
error
+
{remote.errorstr}
+
+
+
+
+ +
+
+ +
input is only allowed while status is 'connecting'
+
+
+
+ + ); + } +} + +@mobxReact.observer +class InfoMsg extends React.Component<{}, {}> { + getAfterSlash(s : string) : string { + if (s.startsWith("^/")) { + return s.substr(1); + } + let slashIdx = s.lastIndexOf("/"); + if (slashIdx == s.length-1) { + slashIdx = s.lastIndexOf("/", slashIdx-1); + } + if (slashIdx == -1) { + return s; + } + return s.substr(slashIdx+1); } render() { @@ -736,76 +804,28 @@ class InfoMsg extends React.Component<{}, {}> { let line : string = null; let istr : string = null; let idx : number = 0; - let ptyRemoteId = (infoMsg == null ? null : infoMsg.ptyremoteid); - let isTermFocused = (inputModel.remoteTermWrap == null ? false : inputModel.remoteTermWrap.isFocused.get()); - let remote : RemoteType; - if (ptyRemoteId != null) { - remote = GlobalModel.getRemote(ptyRemoteId); - } return (
-
+
{infoMsg.infotitle}
-
+
{infoMsg.infomsg}
-
+
{line == "" ? " " : line}
- -
-
-
remoteid
-
{remote.remoteid}
-
-
-
type
-
{this.getRemoteTypeStr(remote)}
-
-
-
alias
-
{isBlank(remote.remotealias) ? "-" : remote.remotealias}
-
-
-
canonicalname
-
{remote.remotecanonicalname}
-
-
-
connectmode
-
{remote.connectmode}
-
-
-
status
-
{remote.status} | {this.renderConnectButton(remote)}
-
- -
-
error
-
{remote.errorstr}
-
-
-
-
-
- -
-
- -
input is only allowed while status is 'connecting'
-
-
-
+ 0}> -
+
{this.getAfterSlash(istr)} @@ -819,7 +839,7 @@ class InfoMsg extends React.Component<{}, {}> {
-
+
[error] {infoMsg.infoerror}
@@ -988,9 +1008,11 @@ class CmdInput extends React.Component<{}, {}> { let cwdStr = getCwdStr(remote, remoteState); let infoShow = inputModel.infoShow.get(); let historyShow = !infoShow && inputModel.historyShow.get(); - let hasInfo = (inputModel.infoMsg.get() != null); + let infoMsg = inputModel.infoMsg.get(); + let hasInfo = (infoMsg != null); + let remoteShow = (infoMsg != null && !isBlank(infoMsg.ptyremoteid)); return ( -
+
diff --git a/src/sh2.less b/src/sh2.less index 8e3e3ab8c..075841064 100644 --- a/src/sh2.less +++ b/src/sh2.less @@ -641,6 +641,10 @@ body .xterm .xterm-viewport { height: max(300px, 40%); } + &.has-remote { + max-height: max(300px, 70%); + } + .input-minmax-control { position: absolute; top: 5px; diff --git a/src/types.ts b/src/types.ts index 3ed2fda3f..eadb430c3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -285,6 +285,7 @@ type InfoType = { infocompsmore? : boolean, timeoutms? : number, ptyremoteid? : string, + remoteshowall? : boolean, }; type HistoryQueryOpts = {