stop board selection from being dropped
parent
f6934f234f
commit
59d9832efa
|
@ -308,7 +308,8 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
|
|
||||||
ConfigStorage.get('selected_board', function (result) {
|
ConfigStorage.get('selected_board', function (result) {
|
||||||
if (result.selected_board) {
|
if (result.selected_board) {
|
||||||
var boardReleases = unifiedConfigs[result.selected_board]
|
var boardReleases = TABS.firmware_flasher.unifiedConfigs[result.selected_board]
|
||||||
|
|| TABS.firmware_flasher.releases[result.selected_board];
|
||||||
$('select[name="board"]').val(boardReleases ? result.selected_board : 0).trigger('change');
|
$('select[name="board"]').val(boardReleases ? result.selected_board : 0).trigger('change');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -430,6 +431,26 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function grabBuildNameFromConfig(config) {
|
||||||
|
return config.split("\n")[0].split(' ')[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
function setUnifiedConfig(target, configText, bareBoard) {
|
||||||
|
if (bareBoard == target) {
|
||||||
|
console.log(bareBoard, '==', target);
|
||||||
|
if (!isConfigLocal) {
|
||||||
|
targetConfig = undefined;
|
||||||
|
unifiedConfig = undefined;
|
||||||
|
} else {
|
||||||
|
unifiedConfig = undefined;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
targetConfig = configText;
|
||||||
|
isConfigLocal = false;
|
||||||
|
unifiedConfig = configText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('select[name="board"]').change(function() {
|
$('select[name="board"]').change(function() {
|
||||||
$("a.load_remote_file").addClass('disabled');
|
$("a.load_remote_file").addClass('disabled');
|
||||||
var target = $(this).val();
|
var target = $(this).val();
|
||||||
|
@ -468,15 +489,18 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
// Have to go and try and get the unified config, and then do stuff
|
// Have to go and try and get the unified config, and then do stuff
|
||||||
$.get(TABS.firmware_flasher.unifiedConfigs[target], function(data) {
|
$.get(TABS.firmware_flasher.unifiedConfigs[target], function(data) {
|
||||||
console.log('got unified config');
|
console.log('got unified config');
|
||||||
|
// cache it for later
|
||||||
let tempObj = {};
|
let tempObj = {};
|
||||||
tempObj['data'] = data;
|
tempObj['data'] = data;
|
||||||
tempObj['target'] = target;
|
tempObj['target'] = target;
|
||||||
tempObj['checkTime'] = checkTime;
|
tempObj['checkTime'] = checkTime;
|
||||||
targetConfig = data;
|
let newStorageObj = {};
|
||||||
isConfigLocal = false;
|
newStorageObj[storageTag] = tempObj;
|
||||||
unifiedConfig = data;
|
chrome.storage.local.set(newStorageObj);
|
||||||
bareBoard = data.split("\n")[0].split(' ')[3];
|
|
||||||
populateVersions(versions_e, TABS.firmware_flasher.releases[bareBoard],target);
|
bareBoard = grabBuildNameFromConfig(data);
|
||||||
|
setUnifiedConfig(target, data, bareBoard);
|
||||||
|
populateVersions(versions_e, TABS.firmware_flasher.releases[bareBoard], target);
|
||||||
}).fail(xhr => {
|
}).fail(xhr => {
|
||||||
//TODO error, populate nothing?
|
//TODO error, populate nothing?
|
||||||
targetConfig = undefined;
|
targetConfig = undefined;
|
||||||
|
@ -489,16 +513,10 @@ TABS.firmware_flasher.initialize = function (callback) {
|
||||||
} else {
|
} else {
|
||||||
console.log('We have the config cached for', target);
|
console.log('We have the config cached for', target);
|
||||||
var data = storageObj.data;
|
var data = storageObj.data;
|
||||||
targetConfig = data;
|
|
||||||
isConfigLocal = false;
|
bareBoard = grabBuildNameFromConfig(data);
|
||||||
unifiedConfig = data;
|
setUnifiedConfig(target, data, bareBoard);
|
||||||
bareBoard = data.split("\n")[0].split(' ')[3];
|
populateVersions(versions_e, TABS.firmware_flasher.releases[bareBoard], target);
|
||||||
if (bareBoard == target) {
|
|
||||||
// TODO test this, should skip a placeholder unified target
|
|
||||||
targetConfig = undefined;
|
|
||||||
unifiedConfig = undefined;
|
|
||||||
}
|
|
||||||
populateVersions(versions_e, TABS.firmware_flasher.releases[bareBoard],target);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue