Merge pull request #2897 from limonspb/presets_escape_fix
Presets fix: proper Esc key handling for preset dialogs10.8-maintenance
commit
c86348b4db
|
@ -92,12 +92,7 @@ class MotorOutputReorderComponent
|
|||
function reboot()
|
||||
{
|
||||
GUI.log(i18n.getMessage('configurationEepromSaved'));
|
||||
|
||||
GUI.tab_switch_cleanup(function()
|
||||
{
|
||||
MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false);
|
||||
reinitialiseConnection(self);
|
||||
});
|
||||
GUI.tab_switch_cleanup(() => MSP.send_message(MSPCodes.MSP_SET_REBOOT, false, false, reinitializeConnection(TABS.motors)));
|
||||
}
|
||||
|
||||
FC.MOTOR_OUTPUT_ORDER = Array.from(this._newMotorOutputReorder);
|
||||
|
|
|
@ -208,7 +208,7 @@ class CliEngine
|
|||
CONFIGURATOR.cliEngineActive = false;
|
||||
CONFIGURATOR.cliEngineValid = false;
|
||||
GUI.log(i18n.getMessage('cliReboot'));
|
||||
reinitialiseConnection(this._currentTab);
|
||||
reinitializeConnection(this._currentTab);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ class PresetsDetailedDialog {
|
|||
this._setLoadingState(true);
|
||||
this._domDialog[0].showModal();
|
||||
this._optionsShowedAtLeastOnce = false;
|
||||
this._isPresetPickedOnClose = false;
|
||||
|
||||
this._presetsRepo.loadPreset(this._preset)
|
||||
.then(() => {
|
||||
|
@ -231,9 +232,10 @@ class PresetsDetailedDialog {
|
|||
this._readDom();
|
||||
|
||||
this._domButtonApply.on("click", () => this._onApplyButtonClicked());
|
||||
this._domButtonCancel.on("click", () => this._onCancelButtonClicked(false));
|
||||
this._domButtonCancel.on("click", () => this._onCancelButtonClicked());
|
||||
this._domButtonCliShow.on("click", () => this._showCliText(true));
|
||||
this._domButtonCliHide.on("click", () => this._showCliText(false));
|
||||
this._domDialog.on("close", () => this._onClose());
|
||||
}
|
||||
|
||||
_onApplyButtonClicked() {
|
||||
|
@ -256,7 +258,8 @@ class PresetsDetailedDialog {
|
|||
const pickedPreset = new PickedPreset(this._preset, cliStrings);
|
||||
this._pickedPresetList.push(pickedPreset);
|
||||
this._onPresetPickedCallback?.();
|
||||
this._onCancelButtonClicked(true);
|
||||
this._isPresetPickedOnClose = true;
|
||||
this._onCancelButtonClicked();
|
||||
}
|
||||
|
||||
_pickPresetFwVersionCheck() {
|
||||
|
@ -284,9 +287,12 @@ class PresetsDetailedDialog {
|
|||
}
|
||||
}
|
||||
|
||||
_onCancelButtonClicked(isPresetPicked) {
|
||||
this._destroyOptionsSelect();
|
||||
_onCancelButtonClicked() {
|
||||
this._domDialog[0].close();
|
||||
this._openPromiseResolve?.(isPresetPicked);
|
||||
}
|
||||
|
||||
_onClose() {
|
||||
this._destroyOptionsSelect();
|
||||
this._openPromiseResolve?.(this._isPresetPickedOnClose);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,13 +124,17 @@ class PresetsSourcesDialog {
|
|||
|
||||
_setupEvents() {
|
||||
this._domButtonClose.on("click", () => this._onCloseButtonClick());
|
||||
this._domDialog.on("close", () => this._onClose());
|
||||
}
|
||||
|
||||
_onCloseButtonClick() {
|
||||
this._sourceSelectedPromiseResolve?.();
|
||||
this._domDialog[0].close();
|
||||
}
|
||||
|
||||
_onClose() {
|
||||
this._sourceSelectedPromiseResolve?.();
|
||||
}
|
||||
|
||||
_readPanels() {
|
||||
this._sources = [];
|
||||
this._activeSourceIndex = 0;
|
||||
|
|
|
@ -42,8 +42,8 @@ TABS.presets.readDom = function() {
|
|||
this._domProgressDialog = $("#presets_apply_progress_dialog")[0];
|
||||
this._domProgressDialogProgressBar = $(".presets_apply_progress_dialog_progress_bar");
|
||||
this._domButtonaSaveAnyway = $("#presets_cli_errors_save_anyway_button");
|
||||
this._domButtonaCliExit = $("#presets_cli_errors_exit_no_save_button");
|
||||
this._domDialogCliErrors = $("#presets_cli_errors_dialog")[0];
|
||||
this._domButtonCliExit = $("#presets_cli_errors_exit_no_save_button");
|
||||
this._domDialogCliErrors = $("#presets_cli_errors_dialog");
|
||||
this._domButtonSaveBackup = $(".presets_save_config");
|
||||
this._domButtonLoadBackup = $(".presets_load_config");
|
||||
this._domButtonPresetSources = $(".presets_sources_show");
|
||||
|
@ -87,7 +87,8 @@ TABS.presets.onSaveClick = function() {
|
|||
|
||||
if (newCliErrorsCount !== currentCliErrorsCount) {
|
||||
this._domProgressDialog.close();
|
||||
this._domDialogCliErrors.showModal();
|
||||
this._domDialogCliErrors[0].showModal();
|
||||
this._domDialogCliErrorsSavePressed = false;
|
||||
} else {
|
||||
this._domProgressDialog.close();
|
||||
this.cliEngine.sendLine(CliEngine.s_commandSave);
|
||||
|
@ -117,13 +118,14 @@ TABS.presets.setupMenuButtons = function() {
|
|||
this.enableSaveCancelButtons(false);
|
||||
});
|
||||
|
||||
this._domButtonaCliExit.on("click", () =>{
|
||||
this._domDialogCliErrors.close();
|
||||
this.cliEngine.sendLine(CliEngine.s_commandExit);
|
||||
this.disconnectCliMakeSure();
|
||||
this._domButtonCliExit.on("click", () =>{
|
||||
this._domDialogCliErrorsSavePressed = false;
|
||||
this._domDialogCliErrors[0].close();
|
||||
});
|
||||
|
||||
this._domButtonaSaveAnyway.on("click", () => {
|
||||
this._domDialogCliErrors.close();
|
||||
this._domDialogCliErrorsSavePressed = true;
|
||||
this._domDialogCliErrors[0].close();
|
||||
this.cliEngine.sendLine(CliEngine.s_commandSave, null, () => {
|
||||
// In case of batch CLI commands errors Firmware requeires extra "save" comand for CLI safety.
|
||||
// No need for this safety in presets as preset tab already detected errors and showed them to the user.
|
||||
|
@ -132,6 +134,15 @@ TABS.presets.setupMenuButtons = function() {
|
|||
});
|
||||
this.disconnectCliMakeSure();
|
||||
});
|
||||
|
||||
this._domDialogCliErrors.on("close", () => {
|
||||
if(!this._domDialogCliErrorsSavePressed) {
|
||||
this._domDialogCliErrorsSavePressed = true;
|
||||
this.cliEngine.sendLine(CliEngine.s_commandExit);
|
||||
this.disconnectCliMakeSure();
|
||||
}
|
||||
});
|
||||
|
||||
this._domButtonSaveBackup.on("click", () => this.onSaveConfigClick());
|
||||
this._domButtonLoadBackup.on("click", () => this.onLoadConfigClick());
|
||||
this._domButtonPresetSources.on("click", () => this.onPresetSourcesShowClick());
|
||||
|
|
Loading…
Reference in New Issue