mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-25 17:25:16 +03:00
Fix offline behavior (#3480)
* Fix offline behaviour * Fix message on setup tab when offline
This commit is contained in:
parent
2b8dff26b8
commit
791751a860
7 changed files with 19 additions and 20 deletions
|
@ -1092,6 +1092,9 @@
|
|||
"initialSetupInfoBuildOptionsEmpty": {
|
||||
"message": "Local Build - no Defines used"
|
||||
},
|
||||
"initialSetupNotOnline": {
|
||||
"message": "Server unavailable"
|
||||
},
|
||||
"initialSetupButtonSave": {
|
||||
"message": "Save"
|
||||
},
|
||||
|
|
|
@ -40,7 +40,7 @@ const Features = function (config) {
|
|||
|
||||
self._features = features;
|
||||
|
||||
if (semver.gte(config.apiVersion, API_VERSION_1_45) && config.buildKey.length === 32) {
|
||||
if (semver.gte(config.apiVersion, API_VERSION_1_45) && config.buildOptions.length) {
|
||||
self._features = [];
|
||||
|
||||
for (const feature of features) {
|
||||
|
|
|
@ -536,7 +536,7 @@ function setRtc() {
|
|||
|
||||
function finishOpen() {
|
||||
CONFIGURATOR.connectionValid = true;
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) && FC.CONFIG.buildKey.length === 32) {
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) && FC.CONFIG.buildOptions.length) {
|
||||
|
||||
GUI.allowedTabs = GUI.defaultAllowedTabsCloudBuild;
|
||||
|
||||
|
|
|
@ -271,7 +271,9 @@ cli.initialize = function (callback) {
|
|||
});
|
||||
});
|
||||
|
||||
$('.tab-cli .support').click(function() {
|
||||
$('.tab-cli .support')
|
||||
.toggle(navigator.onLine)
|
||||
.on('click', function() {
|
||||
|
||||
function submitSupportData(data) {
|
||||
clearHistory();
|
||||
|
|
|
@ -348,7 +348,7 @@ firmware_flasher.initialize = function (callback) {
|
|||
|
||||
self.releaseLoader.loadTarget(target, release, onTargetDetail);
|
||||
|
||||
if (FC.CONFIG.buildKey.length === 32) {
|
||||
if (FC.CONFIG.buildKey.length === 32 && navigator.onLine) {
|
||||
self.releaseLoader.loadOptionsByBuildKey(release, FC.CONFIG.buildKey, buildOptions);
|
||||
} else {
|
||||
self.releaseLoader.loadOptions(release, buildOptions);
|
||||
|
|
|
@ -370,7 +370,7 @@ setup.initialize = function (callback) {
|
|||
msp_api_e.text([FC.CONFIG.apiVersion]);
|
||||
build_date_e.text([FC.CONFIG.buildInfo]);
|
||||
|
||||
if (FC.CONFIG.buildKey.length > 1) {
|
||||
if (FC.CONFIG.buildKey.length === 32) {
|
||||
const buildRoot = `https://build.betaflight.com/api/builds/${FC.CONFIG.buildKey}`;
|
||||
const buildConfig = `<span class="buildInfoBtn" title="${i18n.getMessage('initialSetupInfoBuildInfoConfig')}: ${buildRoot}/json">
|
||||
<a href="${buildRoot}/json" target="_blank"><strong>${i18n.getMessage('initialSetupInfoBuildInfoConfig')}</a></strong></span>`;
|
||||
|
@ -382,9 +382,10 @@ setup.initialize = function (callback) {
|
|||
$('.build-info a').addClass('disabled');
|
||||
}
|
||||
|
||||
if (FC.CONFIG.buildOptions.length > 0) {
|
||||
if (FC.CONFIG.buildOptions.length) {
|
||||
let buildOptions = "";
|
||||
build_opt_e.text = "";
|
||||
|
||||
for (const buildOption of FC.CONFIG.buildOptions) {
|
||||
buildOptions = `${buildOptions}   ${buildOption}`;
|
||||
}
|
||||
|
@ -392,7 +393,7 @@ setup.initialize = function (callback) {
|
|||
title="${i18n.getMessage('initialSetupInfoBuildOptions')}${buildOptions}">
|
||||
<strong>${i18n.getMessage('initialSetupInfoBuildOptionsList')}</strong></span>`);
|
||||
} else {
|
||||
build_opt_e.html(i18n.getMessage('initialSetupInfoBuildOptionsEmpty'));
|
||||
build_opt_e.html(i18n.getMessage(navigator.onLine ? 'initialSetupInfoBuildOptionsEmpty' : 'initialSetupNotOnline'));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,22 +1,15 @@
|
|||
import semver from "semver";
|
||||
import { API_VERSION_1_42, API_VERSION_1_45 } from "../data_storage";
|
||||
import FC from "../fc";
|
||||
|
||||
export function updateTabList(features) {
|
||||
const isExpertModeEnabled = $('input[name="expertModeCheckbox"]').is(':checked');
|
||||
|
||||
$('#tabs ul.mode-connected li.tab_failsafe').toggle(isExpertModeEnabled);
|
||||
$('#tabs ul.mode-connected li.tab_adjustments').toggle(isExpertModeEnabled);
|
||||
$('#tabs ul.mode-connected li.tab_servos').toggle(isExpertModeEnabled);
|
||||
$('#tabs ul.mode-connected li.tab_sensors').toggle(isExpertModeEnabled);
|
||||
$('#tabs ul.mode-connected li.tab_logging').toggle(isExpertModeEnabled);
|
||||
|
||||
if (semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45 || FC.CONFIG.buildKey.length !== 32)) {
|
||||
$('#tabs ul.mode-connected li.tab_gps').toggle(features.isEnabled('GPS'));
|
||||
$('#tabs ul.mode-connected li.tab_led_strip').toggle(features.isEnabled('LED_STRIP'));
|
||||
$('#tabs ul.mode-connected li.tab_servos').toggle(features.isEnabled('CHANNEL_FORWARDING') || features.isEnabled('SERVO_TILT'));
|
||||
$('#tabs ul.mode-connected li.tab_transponder').toggle(features.isEnabled('TRANSPONDER'));
|
||||
$('#tabs ul.mode-connected li.tab_osd').toggle(features.isEnabled('OSD'));
|
||||
$('#tabs ul.mode-connected li.tab_vtx').toggle(features.isEnabled('VTX') && semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_42));
|
||||
}
|
||||
$('#tabs ul.mode-connected li.tab_servos').toggle(features.isEnabled('CHANNEL_FORWARDING') || features.isEnabled('SERVO_TILT'));
|
||||
$('#tabs ul.mode-connected li.tab_gps').toggle(features.isEnabled('GPS'));
|
||||
$('#tabs ul.mode-connected li.tab_led_strip').toggle(features.isEnabled('LED_STRIP'));
|
||||
$('#tabs ul.mode-connected li.tab_transponder').toggle(features.isEnabled('TRANSPONDER'));
|
||||
$('#tabs ul.mode-connected li.tab_osd').toggle(features.isEnabled('OSD'));
|
||||
$('#tabs ul.mode-connected li.tab_vtx').toggle(features.isEnabled('VTX'));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue