mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-03 18:47:56 +01:00
remove autoinstall options from GUI, always set autoinstall flag, db migration to set autoinstall for all remotes (#48)
This commit is contained in:
parent
736fb7be6a
commit
267b035fc8
@ -153,7 +153,6 @@ class CreateRemote extends React.Component<{ model: RemotesModalModel; remoteEdi
|
||||
tempManualMode: OV<boolean>;
|
||||
tempPassword: OV<string>;
|
||||
tempKeyFile: OV<string>;
|
||||
tempAutoInstall: OV<boolean>;
|
||||
errorStr: OV<string>;
|
||||
|
||||
constructor(props: any) {
|
||||
@ -166,7 +165,6 @@ class CreateRemote extends React.Component<{ model: RemotesModalModel; remoteEdi
|
||||
this.tempConnectMode = mobx.observable.box("auto", { name: "CreateRemote-connectMode" });
|
||||
this.tempKeyFile = mobx.observable.box("", { name: "CreateRemote-keystr" });
|
||||
this.tempPassword = mobx.observable.box("", { name: "CreateRemote-password" });
|
||||
this.tempAutoInstall = mobx.observable.box(true, { name: "CreateRemote-autoinstall" });
|
||||
this.errorStr = mobx.observable.box(remoteEdit.errorstr, { name: "CreateRemote-errorStr" });
|
||||
}
|
||||
|
||||
@ -223,7 +221,6 @@ class CreateRemote extends React.Component<{ model: RemotesModalModel; remoteEdi
|
||||
kwargs["password"] = "";
|
||||
}
|
||||
kwargs["connectmode"] = this.tempConnectMode.get();
|
||||
kwargs["autoinstall"] = this.tempAutoInstall.get() ? "1" : "0";
|
||||
kwargs["visual"] = "1";
|
||||
kwargs["submit"] = "1";
|
||||
let model = this.props.model;
|
||||
@ -286,13 +283,6 @@ class CreateRemote extends React.Component<{ model: RemotesModalModel; remoteEdi
|
||||
})();
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
handleChangeAutoInstall(val: boolean): void {
|
||||
mobx.action(() => {
|
||||
this.tempAutoInstall.set(val);
|
||||
})();
|
||||
}
|
||||
|
||||
render() {
|
||||
let { model, remoteEdit } = this.props;
|
||||
let authMode = this.tempAuthMode.get();
|
||||
@ -438,19 +428,6 @@ class CreateRemote extends React.Component<{ model: RemotesModalModel; remoteEdi
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="settings-field" style={{ marginTop: 10 }}>
|
||||
<div className="settings-label">
|
||||
<div>Auto Install</div>
|
||||
<div className="flex-spacer" />
|
||||
<InfoMessage width={350}>
|
||||
If selected, will try to auto-install the mshell client if it is not installed or out of
|
||||
date.
|
||||
</InfoMessage>
|
||||
</div>
|
||||
<div className="settings-input">
|
||||
<Toggle checked={this.tempAutoInstall.get()} onChange={this.handleChangeAutoInstall} />
|
||||
</div>
|
||||
</div>
|
||||
<If condition={!util.isBlank(this.getErrorStr())}>
|
||||
<div className="settings-field settings-error">Error: {this.getErrorStr()}</div>
|
||||
</If>
|
||||
@ -484,7 +461,6 @@ class EditRemoteSettings extends React.Component<
|
||||
tempManualMode: OV<boolean>;
|
||||
tempPassword: OV<string>;
|
||||
tempKeyFile: OV<string>;
|
||||
tempAutoInstall: OV<boolean>;
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
@ -496,7 +472,6 @@ class EditRemoteSettings extends React.Component<
|
||||
this.tempPassword = mobx.observable.box(remoteEdit.haspassword ? PasswordUnchangedSentinel : "", {
|
||||
name: "EditRemoteSettings-password",
|
||||
});
|
||||
this.tempAutoInstall = mobx.observable.box(!!remote.autoinstall, { name: "EditRemoteSettings-autoinstall" });
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
@ -552,13 +527,6 @@ class EditRemoteSettings extends React.Component<
|
||||
})();
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
handleChangeAutoInstall(val: boolean): void {
|
||||
mobx.action(() => {
|
||||
this.tempAutoInstall.set(val);
|
||||
})();
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
canResetPw(): boolean {
|
||||
let { remoteEdit } = this.props;
|
||||
@ -609,9 +577,6 @@ class EditRemoteSettings extends React.Component<
|
||||
if (!util.isStrEq(this.tempConnectMode.get(), remote.connectmode)) {
|
||||
kwargs["connectmode"] = this.tempConnectMode.get();
|
||||
}
|
||||
if (!util.isBoolEq(this.tempAutoInstall.get(), remote.autoinstall)) {
|
||||
kwargs["autoinstall"] = this.tempAutoInstall.get() ? "1" : "0";
|
||||
}
|
||||
if (Object.keys(kwargs).length == 0) {
|
||||
return;
|
||||
}
|
||||
@ -758,19 +723,6 @@ class EditRemoteSettings extends React.Component<
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="settings-field" style={{ marginTop: 10 }}>
|
||||
<div className="settings-label">
|
||||
<div>Auto Install</div>
|
||||
<div className="flex-spacer" />
|
||||
<InfoMessage width={350}>
|
||||
If selected, will try to auto-install the mshell client if it is not installed or out of
|
||||
date.
|
||||
</InfoMessage>
|
||||
</div>
|
||||
<div className="settings-input">
|
||||
<Toggle checked={this.tempAutoInstall.get()} onChange={this.handleChangeAutoInstall} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="settings-field mt-3">
|
||||
<div className="settings-label">Actions</div>
|
||||
<div className="settings-input">
|
||||
@ -891,9 +843,6 @@ class RemoteDetailView extends React.Component<{ model: RemotesModalModel; remot
|
||||
if (statusStr == null) {
|
||||
return null;
|
||||
}
|
||||
if (remote.autoinstall) {
|
||||
statusStr = statusStr + " (autoinstall)";
|
||||
}
|
||||
return (
|
||||
<div key="install-status" className="settings-field">
|
||||
<div className="settings-label"> Install Status</div>
|
||||
|
1
wavesrv/db/migrations/000023_autoinstall.down.sql
Normal file
1
wavesrv/db/migrations/000023_autoinstall.down.sql
Normal file
@ -0,0 +1 @@
|
||||
-- no down migration
|
1
wavesrv/db/migrations/000023_autoinstall.up.sql
Normal file
1
wavesrv/db/migrations/000023_autoinstall.up.sql
Normal file
@ -0,0 +1 @@
|
||||
UPDATE remote SET autoinstall = 1;
|
@ -1047,7 +1047,6 @@ func parseRemoteEditArgs(isNew bool, pk *scpacket.FeCommandPacketType, isLocal b
|
||||
err := fmt.Errorf("invalid connectmode %q: valid modes are %s", connectMode, formatStrs([]string{sstore.ConnectModeStartup, sstore.ConnectModeAuto, sstore.ConnectModeManual}, "or", false))
|
||||
return nil, err
|
||||
}
|
||||
autoInstall := resolveBool(pk.Kwargs["autoinstall"], true)
|
||||
keyFile, err := resolveFile(pk.Kwargs["key"])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invalid ssh keyfile %q: %v", pk.Kwargs["key"], err)
|
||||
@ -1076,9 +1075,6 @@ func parseRemoteEditArgs(isNew bool, pk *scpacket.FeCommandPacketType, isLocal b
|
||||
}
|
||||
editMap[sstore.RemoteField_ConnectMode] = connectMode
|
||||
}
|
||||
if _, found := pk.Kwargs[sstore.RemoteField_AutoInstall]; found {
|
||||
editMap[sstore.RemoteField_AutoInstall] = autoInstall
|
||||
}
|
||||
if _, found := pk.Kwargs["key"]; found {
|
||||
if isLocal {
|
||||
return nil, fmt.Errorf("Cannot edit ssh key file for 'local' remote")
|
||||
@ -1099,7 +1095,7 @@ func parseRemoteEditArgs(isNew bool, pk *scpacket.FeCommandPacketType, isLocal b
|
||||
SSHOpts: sshOpts,
|
||||
ConnectMode: connectMode,
|
||||
Alias: alias,
|
||||
AutoInstall: autoInstall,
|
||||
AutoInstall: true,
|
||||
CanonicalName: canonicalName,
|
||||
SSHKeyFile: keyFile,
|
||||
SSHPassword: sshPassword,
|
||||
|
@ -13,14 +13,14 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/sawka/txwrap"
|
||||
"github.com/wavetermdev/waveterm/waveshell/pkg/base"
|
||||
"github.com/wavetermdev/waveterm/waveshell/pkg/packet"
|
||||
"github.com/wavetermdev/waveterm/waveshell/pkg/shexec"
|
||||
"github.com/wavetermdev/waveterm/wavesrv/pkg/dbutil"
|
||||
"github.com/wavetermdev/waveterm/wavesrv/pkg/scbase"
|
||||
"github.com/google/uuid"
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/sawka/txwrap"
|
||||
)
|
||||
|
||||
const HistoryCols = "h.historyid, h.ts, h.userid, h.sessionid, h.screenid, h.lineid, h.haderror, h.cmdstr, h.remoteownerid, h.remoteid, h.remotename, h.ismetacmd, h.incognito, h.linenum"
|
||||
@ -1644,7 +1644,6 @@ func GetSessionStats(ctx context.Context, sessionId string) (*SessionStatsType,
|
||||
const (
|
||||
RemoteField_Alias = "alias" // string
|
||||
RemoteField_ConnectMode = "connectmode" // string
|
||||
RemoteField_AutoInstall = "autoinstall" // bool
|
||||
RemoteField_SSHKey = "sshkey" // string
|
||||
RemoteField_SSHPassword = "sshpassword" // string
|
||||
RemoteField_Color = "color" // string
|
||||
@ -1670,10 +1669,6 @@ func UpdateRemote(ctx context.Context, remoteId string, editMap map[string]inter
|
||||
query = `UPDATE remote SET connectmode = ? WHERE remoteid = ?`
|
||||
tx.Exec(query, mode, remoteId)
|
||||
}
|
||||
if autoInstall, found := editMap[RemoteField_AutoInstall]; found {
|
||||
query = `UPDATE remote SET autoinstall = ? WHERE remoteid = ?`
|
||||
tx.Exec(query, autoInstall, remoteId)
|
||||
}
|
||||
if sshKey, found := editMap[RemoteField_SSHKey]; found {
|
||||
query = `UPDATE remote SET sshopts = json_set(sshopts, '$.sshidentity', ?) WHERE remoteid = ?`
|
||||
tx.Exec(query, sshKey, remoteId)
|
||||
|
@ -11,16 +11,16 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
sh2db "github.com/wavetermdev/waveterm/wavesrv/db"
|
||||
_ "github.com/golang-migrate/migrate/v4/database/sqlite3"
|
||||
_ "github.com/golang-migrate/migrate/v4/source/file"
|
||||
"github.com/golang-migrate/migrate/v4/source/iofs"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
sh2db "github.com/wavetermdev/waveterm/wavesrv/db"
|
||||
|
||||
"github.com/golang-migrate/migrate/v4"
|
||||
)
|
||||
|
||||
const MaxMigration = 22
|
||||
const MaxMigration = 23
|
||||
const MigratePrimaryScreenVersion = 9
|
||||
const CmdScreenSpecialMigration = 13
|
||||
const CmdLineSpecialMigration = 20
|
||||
|
Loading…
Reference in New Issue
Block a user