mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
Connection Screen Terminal "Flash" Making it Impossible to Enter Manual Passwords (#217)
* fix flashing view modal * cleanup * fix name typo, also unset setRecentConnAdded once the modal is open
This commit is contained in:
parent
e1e5b67ff6
commit
f6a6068674
@ -558,26 +558,33 @@ class CreateRemoteConnModal extends React.Component<{}, {}> {
|
||||
kwargs["connectmode"] = this.tempConnectMode.get();
|
||||
kwargs["visual"] = "1";
|
||||
kwargs["submit"] = "1";
|
||||
let model = this.model;
|
||||
let prtn = GlobalCommandRunner.createRemote(cname, kwargs, false);
|
||||
prtn.then((crtn) => {
|
||||
if (crtn.success) {
|
||||
this.model.setRecentConnAdded(true);
|
||||
this.model.closeModal();
|
||||
|
||||
let crRtn = GlobalCommandRunner.screenSetRemote(cname, true, false);
|
||||
crRtn.then((crcrtn) => {
|
||||
if (crcrtn.success) {
|
||||
return;
|
||||
}
|
||||
mobx.action(() => {
|
||||
this.errorStr.set(crcrtn.error ?? null);
|
||||
this.errorStr.set(crcrtn.error);
|
||||
})();
|
||||
});
|
||||
return;
|
||||
}
|
||||
mobx.action(() => {
|
||||
this.errorStr.set(crtn.error ?? null);
|
||||
this.errorStr.set(crtn.error);
|
||||
})();
|
||||
});
|
||||
model.seRecentConnAdded(true);
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
handleClose(): void {
|
||||
this.model.closeModal();
|
||||
this.model.setRecentConnAdded(false);
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
@ -795,7 +802,7 @@ class CreateRemoteConnModal extends React.Component<{}, {}> {
|
||||
<div className="settings-field settings-error">Error: {this.getErrorStr()}</div>
|
||||
</If>
|
||||
</div>
|
||||
<Modal.Footer onCancel={this.model.closeModal} onOk={this.submitRemote} okLabel="Connect" />
|
||||
<Modal.Footer onCancel={this.handleClose} onOk={this.submitRemote} okLabel="Connect" />
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
@ -812,7 +819,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> {
|
||||
}
|
||||
|
||||
@mobx.computed
|
||||
get selectedRemote(): T.RemoteType {
|
||||
getSelectedRemote(): T.RemoteType {
|
||||
const selectedRemoteId = this.model.selectedRemoteId.get();
|
||||
return GlobalModel.getRemote(selectedRemoteId);
|
||||
}
|
||||
@ -827,7 +834,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> {
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
if (this.selectedRemote == null || this.selectedRemote.archived) {
|
||||
if (this.getSelectedRemote() == null || this.getSelectedRemote().archived) {
|
||||
this.model.deSelectRemote();
|
||||
}
|
||||
}
|
||||
@ -891,7 +898,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> {
|
||||
|
||||
@boundMethod
|
||||
clickArchive(): void {
|
||||
if (this.selectedRemote && this.selectedRemote.status == "connected") {
|
||||
if (this.getSelectedRemote() && this.getSelectedRemote().status == "connected") {
|
||||
GlobalModel.showAlert({ message: "Cannot delete when connected. Disconnect and try again." });
|
||||
return;
|
||||
}
|
||||
@ -903,21 +910,22 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> {
|
||||
if (!confirm) {
|
||||
return;
|
||||
}
|
||||
if (this.selectedRemote) {
|
||||
GlobalCommandRunner.archiveRemote(this.selectedRemote.remoteid);
|
||||
if (this.getSelectedRemote()) {
|
||||
GlobalCommandRunner.archiveRemote(this.getSelectedRemote().remoteid);
|
||||
}
|
||||
GlobalModel.modalsModel.popModal();
|
||||
});
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
clickReinstall(): void {
|
||||
GlobalCommandRunner.installRemote(this.selectedRemote?.remoteid);
|
||||
GlobalCommandRunner.installRemote(this.getSelectedRemote().remoteid);
|
||||
}
|
||||
|
||||
@boundMethod
|
||||
handleClose(): void {
|
||||
this.model.closeModal();
|
||||
this.model.seRecentConnAdded(false);
|
||||
this.model.setRecentConnAdded(false);
|
||||
}
|
||||
|
||||
renderInstallStatus(remote: T.RemoteType): any {
|
||||
@ -1078,7 +1086,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> {
|
||||
}
|
||||
|
||||
render() {
|
||||
let remote = this.selectedRemote;
|
||||
let remote = this.getSelectedRemote();
|
||||
|
||||
if (remote == null) {
|
||||
return null;
|
||||
@ -1092,7 +1100,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> {
|
||||
|
||||
return (
|
||||
<Modal className="rconndetail-modal">
|
||||
<Modal.Header title="Connection" onClose={this.model.closeModal} />
|
||||
<Modal.Header title="Connection" onClose={this.handleClose} />
|
||||
<div className="wave-modal-body">
|
||||
<div className="name-header-actions-wrapper">
|
||||
<div className="name text-primary name-wrapper">
|
||||
@ -1167,7 +1175,7 @@ class ViewRemoteConnDetailModal extends React.Component<{}, {}> {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Modal.Footer onOk={this.model.closeModal} onCancel={this.model.closeModal} okLabel="Done" />
|
||||
<Modal.Footer onOk={this.handleClose} onCancel={this.handleClose} okLabel="Done" />
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
@ -2926,8 +2926,11 @@ class RemotesModel {
|
||||
return this.recentConnAddedState.get();
|
||||
}
|
||||
|
||||
seRecentConnAdded(value: boolean) {
|
||||
this.recentConnAddedState.set(value);
|
||||
@boundMethod
|
||||
setRecentConnAdded(value: boolean) {
|
||||
mobx.action(() => {
|
||||
this.recentConnAddedState.set(value);
|
||||
})();
|
||||
}
|
||||
|
||||
deSelectRemote(): void {
|
||||
@ -2939,6 +2942,7 @@ class RemotesModel {
|
||||
|
||||
openReadModal(remoteId: string): void {
|
||||
mobx.action(() => {
|
||||
this.setRecentConnAdded(false);
|
||||
this.selectedRemoteId.set(remoteId);
|
||||
this.remoteEdit.set(null);
|
||||
GlobalModel.modalsModel.pushModal(appconst.VIEW_REMOTE);
|
||||
@ -3724,8 +3728,8 @@ class Model {
|
||||
this.remotes.clear();
|
||||
}
|
||||
this.updateRemotes(update.remotes);
|
||||
// This code's purpose is to show view remote connection modal when a new connection is added
|
||||
if (update.remotes && update.remotes.length && this.remotesModel.recentConnAddedState.get()) {
|
||||
GlobalModel.remotesModel.closeModal();
|
||||
GlobalModel.remotesModel.openReadModal(update.remotes![0].remoteid);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user