some frontend refacoring

This commit is contained in:
Bogdan Pilyugin 2023-07-16 16:50:02 +02:00
parent 0f9e17cae9
commit 9ea09b3392
3 changed files with 13 additions and 5 deletions

View File

@ -7,7 +7,7 @@
<link rel="stylesheet" href="res/iconsfont.css"> <link rel="stylesheet" href="res/iconsfont.css">
<script src="res/main.js"></script> <script src="res/main.js"></script>
<script src="res/res.js"></script> <script src="res/res.js"></script>
<script src="res/vue.global.prod_3_3_4.js"></script> <script src="res/vue.global.prod.js"></script>
<title>~name~</title> <title>~name~</title>
<style> <style>
.svldetails{ .svldetails{
@ -59,7 +59,8 @@
const app = Vue.createApp({ const app = Vue.createApp({
data(){ data(){
return { return {
slvdevices: [] slvdevices: [],
selecteddevs: []
} }
} }
}); });
@ -103,7 +104,7 @@
this.slvdevices.splice(i,1); this.slvdevices.splice(i,1);
} }
}, },
postData() { PostData() {
fetch("\dmxmaster.html", { fetch("\dmxmaster.html", {
method: 'post', method: 'post',
headers: { headers: {
@ -112,6 +113,13 @@
body: JSON.stringify(this.slvdevices) body: JSON.stringify(this.slvdevices)
}); });
} }
},
computed: {
selected: function(){
this.selecteddevs = this.slvdevices.filter(function (n) {
return this.slvdevices[n].sel;
})
}
}, },
template: `<div> template: `<div>
<button class="btn" v-on:click="AddDevice">Add device</button> <button class="btn" v-on:click="AddDevice">Add device</button>
@ -123,7 +131,7 @@
<svldetails v-for="slvdev in slvdevices" :key="slvdev.id" :slvdev="slvdev"></svldetails> <svldetails v-for="slvdev in slvdevices" :key="slvdev.id" :slvdev="slvdev"></svldetails>
</div> </div>
<button class="btn" v-on:click="DelDevice">Delete device</button> <button class="btn" v-on:click="DelDevice">Delete device</button>
<button class="btn" v-on:click="postData">Save conf</button> <button class="btn" v-on:click="PostData">Save conf</button>
</div>` </div>`
}); });
app.mount('#app'); app.mount('#app');

View File

@ -30,6 +30,6 @@ res/logo.png
res/main.js res/main.js
res/res.js res/res.js
res/styles.css res/styles.css
res/vue.global.prod_3_3_4.js res/vue.global.prod.js
services.html services.html
system.html system.html