From 51ee7bef6195a89cdcfa3cc7a736189c0165ce5f Mon Sep 17 00:00:00 2001 From: Sylvie Crowe <107814465+oneirocosm@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:11:12 -0800 Subject: [PATCH] Shellpref for sshconfig import (#270) --- src/app/common/modals/editremoteconn.less | 6 ++++ src/app/common/modals/editremoteconn.tsx | 33 +++++++++++++++++-- src/app/common/modals/modals.tsx | 11 ------- .../common/modals/viewremoteconndetail.tsx | 11 ------- wavesrv/pkg/cmdrunner/cmdrunner.go | 16 ++++++--- 5 files changed, 48 insertions(+), 29 deletions(-) diff --git a/src/app/common/modals/editremoteconn.less b/src/app/common/modals/editremoteconn.less index ad954ff39..bb98eb3d6 100644 --- a/src/app/common/modals/editremoteconn.less +++ b/src/app/common/modals/editremoteconn.less @@ -20,6 +20,12 @@ width: 100%; } + .import-edit-warning { + display: flex; + flex-direction: row; + align-items: flex-start; + } + .name-actions-section { margin-bottom: 10px; display: flex; diff --git a/src/app/common/modals/editremoteconn.tsx b/src/app/common/modals/editremoteconn.tsx index 6502aa191..930a306ad 100644 --- a/src/app/common/modals/editremoteconn.tsx +++ b/src/app/common/modals/editremoteconn.tsx @@ -58,6 +58,10 @@ class EditRemoteConnModal extends React.Component<{}, {}> { return this.selectedRemote?.local; } + isImportedRemote(): boolean { + return this.selectedRemote?.sshconfigsrc == "sshconfig-import"; + } + componentDidMount(): void { mobx.action(() => { this.tempAlias.set(this.selectedRemote?.remotealias); @@ -259,6 +263,27 @@ class EditRemoteConnModal extends React.Component<{}, {}> { ); } + renderImportedRemoteEditWarning() { + return ( +
+ + Most options for connections imported from an ssh config file cannot be edited. For these + changes, you must edit the config file and import it again. The shell preference can be + edited, but will return to the default if you import again. It will stay changed if you + follow this procedure. + + } + icon={} + > + + +  SSH Config Import Behavior +
+ ); + } + renderAuthMode() { let authMode = this.tempAuthMode.get(); return ( @@ -344,6 +369,7 @@ class EditRemoteConnModal extends React.Component<{}, {}> { return null; } let isLocal = this.isLocalRemote(); + let isImported = this.isImportedRemote(); return ( @@ -351,9 +377,10 @@ class EditRemoteConnModal extends React.Component<{}, {}> {
{util.getRemoteName(this.selectedRemote)}
- {this.renderAlias()} - {this.renderAuthMode()} - {this.renderConnectMode()} + {this.renderAlias()} + {this.renderAuthMode()} + {this.renderConnectMode()} + {this.renderImportedRemoteEditWarning()} {this.renderShellPref()}
Error: {this.remoteEdit?.errorstr}
diff --git a/src/app/common/modals/modals.tsx b/src/app/common/modals/modals.tsx index fb3010e6b..e154296bf 100644 --- a/src/app/common/modals/modals.tsx +++ b/src/app/common/modals/modals.tsx @@ -1026,17 +1026,6 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> { cancelInstallButton = <>; } if (remote.sshconfigsrc == "sshconfig-import") { - updateAuthButton = ( - - ); archiveButton = ( - ); archiveButton = (