flash.js 1002 B

12345678910111213141516171819202122232425262728293031323334
  1. //===== FLASH cards
  2. function flashFirmware(e) {
  3. e.preventDefault();
  4. var fw_data = document.getElementById('fw-file').files[0];
  5. $("#fw-form").setAttribute("hidden", "");
  6. $("#fw-spinner").removeAttribute("hidden");
  7. showNotification("Firmware is being updated ...");
  8. ajaxReq("POST", "/flash/upload", function (resp) {
  9. ajaxReq("GET", "/flash/reboot", function (resp) {
  10. showNotification("Firmware has been successfully updated!");
  11. setTimeout(function(){ window.location.reload()}, 4000);
  12. $("#fw-spinner").setAttribute("hidden", "");
  13. $("#fw-form").removeAttribute("hidden");
  14. });
  15. }, null, fw_data)
  16. }
  17. function fetchFlash() {
  18. ajaxReq("GET", "/flash/next", function (resp) {
  19. $("#fw-slot").innerHTML = resp;
  20. $("#fw-spinner").setAttribute("hidden", "");
  21. $("#fw-form").removeAttribute("hidden");
  22. });
  23. ajaxJson("GET", "/menu", function(data) {
  24. var v = $("#current-fw");
  25. if (v != null) { v.innerHTML = data.version; }
  26. }
  27. );
  28. }