Refactored version display, made text congruent.

10.3.x-maintenance
mikeller 2017-10-23 09:49:21 +13:00
parent 0b1a8b0bcc
commit 6d28cac034
2 changed files with 23 additions and 12 deletions

View File

@ -213,8 +213,8 @@
"fcInfoReceived": {
"message": "Flight controller info, identifier: <strong>$1</strong>, version: <strong>$2</strong>"
},
"versionLabelHardware": {
"message": "Board"
"versionLabelTarget": {
"message": "Target"
},
"versionLabelFirmware": {
"message": "Firmware"

31
main.js
View File

@ -518,31 +518,42 @@ function generateFilename(prefix, suffix) {
return filename + '.' + suffix;
}
function updateTopBarVersion(firmwareVersion, firmwareId, hardwareId) {
var versionText = chrome.i18n.getMessage('versionLabelConfigurator') + ': ' + chrome.runtime.getManifest().version + '<br />';
function getFirmwareVersion(firmwareVersion, firmwareId, hardwareId) {
var versionText = '';
if (firmwareVersion) {
versionText += chrome.i18n.getMessage('versionLabelFirmware') + ': ' + firmwareId + ' ' + firmwareVersion;
if (hardwareId) {
versionText += ' (Target: ' + hardwareId + ')';
versionText += ' (' + chrome.i18n.getMessage('versionLabelTarget') + ': ' + hardwareId + ')';
}
}
return versionText;
}
function getConfiguratorVersion() {
return chrome.i18n.getMessage('versionLabelConfigurator') + ': ' + chrome.runtime.getManifest().version;
}
function updateTopBarVersion(firmwareVersion, firmwareId, hardwareId) {
var versionText = getConfiguratorVersion() + '<br />';
versionText = versionText + getFirmwareVersion(firmwareVersion, firmwareId, hardwareId);
$('#logo .logo_text').html(versionText);
}
function updateStatusBarVersion(firmwareVersion, firmwareId, hardwareId) {
var versionText = '';
if (hardwareId) {
versionText = versionText + chrome.i18n.getMessage('versionLabelHardware') + ': ' + hardwareId + ', ';
versionText = versionText + getFirmwareVersion(firmwareVersion, firmwareId, hardwareId);
if (versionText !== '') {
versionText = versionText + ', ';
}
if (firmwareVersion) {
versionText = versionText + chrome.i18n.getMessage('versionLabelFirmware') + ': ' + firmwareId + ' ' + firmwareVersion + ', ';
}
versionText = versionText + chrome.i18n.getMessage('versionLabelConfigurator') + ': ' + chrome.runtime.getManifest().version;
versionText = versionText + getConfiguratorVersion();
$('#status-bar .version').text(versionText);
}