179 lines
6.9 KiB
HTML
179 lines
6.9 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://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
|
<style>
|
|
.row-margin-10 { margin-top: 1.0em; }
|
|
</style>
|
|
</head>
|
|
|
|
<body class="py-4">
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
|
|
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
|
|
|
|
<!-- START MENU -->
|
|
|
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="/index.htm">Beer Gravity Monitor</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="spinner-border text-light" id="spinner" role="status"></div>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- START MAIN INDEX -->
|
|
|
|
<div class="container row-margin-10">
|
|
|
|
<div class="alert alert-success alert-dismissible hide fade d-none" role="alert">
|
|
<div id="alert"></div>
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
function showError( msg ) {
|
|
$('.alert').removeClass('alert-success').addClass('alert-danger').removeClass('hide').addClass('show').removeClass('d-none');
|
|
$('#alert').text( msg );
|
|
}
|
|
|
|
function showSuccess( msg ) {
|
|
$('.alert').addClass('alert-success').removeClass('alert-danger').removeClass('hide').addClass('show').removeClass('d-none');
|
|
$('#alert').text( msg );
|
|
}
|
|
|
|
$("#alert-btn").click(function(e){
|
|
$('.alert').addClass('hide').removeClass('show').addClass('d-none');
|
|
});
|
|
</script>
|
|
|
|
<div class="accordion" id="accordion">
|
|
<div class="accordion-item">
|
|
<h2 class="accordion-header" id="headingUpload">
|
|
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseUpload" aria-expanded="true" aria-controls="collapseUpload">
|
|
<b>Upload missing html files</b>
|
|
</button>
|
|
</h2>
|
|
<div id="collapseUpload" class="accordion-collapse collapse show" aria-labelledby="headingUpload" data-bs-parent="#accordion">
|
|
<div class="accordion-body">
|
|
|
|
<div class="row mb-3">
|
|
<div class="col-md-8 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 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 bg-light">index.min.htm</div>
|
|
<div class="col-md-6 bg-light" id="index">Checking...</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-2 bg-light">config.min.htm</div>
|
|
<div class="col-md-6 bg-light" id="config">Checking...</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-2 bg-light">calibration.min.htm</div>
|
|
<div class="col-md-6 bg-light" id="calibration">Checking...</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-2 bg-light">format.min.htm</div>
|
|
<div class="col-md-6 bg-light" id="format">Checking...</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-2 bg-light">test.min.htm</div>
|
|
<div class="col-md-6 bg-light" id="test">Checking...</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-2 bg-light">about.min.htm</div>
|
|
<div class="col-md-6 bg-light" id="about">Checking...</div>
|
|
</div>
|
|
|
|
<form action="/api/upload" method="post" enctype="multipart/form-data">
|
|
<div class="row mb-3">
|
|
<div class="col-md-8 custom-file">
|
|
<input type="file" accept=".min.htm" class="custom-file-input" name="name" id="name">
|
|
</div>
|
|
</div>
|
|
<div class="row mb-3">
|
|
<div class="col-md-3">
|
|
<button type="submit" class="btn btn-primary" id="upload-btn" value="upload">Upload</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</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["config"] )
|
|
$("#config").text("Completed.");
|
|
else
|
|
$("#config").text("File is missing.");
|
|
|
|
if( cfg["calibration"] )
|
|
$("#calibration").text("Completed.");
|
|
else
|
|
$("#calibration").text("File is missing.");
|
|
|
|
if( cfg["test"] )
|
|
$("#test").text("Completed.");
|
|
else
|
|
$("#test").text("File is missing.");
|
|
|
|
if( cfg["format"] )
|
|
$("#format").text("Completed.");
|
|
else
|
|
$("#format").text("File is missing.");
|
|
|
|
if( cfg["about"] )
|
|
$("#about").text("Completed.");
|
|
else
|
|
$("#about").text("File is missing.");
|
|
|
|
|
|
})
|
|
.fail(function () {
|
|
showError('Unable to get data from the device.');
|
|
})
|
|
.always(function() {
|
|
$('#spinner').hide();
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<!-- START FOOTER -->
|
|
|
|
<div class="container themed-container bg-primary text-light row-margin-10">(C) Copyright 2021-22 Magnus Persson</div>
|
|
</body>
|
|
</html> |