163 lines
5.7 KiB
HTML
163 lines
5.7 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
|
<meta name="description" content="">
|
|
<title>Beer Gravity Monitor</title>
|
|
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" crossorigin="anonymous"></script>
|
|
</head>
|
|
|
|
<body class="py-4">
|
|
|
|
<!-- START MENU -->
|
|
|
|
<nav class="navbar navbar-expand-sm navbar-dark bg-primary">
|
|
<a class="navbar-brand" href="/upload.htm">Beer Gravity Monitor - Missing html files</a>
|
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
|
|
<div class="collapse navbar-collapse" id="navbar">
|
|
<div class="spinner-border text-light" id="spinner" role="status"></div>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- START MAIN INDEX -->
|
|
|
|
<div class="container">
|
|
|
|
<hr class="my-4">
|
|
|
|
<div class="alert alert-success alert-dismissible fade hide show d-none" role="alert" id="alert">
|
|
<div id="alert-msg">...</div>
|
|
<button type="button" id="alert-btn" class="close" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
function showError( msg ) {
|
|
$('.alert').removeClass('alert-success').addClass('alert-danger').removeClass('d-none').addClass('show')
|
|
$('#alert-msg').text( msg );
|
|
}
|
|
|
|
function showSuccess( msg ) {
|
|
$('.alert').addClass('alert-success').removeClass('alert-danger').removeClass('d-none').addClass('show')
|
|
$('#alert-msg').text( msg );
|
|
}
|
|
|
|
$("#alert-btn").click(function(e){
|
|
$('.alert').addClass('d-none').removeClass('show')
|
|
});
|
|
</script>
|
|
|
|
<div class="row mb-3">
|
|
<div class="col-md-8 themed-grid-col bg-light">The listed files below needs to be uploaded to the FileSystem in order for the GUI to work.
|
|
You can also flash the LittleFS filesystem but in that case you will loose your device settings. An OTA upgrade will automatically download
|
|
the files if they are found in the same location as the firmware.bin. This page is a fallback option.
|
|
</div>
|
|
<div class="col-md-8 themed-grid-col bg-light"><br><strong>Once all the files are confirmed, please reboot the device for normal operation.</strong></div>
|
|
</div>
|
|
|
|
<div class="row mb-3">
|
|
<div class="col-md-2 themed-grid-col bg-light">index.min.htm</div>
|
|
<div class="col-md-6 themed-grid-col bg-light" id="index">Checking...</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-2 themed-grid-col bg-light">device.min.htm</div>
|
|
<div class="col-md-6 themed-grid-col bg-light" id="device">Checking...</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-2 themed-grid-col bg-light">config.min.htm</div>
|
|
<div class="col-md-6 themed-grid-col bg-light" id="config">Checking...</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-2 themed-grid-col bg-light">calibration.min.htm</div>
|
|
<div class="col-md-6 themed-grid-col bg-light" id="calibration">Checking...</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-2 themed-grid-col bg-light">about.min.htm</div>
|
|
<div class="col-md-6 themed-grid-col bg-light" id="about">Checking...</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-2 themed-grid-col bg-light">certs.ar</div>
|
|
<div class="col-md-6 themed-grid-col bg-light" id="certs">Checking...</div>
|
|
</div>
|
|
|
|
<div class="row mb-3">
|
|
<form action="/api/upload" method="post" enctype="multipart/form-data">
|
|
<div class="col-md-8 custom-file">
|
|
<input type="file" class="custom-file-input" name="name" id="name">
|
|
<label class="custom-file-label" for="name">Choose file</label>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary" id="upload-btn" value="upload">Upload</button>
|
|
</form>
|
|
</div>
|
|
|
|
<hr class="my-4">
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
window.onload = getUpload;
|
|
|
|
// Add the following code if you want the name of the file appear on select
|
|
$(".custom-file-input").on("change", function() {
|
|
var fileName = $(this).val().split("\\").pop();
|
|
$(this).siblings(".custom-file-label").addClass("selected").html(fileName);
|
|
});
|
|
|
|
function getUpload() {
|
|
var url = "/api/upload";
|
|
//var url = "/test/upload.json";
|
|
$('#spinner').show();
|
|
$.getJSON(url, function (cfg) {
|
|
console.log( cfg );
|
|
|
|
if( cfg["index"] )
|
|
$("#index").text("Completed.");
|
|
else
|
|
$("#index").text("File is missing.");
|
|
|
|
if( cfg["device"] )
|
|
$("#device").text("Completed.");
|
|
else
|
|
$("#device").text("File is missing.");
|
|
|
|
if( cfg["config"] )
|
|
$("#config").text("Completed.");
|
|
else
|
|
$("#config").text("File is missing.");
|
|
|
|
if( cfg["calibration"] )
|
|
$("#calibration").text("Completed.");
|
|
else
|
|
$("#calibration").text("File is missing.");
|
|
|
|
if( cfg["about"] )
|
|
$("#about").text("Completed.");
|
|
else
|
|
$("#about").text("File is missing.");
|
|
|
|
if( cfg["certs"] )
|
|
$("#certs").text("Completed.");
|
|
else
|
|
$("#certs").text("File is missing (optional).");
|
|
|
|
})
|
|
.fail(function () {
|
|
showError('Unable to get data from the device.');
|
|
})
|
|
.always(function() {
|
|
$('#spinner').hide();
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<!-- START FOOTER -->
|
|
|
|
<div class="container-fluid themed-container bg-primary text-light">(C) Copyright 2021-22 Magnus Persson</div>
|
|
</body>
|
|
</html> |