diff --git a/src/main.tsx b/src/main.tsx index 9d22acfe9..67ba4971e 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -713,6 +713,16 @@ class InfoRemoteShow extends React.Component<{}, {}> { GlobalCommandRunner.disconnectRemote(remoteId); } + @boundMethod + installRemote(remoteId : string) { + GlobalCommandRunner.installRemote(remoteId); + } + + @boundMethod + cancelInstall(remoteId : string) { + GlobalCommandRunner.installCancelRemote(remoteId); + } + renderConnectButton(remote : RemoteType) : any { if (remote.status == "connected" || remote.status == "connecting") { return
this.disconnectRemote(remote.remoteid)} className="text-button disconnect-button">[disconnect remote]
@@ -722,6 +732,43 @@ class InfoRemoteShow extends React.Component<{}, {}> { } } + renderInstallButton(remote : RemoteType) : any { + if (remote.status == "connected" || remote.status == "connecting") { + return "(must disconnect to install)"; + } + if (remote.installstatus == "disconnected" || remote.installstatus == "error") { + return
this.installRemote(remote.remoteid)} className="text-button connect-button">[run install]
+ } + if (remote.installstatus == "connecting") { + return
this.cancelInstall(remote.remoteid)} className="text-button disconnect-button">[cancel install]
+ } + return null; + } + + renderInstallStatus(remote : RemoteType) : any { + let statusStr : string = null; + if (remote.installstatus == "disconnected") { + if (remote.needsmshellupgrade) { + statusStr = "needs upgrade" + } + } + else { + statusStr = remote.installstatus; + } + if (statusStr == null) { + return null; + } + let installButton = this.renderInstallButton(remote); + return ( +
+
install-status
+
+ {statusStr} | {this.renderInstallButton(remote)} +
+
+ ); + } + @boundMethod clickTermBlock(e : any) { let inputModel = GlobalModel.inputModel; @@ -750,47 +797,54 @@ class InfoRemoteShow extends React.Component<{}, {}> { } 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}
-
-
+
+
+
remoteid
+
{remote.remoteid}
-
- -
-
- -
input is only allowed while status is 'connecting'
-
-
+
+
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}
+
+
+ {this.renderInstallStatus(remote)} + +
+
install error
+
{remote.installerrorstr}
+
+
+
+
+ +
+
+ +
input is only allowed while status is 'connecting'
+
+
+
); } diff --git a/src/model.ts b/src/model.ts index d1d18e942..97ecfb65b 100644 --- a/src/model.ts +++ b/src/model.ts @@ -1118,7 +1118,7 @@ class InputModel { if (remote == null) { return; } - if (remote.status != "connecting") { + if (remote.status != "connecting" && remote.installstatus != "connecting") { this.setShowNoInputMsg(true); return; } @@ -1865,11 +1865,19 @@ class CommandRunner { } connectRemote(remoteid : string) { - GlobalModel.submitCommand("remote", "connect", null, {"nohist": "1", "remote": remoteid}, false); + GlobalModel.submitCommand("remote", "connect", null, {"nohist": "1", "remote": remoteid}, true); } disconnectRemote(remoteid : string) { - GlobalModel.submitCommand("remote", "disconnect", null, {"nohist": "1", "remote": remoteid}, false); + GlobalModel.submitCommand("remote", "disconnect", null, {"nohist": "1", "remote": remoteid}, true); + } + + installRemote(remoteid : string) { + GlobalModel.submitCommand("remote", "install", null, {"nohist": "1", "remote": remoteid}, true); + } + + installCancelRemote(remoteid : string) { + GlobalModel.submitCommand("remote", "installcancel", null, {"nohist": "1", "remote": remoteid}, true); } }; diff --git a/src/sh2.less b/src/sh2.less index cf57557cb..95d642c7f 100644 --- a/src/sh2.less +++ b/src/sh2.less @@ -1134,6 +1134,10 @@ body .xterm .xterm-viewport { } } +.remote-field .remote-status { + top: 4px; +} + .menu-list .remote-status .status-connecting { position: relative; top: 0px; diff --git a/src/types.ts b/src/types.ts index db188c3ba..f45746bbb 100644 --- a/src/types.ts +++ b/src/types.ts @@ -81,6 +81,8 @@ type RemoteType = { remotevars : Record, status : string, errorstr : string, + installstatus : string, + installerrorstr : string, defaultstate : RemoteStateType, connectmode : string, autoinstall : boolean,