Various BIOS file bug fixes

This commit is contained in:
Michael Green
2024-10-02 15:38:06 +10:00
parent 4a76436223
commit bca4dd178e
4 changed files with 41 additions and 11 deletions

View File

@@ -17,9 +17,9 @@
<p>This list is pre-populated with some of the more common platforms. New platforms will appear in this list as
titles are added.</p>
<p id="settings_mapping_import" style="display: none;"><button value="Export to JSON"
onclick="DownloadJSON();">Export to JSON</button><button id="importjson" value="Import JSON">Import
JSON</button><button value="Reset to Default" onclick="loadPlatformMapping(true);">Reset to
<p id="settings_mapping_import" style="display: none;"><button id="exportjson" value="Export to JSON">Export to
JSON</button><button id="importjson" value="Import JSON">Import
JSON</button><button id="resetmapping" value="Reset to Default">Reset to
Default</button></p>
<input id='uploadjson' type='file' name='files' hidden />

View File

@@ -70,6 +70,7 @@ function SetupButtons() {
if (userProfile.roles.includes("Admin")) {
document.getElementById('settings_mapping_import').style.display = '';
// Setup the JSON import button
document.getElementById('uploadjson').addEventListener('change', function () {
$(this).simpleUpload("/api/v1.1/PlatformMaps", {
start: function (file) {
@@ -84,6 +85,24 @@ function SetupButtons() {
});
document.getElementById('importjson').addEventListener('click', openDialog);
// Setup the JSON export button
document.getElementById('exportjson').addEventListener('click', DownloadJSON);
// Setup the reset to defaults button
document.getElementById('resetmapping').addEventListener('click', function () {
let warningDialog = new MessageBox("Platform Mapping Reset", "This will reset the platform mappings to the default values. Are you sure you want to continue?");
warningDialog.addButton(new ModalButton("OK", 2, warningDialog, async (callingObject) => {
loadPlatformMapping(true);
callingObject.msgDialog.close();
let completedDialog = new MessageBox("Platform Mapping Reset", "All platform mappings have been reset to default values.");
completedDialog.open();
}));
warningDialog.addButton(new ModalButton("Cancel", 0, warningDialog, async (callingObject) => {
callingObject.msgDialog.close();
}));
warningDialog.open();
});
}
}