diff --git a/src/model.ts b/src/model.ts index d20b9976e..9d5831505 100644 --- a/src/model.ts +++ b/src/model.ts @@ -1369,6 +1369,9 @@ class Model { if ("window" in update) { this.updateWindow(update.window, false); } + if ("remotes" in update) { + this.updateRemote(update.remotes); + } if (interactive && "info" in update) { let info : InfoType = update.info; this.inputModel.flashInfoMsg(info, info.timeoutms); @@ -1384,6 +1387,10 @@ class Model { // console.log("run-update>", Date.now(), interactive, update); } + updateRemote(remotes : RemoteType[]) : void { + genMergeSimpleData(this.remotes, remotes, (r) => r.remoteid, null); + } + getActiveSession() : Session { return this.getSessionById(this.activeSessionId.get()); } @@ -1610,7 +1617,7 @@ class Model { let url = new URL("http://localhost:8080/api/get-remotes"); fetch(url).then((resp) => handleJsonFetchResponse(url, resp)).then((data) => { mobx.action(() => { - this.remotes.replace(data.data || []) + this.runUpdate(data.data, false); this.remotesLoaded.set(true); })(); }).catch((err) => { diff --git a/src/sh2.less b/src/sh2.less index 32b24b323..a9812016a 100644 --- a/src/sh2.less +++ b/src/sh2.less @@ -687,15 +687,15 @@ body .xterm .xterm-viewport { .history-line { white-space: pre; - margin-left: 58px; // 8px per char + margin-left: 58px; // 7.2px } &.show-remotes .history-line { - margin-left: 174px; + margin-left: 173px; } &.show-remotes.show-sessions .history-line { - margin-left: 294px; + margin-left: 295px; } .history-item.history-haderror { diff --git a/src/types.ts b/src/types.ts index 2d799ed77..eff669a8b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -79,6 +79,7 @@ type RemoteType = { status : string, defaultstate : RemoteStateType, connectmode : string, + remove? : boolean, }; type RemoteStateType = { @@ -215,7 +216,7 @@ type ModelUpdateType = { cmd? : CmdDataType, info? : InfoType, cmdline? : CmdLineUpdateType, - remote? : RemoteType, + remotes? : RemoteType[], history? : HistoryInfoType, };