diff --git a/src/app/common/common.tsx b/src/app/common/common.tsx index b329b4ee..935f392a 100644 --- a/src/app/common/common.tsx +++ b/src/app/common/common.tsx @@ -12,6 +12,7 @@ import { If } from "tsx-control-statements/components"; import { RemoteType, StatusIndicatorLevel } from "../../types/types"; import ReactDOM from "react-dom"; import { GlobalModel } from "../../model/model"; +import * as appconst from "../appconst"; import { ReactComponent as CheckIcon } from "../assets/icons/line/check.svg"; import { ReactComponent as CopyIcon } from "../assets/icons/history/copy.svg"; @@ -1247,8 +1248,8 @@ class Modal extends React.Component { } interface StatusIndicatorProps { - level: StatusIndicatorLevel - className?: string + level: StatusIndicatorLevel; + className?: string; } class StatusIndicator extends React.Component { @@ -1268,12 +1269,37 @@ class StatusIndicator extends React.Component { statusIndicatorClass = "error"; break; } - statusIndicator =
; + statusIndicator = ( +
+ ); } return statusIndicator; } } +function ShowWaveShellInstallPrompt(callbackFn: () => void) { + let message: string = ` +In order to use Wave's advanced features like unified history and persistent sessions, Wave installs a small, open-source helper program called WaveShell on your remote machine. WaveShell does not open any external ports and only communicates with your *local* Wave terminal instance over ssh. For more information please see [the docs](https://docs.waveterm.dev/reference/waveshell). + `; + message = message.trim(); + let prtn = GlobalModel.showAlert({ + message: message, + confirm: true, + markdown: true, + confirmflag: appconst.ConfirmKey_HideShellPrompt, + }); + prtn.then((confirm) => { + if (!confirm) { + return; + } + if (callbackFn) { + callbackFn(); + } + }); +} + export { CmdStrCode, Toggle, @@ -1296,4 +1322,5 @@ export { Status, Modal, StatusIndicator, + ShowWaveShellInstallPrompt, }; diff --git a/src/app/common/modals/createremoteconn.tsx b/src/app/common/modals/createremoteconn.tsx index 90e197d5..69c0b3e0 100644 --- a/src/app/common/modals/createremoteconn.tsx +++ b/src/app/common/modals/createremoteconn.tsx @@ -8,7 +8,7 @@ import { boundMethod } from "autobind-decorator"; import { If } from "tsx-control-statements/components"; import { GlobalModel, GlobalCommandRunner, RemotesModel } from "../../../model/model"; import * as T from "../../../types/types"; -import { Modal, TextField, NumberField, InputDecoration, Dropdown, PasswordField, Tooltip } from "../common"; +import { Modal, TextField, NumberField, InputDecoration, Dropdown, PasswordField, Tooltip, ShowWaveShellInstallPrompt } from "../common"; import * as util from "../../../util/util"; import * as appconst from "../../appconst"; @@ -69,23 +69,7 @@ class CreateRemoteConnModal extends React.Component<{}, {}> { @boundMethod handleOk(): void { - this.showShellPrompt(this.submitRemote); - } - - @boundMethod - showShellPrompt(cb: () => void): void { - let prtn = GlobalModel.showAlert({ - message: - "You are about to install WaveShell on a remote machine. Please be aware that WaveShell will be executed on the remote system.", - confirm: true, - confirmflag: appconst.ConfirmKey_HideShellPrompt, - }); - prtn.then((confirm) => { - if (!confirm) { - return; - } - cb(); - }); + ShowWaveShellInstallPrompt(this.submitRemote); } @boundMethod diff --git a/src/app/common/modals/modals.tsx b/src/app/common/modals/modals.tsx index c8f58c0d..fb3010e6 100644 --- a/src/app/common/modals/modals.tsx +++ b/src/app/common/modals/modals.tsx @@ -24,6 +24,7 @@ import { Button, Status, Checkbox, + ShowWaveShellInstallPrompt, } from "../common"; import * as util from "../../../util/util"; import * as textmeasure from "../../../util/textmeasure"; @@ -549,23 +550,7 @@ class CreateRemoteConnModal extends React.Component<{}, {}> { @boundMethod handleOk(): void { - this.showShellPrompt(this.submitRemote); - } - - @boundMethod - showShellPrompt(cb: () => void): void { - let prtn = GlobalModel.showAlert({ - message: - "You are about to install WaveShell on a remote machine. Please be aware that WaveShell will be executed on the remote system.", - confirm: true, - confirmflag: appconst.ConfirmKey_HideShellPrompt, - }); - prtn.then((confirm) => { - if (!confirm) { - return; - } - cb(); - }); + ShowWaveShellInstallPrompt(this.submitRemote); } @boundMethod diff --git a/src/app/connections/connections.tsx b/src/app/connections/connections.tsx index 2da67322..b7e37e7c 100644 --- a/src/app/connections/connections.tsx +++ b/src/app/connections/connections.tsx @@ -8,7 +8,7 @@ import { boundMethod } from "autobind-decorator"; import { If, For } from "tsx-control-statements/components"; import cn from "classnames"; import { GlobalModel, RemotesModel, GlobalCommandRunner } from "../../model/model"; -import { Button, IconButton, Status } from "../common/common"; +import { Button, IconButton, Status, ShowWaveShellInstallPrompt } from "../common/common"; import * as T from "../../types/types"; import * as util from "../../util/util"; import * as appconst from "../appconst"; @@ -81,23 +81,7 @@ class ConnectionsView extends React.Component<{ model: RemotesModel }, { hovered @boundMethod handleImportSshConfig(): void { - this.showShellPrompt(this.importSshConfig); - } - - @boundMethod - showShellPrompt(cb: () => void): void { - let prtn = GlobalModel.showAlert({ - message: - "You are about to install WaveShell on a remote machine. Please be aware that WaveShell will be executed on the remote system.", - confirm: true, - confirmflag: appconst.ConfirmKey_HideShellPrompt, - }); - prtn.then((confirm) => { - if (!confirm) { - return; - } - cb(); - }); + ShowWaveShellInstallPrompt(this.importSshConfig); } @boundMethod