Merge pull request #26 from pulsar256/development

Force the user to pick a fimrware before loading
10.3.x-maintenance
Dominic Clifton 2014-12-25 00:24:17 +00:00
commit 5d6ea1289d
4 changed files with 34 additions and 4 deletions

3
_locales/en/messages.json Normal file → Executable file
View File

@ -828,6 +828,9 @@
"firmwareFlasherFlashSlowlyDescription": {
"message": "Use 115200 baudrate for flashing (useful for flashing via bluetooth)"
},
"firmwareFlasherOptionLabelSelectFirmware": {
"message": "Choose a Firmware / Board"
},
"firmwareFlasherButtonLoadLocal": {
"message": "Load Firmware [Local]"
},

11
tabs/firmware_flasher.css Normal file → Executable file
View File

@ -71,7 +71,7 @@
margin-left: 6px;
}
.tab-firmware_flasher .options select {
width: 180px;
width: 280px;
height: 20px;
border: 1px solid silver;
@ -82,7 +82,7 @@
}
.tab-firmware_flasher .options .description {
position: absolute;
left: 200px;
left: 300px;
font-style: italic;
color: #818181;
@ -194,6 +194,13 @@
cursor: default;
background-color: #b8b8b8;
}
.tab-firmware_flasher .buttons a.load_remote_file.locked {
background-color: #b8b8b8;
}
.tab-firmware_flasher .buttons a.load_remote_file.locked:hover {
cursor: default;
background-color: #b8b8b8;
}
.tab-firmware_flasher .buttons a.back {
float: right;
margin: 0;

2
tabs/firmware_flasher.html Normal file → Executable file
View File

@ -69,7 +69,7 @@
</div>
<div class="buttons">
<a class="load_file" href="#" i18n="firmwareFlasherButtonLoadLocal"></a>
<a class="load_remote_file" href="#" i18n="firmwareFlasherButtonLoadOnline"></a>
<a class="load_remote_file locked" href="#" i18n="firmwareFlasherButtonLoadOnline"></a>
<a class="flash_firmware locked" href="#" i18n="firmwareFlasherFlashFirmware"></a>
<a class="back" href="#" i18n="firmwareFlasherButtonLeave"></a>
</div>

22
tabs/firmware_flasher.js Normal file → Executable file
View File

@ -32,6 +32,8 @@ TABS.firmware_flasher.initialize = function (callback) {
var processReleases = function (releases){
var releases_e = $('select[name="release"]').empty();
releases_e.append($("<option value='0'>{0}</option>".format(chrome.i18n.getMessage('firmwareFlasherOptionLabelSelectFirmware'))));
for(var releaseIndex = 0; releaseIndex < releases.length; releaseIndex++){
$.get(releases[releaseIndex].assets_url).done(
(function (releases, releaseIndex, releases_e, assets){
@ -206,8 +208,26 @@ TABS.firmware_flasher.initialize = function (callback) {
});
});
});
/**
* Lock / Unlock the firmware download button according to the firmware selection dropdown.
*/
$('select[name="release"]').change(function(evt){
if (evt.target.value=="0") {
$("a.load_remote_file").addClass('locked');
}
else {
$("a.load_remote_file").removeClass('locked');
}
});
$('a.load_remote_file').click(function () {
$('a.load_remote_file').click(function (evt) {
if ($('select[name="release"]').val() == "0") {
GUI.log("<b>No firmware selected to load</b>");
return;
}
function process_hex(data, summary) {
intel_hex = data;