mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-25 17:25:14 +03:00
Move UI bindings to separate module
This commit is contained in:
parent
d46b797830
commit
a45d85c0b0
3 changed files with 63 additions and 9 deletions
|
@ -13,6 +13,8 @@ const jBox = require('./libraries/jBox/jBox.min');
|
|||
const i18n = require('./localization');
|
||||
const defaultsDialogData = require('./defaults_dialog_entries.js');
|
||||
const Settings = require('./settings.js');
|
||||
const serialPortHelper = require('./serialPortHelper');
|
||||
const wizardUiBindings = require('./wizard_ui_bindings');
|
||||
|
||||
var savingDefaultsModal;
|
||||
|
||||
|
@ -23,6 +25,8 @@ var defaultsDialog = (function () {
|
|||
|
||||
let $container;
|
||||
|
||||
privateScope.wizardSettings = {};
|
||||
|
||||
publicScope.init = function () {
|
||||
mspHelper.getSetting("applied_defaults").then(privateScope.onInitSettingReturned);
|
||||
$container = $("#defaults-wrapper");
|
||||
|
@ -50,17 +54,23 @@ var defaultsDialog = (function () {
|
|||
};
|
||||
|
||||
privateScope.saveWizardStep = function (selectedDefaultPreset, wizardStep) {
|
||||
//TODO add saving logic
|
||||
const steps = selectedDefaultPreset.wizardPages;
|
||||
const stepName = steps[wizardStep];
|
||||
|
||||
if (stepName == "receiver") {
|
||||
let $receiverPort = $container.find('#wizard-receiver-port');
|
||||
let receiverPort = $receiverPort.val();
|
||||
|
||||
if (receiverPort != "-1") {
|
||||
privateScope.wizardSettings['receiverPort'] = receiverPort;
|
||||
}
|
||||
|
||||
privateScope.wizardSettings['receiverProcol'] = $container.find('#wizard-receiver-protocol').val();
|
||||
}
|
||||
|
||||
privateScope.wizard(selectedDefaultPreset, wizardStep + 1);
|
||||
};
|
||||
|
||||
privateScope.handleTabLoadReceiver = function ($content) {
|
||||
console.log('ready to handle receiver');
|
||||
|
||||
|
||||
},
|
||||
|
||||
privateScope.wizard = function (selectedDefaultPreset, wizardStep) {
|
||||
|
||||
const steps = selectedDefaultPreset.wizardPages;
|
||||
|
@ -94,7 +104,10 @@ var defaultsDialog = (function () {
|
|||
});
|
||||
|
||||
if (stepName == "receiver") {
|
||||
privateScope.handleTabLoadReceiver($content);
|
||||
/**
|
||||
* Bindings executed when the receiver wizard tab is loaded
|
||||
*/
|
||||
wizardUiBindings.receiver($content);
|
||||
}
|
||||
|
||||
Settings.configureInputs().then(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue