diff --git a/src/main.tsx b/src/main.tsx index 7a66cdd5..4df06ea9 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -777,10 +777,13 @@ class InfoMsg extends React.Component<{}, {}> { -
+
+ +
input is only allowed while status is 'connecting'
+
0}> diff --git a/src/model.ts b/src/model.ts index 0010b7d0..13cba520 100644 --- a/src/model.ts +++ b/src/model.ts @@ -637,6 +637,8 @@ class InputModel { infoMsg : OV = mobx.observable.box(null); infoTimeoutId : any = null; remoteTermWrap : TermWrap; + showNoInputMsg : OV = mobx.observable.box(false); + showNoInputTimeoutId : any = null; constructor() { this.filteredHistoryItems = mobx.computed(() => { @@ -644,6 +646,22 @@ class InputModel { }); } + setShowNoInputMsg(val : boolean) { + mobx.action(() => { + if (this.showNoInputTimeoutId != null) { + clearTimeout(this.showNoInputTimeoutId); + this.showNoInputTimeoutId = null; + } + if (val) { + this.showNoInputMsg.set(true); + this.showNoInputTimeoutId = setTimeout(() => this.setShowNoInputMsg(false), 2000); + } + else { + this.showNoInputMsg.set(false); + } + })(); + } + _focusCmdInput() : void { let elem = document.getElementById("main-cmd-input"); if (elem != null) { @@ -1108,6 +1126,14 @@ class InputModel { } termKeyHandler(remoteId : string, event : any) : void { + let remote = GlobalModel.getRemote(remoteId); + if (remote == null) { + return; + } + if (remote.status != "connecting") { + this.setShowNoInputMsg(true); + return; + } let inputPacket : RemoteInputPacketType = { type: "remoteinput", remoteid: remoteId, diff --git a/src/sh2.less b/src/sh2.less index 8b641490..9bd438eb 100644 --- a/src/sh2.less +++ b/src/sh2.less @@ -411,6 +411,7 @@ html, body, #main { .cmd-input-info { .terminal-wrapper { + position: relative; background-color: #000; padding: 2px 10px 5px 4px; margin: 5px 5px 10px 5px; @@ -418,6 +419,18 @@ html, body, #main { &.focus { box-shadow: 0 0 3px 3px rgba(255, 255, 255, 0.3); } + + .term-tag { + position: absolute; + top: 0; + right: 0; + background-color: @term-red; + color: white; + z-index: 10; + font-size: 10px; + padding: 4px; + font-family: 'JetBrains Mono', monospace; + } } }