|
@@ -20,30 +20,42 @@
|
|
|
<body>
|
|
|
<div id="settings" class="ui form">
|
|
|
</div>
|
|
|
- <div class="ui button" onclick="sendCmd()">Update</div>
|
|
|
+ <div class="ui button" onclick="submit()">Update</div>
|
|
|
</body>
|
|
|
<script>
|
|
|
- $.get("/properties", function(data) {
|
|
|
- if (data.length == 0) {
|
|
|
- $("#settings").html(`
|
|
|
+ updateInfo()
|
|
|
+
|
|
|
+ function updateInfo() {
|
|
|
+ $.get("/properties", function(data) {
|
|
|
+ if (data.length == 0) {
|
|
|
+ $("#settings").html(`
|
|
|
<div class="inline field">
|
|
|
<label>No item :(</label>
|
|
|
</div>
|
|
|
<div class="ui divider"></div>
|
|
|
`)
|
|
|
- return
|
|
|
- }
|
|
|
- $("#settings").html("");
|
|
|
- $.each(data, function(i, item) {
|
|
|
- $("#settings").append(`
|
|
|
+ return
|
|
|
+ }
|
|
|
+ $("#settings").html("");
|
|
|
+ $.each(data, function(i, item) {
|
|
|
+ $("#settings").append(`
|
|
|
<div class="inline field">
|
|
|
<label style="width:46vw">` + item.key + `</label>
|
|
|
<input style="width:46vw" type="text" id="` + item.key + `" placeholder="` + item.value + `" value="` + item.value + `">
|
|
|
</div>
|
|
|
<div class="ui divider"></div>
|
|
|
`)
|
|
|
+ })
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function submit() {
|
|
|
+ $.each($("input"), function(i, item) {
|
|
|
+ var key = $(item).attr("id");
|
|
|
+ var value = $(item).val();
|
|
|
+ $.get("/properties/change?key=" + key + "&value=" + value)
|
|
|
})
|
|
|
- });
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
</html>
|