mirror of
https://github.com/wavetermdev/backup.git
synced 2026-08-05 13:57:07 -07:00
remove autoinstall options from GUI, always set autoinstall flag, db migration to set autoinstall for all remotes (#48)
This commit is contained in:
@@ -153,7 +153,6 @@ class CreateRemote extends React.Component<{ model: RemotesModalModel; remoteEdi
|
|||||||
tempManualMode: OV<boolean>;
|
tempManualMode: OV<boolean>;
|
||||||
tempPassword: OV<string>;
|
tempPassword: OV<string>;
|
||||||
tempKeyFile: OV<string>;
|
tempKeyFile: OV<string>;
|
||||||
tempAutoInstall: OV<boolean>;
|
|
||||||
errorStr: OV<string>;
|
errorStr: OV<string>;
|
||||||
|
|
||||||
constructor(props: any) {
|
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.tempConnectMode = mobx.observable.box("auto", { name: "CreateRemote-connectMode" });
|
||||||
this.tempKeyFile = mobx.observable.box("", { name: "CreateRemote-keystr" });
|
this.tempKeyFile = mobx.observable.box("", { name: "CreateRemote-keystr" });
|
||||||
this.tempPassword = mobx.observable.box("", { name: "CreateRemote-password" });
|
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" });
|
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["password"] = "";
|
||||||
}
|
}
|
||||||
kwargs["connectmode"] = this.tempConnectMode.get();
|
kwargs["connectmode"] = this.tempConnectMode.get();
|
||||||
kwargs["autoinstall"] = this.tempAutoInstall.get() ? "1" : "0";
|
|
||||||
kwargs["visual"] = "1";
|
kwargs["visual"] = "1";
|
||||||
kwargs["submit"] = "1";
|
kwargs["submit"] = "1";
|
||||||
let model = this.props.model;
|
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() {
|
render() {
|
||||||
let { model, remoteEdit } = this.props;
|
let { model, remoteEdit } = this.props;
|
||||||
let authMode = this.tempAuthMode.get();
|
let authMode = this.tempAuthMode.get();
|
||||||
@@ -438,19 +428,6 @@ class CreateRemote extends React.Component<{ model: RemotesModalModel; remoteEdi
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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())}>
|
<If condition={!util.isBlank(this.getErrorStr())}>
|
||||||
<div className="settings-field settings-error">Error: {this.getErrorStr()}</div>
|
<div className="settings-field settings-error">Error: {this.getErrorStr()}</div>
|
||||||
</If>
|
</If>
|
||||||
@@ -484,7 +461,6 @@ class EditRemoteSettings extends React.Component<
|
|||||||
tempManualMode: OV<boolean>;
|
tempManualMode: OV<boolean>;
|
||||||
tempPassword: OV<string>;
|
tempPassword: OV<string>;
|
||||||
tempKeyFile: OV<string>;
|
tempKeyFile: OV<string>;
|
||||||
tempAutoInstall: OV<boolean>;
|
|
||||||
|
|
||||||
constructor(props: any) {
|
constructor(props: any) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -496,7 +472,6 @@ class EditRemoteSettings extends React.Component<
|
|||||||
this.tempPassword = mobx.observable.box(remoteEdit.haspassword ? PasswordUnchangedSentinel : "", {
|
this.tempPassword = mobx.observable.box(remoteEdit.haspassword ? PasswordUnchangedSentinel : "", {
|
||||||
name: "EditRemoteSettings-password",
|
name: "EditRemoteSettings-password",
|
||||||
});
|
});
|
||||||
this.tempAutoInstall = mobx.observable.box(!!remote.autoinstall, { name: "EditRemoteSettings-autoinstall" });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
@@ -552,13 +527,6 @@ class EditRemoteSettings extends React.Component<
|
|||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
@boundMethod
|
|
||||||
handleChangeAutoInstall(val: boolean): void {
|
|
||||||
mobx.action(() => {
|
|
||||||
this.tempAutoInstall.set(val);
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
|
|
||||||
@boundMethod
|
@boundMethod
|
||||||
canResetPw(): boolean {
|
canResetPw(): boolean {
|
||||||
let { remoteEdit } = this.props;
|
let { remoteEdit } = this.props;
|
||||||
@@ -609,9 +577,6 @@ class EditRemoteSettings extends React.Component<
|
|||||||
if (!util.isStrEq(this.tempConnectMode.get(), remote.connectmode)) {
|
if (!util.isStrEq(this.tempConnectMode.get(), remote.connectmode)) {
|
||||||
kwargs["connectmode"] = this.tempConnectMode.get();
|
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) {
|
if (Object.keys(kwargs).length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -758,19 +723,6 @@ class EditRemoteSettings extends React.Component<
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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-field mt-3">
|
||||||
<div className="settings-label">Actions</div>
|
<div className="settings-label">Actions</div>
|
||||||
<div className="settings-input">
|
<div className="settings-input">
|
||||||
@@ -891,9 +843,6 @@ class RemoteDetailView extends React.Component<{ model: RemotesModalModel; remot
|
|||||||
if (statusStr == null) {
|
if (statusStr == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (remote.autoinstall) {
|
|
||||||
statusStr = statusStr + " (autoinstall)";
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<div key="install-status" className="settings-field">
|
<div key="install-status" className="settings-field">
|
||||||
<div className="settings-label"> Install Status</div>
|
<div className="settings-label"> Install Status</div>
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
-- no down migration
|
||||||
@@ -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))
|
err := fmt.Errorf("invalid connectmode %q: valid modes are %s", connectMode, formatStrs([]string{sstore.ConnectModeStartup, sstore.ConnectModeAuto, sstore.ConnectModeManual}, "or", false))
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
autoInstall := resolveBool(pk.Kwargs["autoinstall"], true)
|
|
||||||
keyFile, err := resolveFile(pk.Kwargs["key"])
|
keyFile, err := resolveFile(pk.Kwargs["key"])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("invalid ssh keyfile %q: %v", pk.Kwargs["key"], err)
|
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
|
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 _, found := pk.Kwargs["key"]; found {
|
||||||
if isLocal {
|
if isLocal {
|
||||||
return nil, fmt.Errorf("Cannot edit ssh key file for 'local' remote")
|
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,
|
SSHOpts: sshOpts,
|
||||||
ConnectMode: connectMode,
|
ConnectMode: connectMode,
|
||||||
Alias: alias,
|
Alias: alias,
|
||||||
AutoInstall: autoInstall,
|
AutoInstall: true,
|
||||||
CanonicalName: canonicalName,
|
CanonicalName: canonicalName,
|
||||||
SSHKeyFile: keyFile,
|
SSHKeyFile: keyFile,
|
||||||
SSHPassword: sshPassword,
|
SSHPassword: sshPassword,
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"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/base"
|
||||||
"github.com/wavetermdev/waveterm/waveshell/pkg/packet"
|
"github.com/wavetermdev/waveterm/waveshell/pkg/packet"
|
||||||
"github.com/wavetermdev/waveterm/waveshell/pkg/shexec"
|
"github.com/wavetermdev/waveterm/waveshell/pkg/shexec"
|
||||||
"github.com/wavetermdev/waveterm/wavesrv/pkg/dbutil"
|
"github.com/wavetermdev/waveterm/wavesrv/pkg/dbutil"
|
||||||
"github.com/wavetermdev/waveterm/wavesrv/pkg/scbase"
|
"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"
|
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 (
|
const (
|
||||||
RemoteField_Alias = "alias" // string
|
RemoteField_Alias = "alias" // string
|
||||||
RemoteField_ConnectMode = "connectmode" // string
|
RemoteField_ConnectMode = "connectmode" // string
|
||||||
RemoteField_AutoInstall = "autoinstall" // bool
|
|
||||||
RemoteField_SSHKey = "sshkey" // string
|
RemoteField_SSHKey = "sshkey" // string
|
||||||
RemoteField_SSHPassword = "sshpassword" // string
|
RemoteField_SSHPassword = "sshpassword" // string
|
||||||
RemoteField_Color = "color" // 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 = ?`
|
query = `UPDATE remote SET connectmode = ? WHERE remoteid = ?`
|
||||||
tx.Exec(query, mode, 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 {
|
if sshKey, found := editMap[RemoteField_SSHKey]; found {
|
||||||
query = `UPDATE remote SET sshopts = json_set(sshopts, '$.sshidentity', ?) WHERE remoteid = ?`
|
query = `UPDATE remote SET sshopts = json_set(sshopts, '$.sshidentity', ?) WHERE remoteid = ?`
|
||||||
tx.Exec(query, sshKey, remoteId)
|
tx.Exec(query, sshKey, remoteId)
|
||||||
|
|||||||
@@ -11,16 +11,16 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
sh2db "github.com/wavetermdev/waveterm/wavesrv/db"
|
|
||||||
_ "github.com/golang-migrate/migrate/v4/database/sqlite3"
|
_ "github.com/golang-migrate/migrate/v4/database/sqlite3"
|
||||||
_ "github.com/golang-migrate/migrate/v4/source/file"
|
_ "github.com/golang-migrate/migrate/v4/source/file"
|
||||||
"github.com/golang-migrate/migrate/v4/source/iofs"
|
"github.com/golang-migrate/migrate/v4/source/iofs"
|
||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
|
sh2db "github.com/wavetermdev/waveterm/wavesrv/db"
|
||||||
|
|
||||||
"github.com/golang-migrate/migrate/v4"
|
"github.com/golang-migrate/migrate/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MaxMigration = 22
|
const MaxMigration = 23
|
||||||
const MigratePrimaryScreenVersion = 9
|
const MigratePrimaryScreenVersion = 9
|
||||||
const CmdScreenSpecialMigration = 13
|
const CmdScreenSpecialMigration = 13
|
||||||
const CmdLineSpecialMigration = 20
|
const CmdLineSpecialMigration = 20
|
||||||
|
|||||||
Reference in New Issue
Block a user