Merge pull request #1685 from iNavFlight/MrD_Improve-links-to-CLI-documentation

Make links to documents relevant to firmware version
pull/1696/head
Darren Lines 2 years ago committed by GitHub
commit 008ad0c1a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1933,6 +1933,9 @@
"cliReboot": {
"message": "CLI reboot detected"
},
"cliDocsBtn": {
"message": "CLI Command Docs"
},
"cliSaveToFileBtn": {
"message": "Save to File"
},

@ -672,7 +672,7 @@ var Settings = (function () {
}
if (typeof dataSettingName !== "undefined" && dataSettingName !== "") {
helpIcon.wrap('<a class="helpiconLink" href="https://github.com/iNavFlight/inav/blob/master/docs/Settings.md#' + dataSettingName + '" target="_blank"></a>');
helpIcon.wrap('<a class="helpiconLink" href="' + globalSettings.docsTreeLocation + 'Settings.md#' + dataSettingName + '" target="_blank"></a>');
}
}

@ -24,12 +24,16 @@ let globalSettings = {
// Used to depict how the units are displayed within the UI
unitType: null,
// Used to convert units within the UI
osdUnits: null,
osdUnits: null,
// Map
mapProviderType: null,
mapApiKey: null,
proxyURL: null,
proxyLayer: null,
// Show colours for profiles
showProfileParameters: null,
// tree target for documents
docsTreeLocation: 'master',
};
$(document).ready(function () {
@ -673,7 +677,21 @@ function updateActivatedTab() {
function updateFirmwareVersion() {
if (CONFIGURATOR.connectionValid) {
$('#logo .firmware_version').text(CONFIG.flightControllerVersion + " [" + CONFIG.target + "]");
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/' + CONFIG.flightControllerVersion + '/docs/';
// If this is a master branch firmware, this will find a 404 as there is no tag tree. So default to master for docs.
$.ajax({
url : globalSettings.docsTreeLocation + 'Settings.md',
method: "HEAD",
statusCode: {
404: function() {
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/';
}
}
});
} else {
$('#logo .firmware_version').text(chrome.i18n.getMessage('fcNotConnected'));
globalSettings.docsTreeLocation = 'https://github.com/iNavFlight/inav/blob/master/docs/';
}
}

@ -20,6 +20,7 @@
<a class="exit" href="#" i18n="cliExitBtn"></a>
</div>
<div class="btn save_btn pull-right">
<a class="cliDocsBtn" href="#" i18n="cliDocsBtn" target="_blank"></a>
<a class="save" href="#" i18n="cliSaveToFileBtn"></a>
<a class="load" href="#" i18n="cliLoadFromFileBtn"></a>
<a class="clear" href="#" i18n="cliClearOutputHistoryBtn"></a>

@ -146,6 +146,8 @@ TABS.cli.initialize = function (callback) {
// translate to user-selected language
localize();
$('.cliDocsBtn').attr('href', globalSettings.docsTreeLocation + 'Settings.md');
CONFIGURATOR.cliActive = true;
var textarea = $('.tab-cli textarea[name="commands"]');

Loading…
Cancel
Save