Skip to content

Commit

Permalink
Defer URL check (betaflight#3670)
Browse files Browse the repository at this point in the history
* Skip URL check and change Wiki to Support

* Update
  • Loading branch information
haslinghuis authored and chmelevskij committed Apr 27, 2024
1 parent 4917804 commit 6f6094e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 14 deletions.
7 changes: 6 additions & 1 deletion locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3388,7 +3388,8 @@
"message": "Target:"
},
"firmwareFlasherTargetWikiUrlInfo": {
"message": "Get more information about target at Betaflight wiki (wiki url found in unified target configuration)"
"message": "Get more information about the target on the Betaflight Wiki",
"description": "Link to Betaflight support for target"
},
"firmwareFlasherReleaseMCU": {
"message": "MCU:"
Expand Down Expand Up @@ -7361,5 +7362,9 @@
"showDevToolsOnStartup": {
"message": "Automatically open DevTools in development mode",
"description": "Text for the option to enable automatic opening of DevTools in debug mode"
},
"betaflightSupportButton": {
"message": "Wiki",
"description": "Text for the button to open the support URL"
}
}
3 changes: 3 additions & 0 deletions src/css/tabs/firmware_flasher.less
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@
font-size: 11px;
}
}
.board_support {
float: right;
}
.build_configuration_toggle_wrapper {
float: left;
position: absolute;
Expand Down
5 changes: 3 additions & 2 deletions src/js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,11 @@ class GuiControl {

this.switchery();

const documentationButton = $('div#content #button-documentation');
const tRex = GUI.active_tab.replaceAll('_', '-').toLowerCase();

documentationButton.html("Wiki").attr("href", `https://betaflight.com/docs/wiki/configurator/${tRex}-tab`);
$('div#content #button-documentation')
.html(i18n.getMessage('betaflightSupportButton'))
.attr("href", `https://betaflight.com/docs/wiki/configurator/${tRex}-tab`);

// loading tooltip
$(function () {
Expand Down
21 changes: 11 additions & 10 deletions src/js/tabs/firmware_flasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,6 @@ firmware_flasher.initialize = function (callback) {
$('div.release_info #targetMCU').text(summary.mcu);
$('div.release_info .configFilename').text(self.isConfigLocal ? self.configFilename : "[default]");

// Wiki link: #wiki found in unified target configuration, if board description exist or generel board missing
let urlWiki = 'https://betaflight.com/docs/wiki/boards/missing'; // generel board missing
const urlBoard = `https://betaflight.com/docs/wiki/boards/${summary.target}`; // board description
if (urlExists(urlBoard)) {
urlWiki = urlBoard;
}
const targetWiki = $('#targetWikiInfoUrl');
targetWiki.html(`   [Wiki]`);
targetWiki.attr("href", urlWiki);

if (summary.cloudBuild) {
$('div.release_info #cloudTargetInfo').show();
$('div.release_info #cloudTargetLog').text('');
Expand Down Expand Up @@ -934,6 +924,17 @@ firmware_flasher.initialize = function (callback) {
}
}).trigger('change');

const targetSupportInfo = $('#targetSupportInfoUrl');

targetSupportInfo.on('click', function() {
let urlSupport = 'https://betaflight.com/docs/wiki/boards/missing'; // general board missing
const urlBoard = `https://betaflight.com/docs/wiki/boards/${self.selectedBoard}`; // board description
if (urlExists(urlBoard)) {
urlSupport = urlBoard;
}
targetSupportInfo.attr("href", urlSupport);
});

const detectBoardElement = $('a.detect-board');

detectBoardElement.on('click', () => {
Expand Down
7 changes: 6 additions & 1 deletion src/tabs/firmware_flasher.html
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,12 @@
<div class="margin-bottom">
<strong i18n="firmwareFlasherReleaseTarget"></strong>
<span class="target"></span>
<a id="targetWikiInfoUrl" i18n_title="firmwareFlasherTargetWikiUrlInfo" href="#" class="name" target="_blank"></a>
<div class="board_support">
<div class="btn default_btn">
<a id="targetSupportInfoUrl" href="#" target="_blank" i18n="betaflightSupportButton"></a>
</div>
<div class="helpicon cf_tip_wide" i18n_title="firmwareFlasherTargetSupportUrlInfo"></div>
</div>
<div id="manufacturerInfo">
<strong i18n="firmwareFlasherReleaseManufacturer"></strong>
<span id="manufacturer"></span>
Expand Down

0 comments on commit 6f6094e

Please sign in to comment.