remote install

This commit is contained in:
sawka 2022-09-26 23:24:15 -07:00
parent 49f2611764
commit 594c3472e3
4 changed files with 110 additions and 42 deletions

View File

@ -713,6 +713,16 @@ class InfoRemoteShow extends React.Component<{}, {}> {
GlobalCommandRunner.disconnectRemote(remoteId); GlobalCommandRunner.disconnectRemote(remoteId);
} }
@boundMethod
installRemote(remoteId : string) {
GlobalCommandRunner.installRemote(remoteId);
}
@boundMethod
cancelInstall(remoteId : string) {
GlobalCommandRunner.installCancelRemote(remoteId);
}
renderConnectButton(remote : RemoteType) : any { renderConnectButton(remote : RemoteType) : any {
if (remote.status == "connected" || remote.status == "connecting") { if (remote.status == "connected" || remote.status == "connecting") {
return <div onClick={() => this.disconnectRemote(remote.remoteid)} className="text-button disconnect-button">[disconnect remote]</div> return <div onClick={() => this.disconnectRemote(remote.remoteid)} className="text-button disconnect-button">[disconnect remote]</div>
@ -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 <div onClick={() => this.installRemote(remote.remoteid)} className="text-button connect-button">[run install]</div>
}
if (remote.installstatus == "connecting") {
return <div onClick={() => this.cancelInstall(remote.remoteid)} className="text-button disconnect-button">[cancel install]</div>
}
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 (
<div className="remote-field">
<div className="remote-field-def"> install-status</div>
<div className="remote-field-val">
{statusStr}<If condition={installButton != null}> | {this.renderInstallButton(remote)}</If>
</div>
</div>
);
}
@boundMethod @boundMethod
clickTermBlock(e : any) { clickTermBlock(e : any) {
let inputModel = GlobalModel.inputModel; let inputModel = GlobalModel.inputModel;
@ -773,7 +820,7 @@ class InfoRemoteShow extends React.Component<{}, {}> {
</div> </div>
<div className="remote-field"> <div className="remote-field">
<div className="remote-field-def"> status</div> <div className="remote-field-def"> status</div>
<div className="remote-field-val">{remote.status} | {this.renderConnectButton(remote)}</div> <div className="remote-field-val"><RemoteStatusLight status={remote.status}/>{remote.status} | {this.renderConnectButton(remote)}</div>
</div> </div>
<If condition={!isBlank(remote.errorstr)}> <If condition={!isBlank(remote.errorstr)}>
<div className="remote-field"> <div className="remote-field">
@ -781,6 +828,13 @@ class InfoRemoteShow extends React.Component<{}, {}> {
<div className="remote-field-val">{remote.errorstr}</div> <div className="remote-field-val">{remote.errorstr}</div>
</div> </div>
</If> </If>
{this.renderInstallStatus(remote)}
<If condition={!isBlank(remote.installerrorstr)}>
<div className="remote-field">
<div className="remote-field-def"> install error</div>
<div className="remote-field-val">{remote.installerrorstr}</div>
</div>
</If>
</div> </div>
<div key="term" className={cn("terminal-wrapper", {"focus": isTermFocused}, (remote != null ? "status-" + remote.status : null))} style={{overflowY: "hidden", display: (ptyRemoteId == null ? "none" : "block"), width: CellWidthPx*RemotePtyCols+15}}> <div key="term" className={cn("terminal-wrapper", {"focus": isTermFocused}, (remote != null ? "status-" + remote.status : null))} style={{overflowY: "hidden", display: (ptyRemoteId == null ? "none" : "block"), width: CellWidthPx*RemotePtyCols+15}}>
<If condition={!isTermFocused}> <If condition={!isTermFocused}>

View File

@ -1118,7 +1118,7 @@ class InputModel {
if (remote == null) { if (remote == null) {
return; return;
} }
if (remote.status != "connecting") { if (remote.status != "connecting" && remote.installstatus != "connecting") {
this.setShowNoInputMsg(true); this.setShowNoInputMsg(true);
return; return;
} }
@ -1865,11 +1865,19 @@ class CommandRunner {
} }
connectRemote(remoteid : string) { 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) { 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);
} }
}; };

View File

@ -1134,6 +1134,10 @@ body .xterm .xterm-viewport {
} }
} }
.remote-field .remote-status {
top: 4px;
}
.menu-list .remote-status .status-connecting { .menu-list .remote-status .status-connecting {
position: relative; position: relative;
top: 0px; top: 0px;

View File

@ -81,6 +81,8 @@ type RemoteType = {
remotevars : Record<string, string>, remotevars : Record<string, string>,
status : string, status : string,
errorstr : string, errorstr : string,
installstatus : string,
installerrorstr : string,
defaultstate : RemoteStateType, defaultstate : RemoteStateType,
connectmode : string, connectmode : string,
autoinstall : boolean, autoinstall : boolean,