play with config page
This commit is contained in:
parent
303bdd131f
commit
066b3ec24f
@ -1,7 +1,9 @@
|
||||
<html>
|
||||
<meta>
|
||||
<script src="ota.js"></script>
|
||||
<script src="jsoneditor.js"></script>
|
||||
</meta>
|
||||
|
||||
<body>
|
||||
<h2>firmeware OTA v3</h2>
|
||||
<form id="upload_form" method="post">
|
||||
@ -11,5 +13,60 @@
|
||||
<h3 id="answer"></h3>
|
||||
<p id="loaded_n_total"></p>
|
||||
</form>
|
||||
|
||||
<h2>config</h2>
|
||||
<div id="editor_holder" data-theme="html" class="je-ready">
|
||||
|
||||
</div>
|
||||
<button id="submit">Submit (console.log)</button>
|
||||
<script>
|
||||
// Initialize the editor with a JSON schema
|
||||
var editor = new JSONEditor(document.getElementById('editor_holder'),{
|
||||
schema: {
|
||||
type: "object",
|
||||
title: "Car",
|
||||
properties: {
|
||||
make: {
|
||||
type: "string",
|
||||
enum: [
|
||||
"Toyota",
|
||||
"BMW",
|
||||
"Honda",
|
||||
"Ford",
|
||||
"Chevy",
|
||||
"VW"
|
||||
]
|
||||
},
|
||||
model: {
|
||||
type: "string"
|
||||
},
|
||||
year: {
|
||||
type: "integer",
|
||||
enum: [
|
||||
1995,1996,1997,1998,1999,
|
||||
2000,2001,2002,2003,2004,
|
||||
2005,2006,2007,2008,2009,
|
||||
2010,2011,2012,2013,2014
|
||||
],
|
||||
default: 2008
|
||||
},
|
||||
safety: {
|
||||
type: "integer",
|
||||
format: "rating",
|
||||
maximum: "5",
|
||||
exclusiveMaximum: false,
|
||||
readonly: false
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Hook up the submit button to log to the console
|
||||
document.getElementById('submit').addEventListener('click',function() {
|
||||
// Get the value from the editor
|
||||
console.log(editor.getValue());
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -30,7 +30,6 @@ pub fn httpd(initial_config:bool) -> EspHttpServer<'static> {
|
||||
response.write(include_bytes!("ota.js"))?;
|
||||
return Ok(())
|
||||
}).unwrap();
|
||||
|
||||
server
|
||||
.fn_handler("/ota", Method::Post, |mut request| {
|
||||
let ota = OtaUpdate::begin();
|
||||
|
Loading…
Reference in New Issue
Block a user