Skip to content

Commit

Permalink
pretty webserver pages
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanoTesla committed May 9, 2024
1 parent b0c14f1 commit 0865a55
Show file tree
Hide file tree
Showing 14 changed files with 260 additions and 160 deletions.
Binary file added data/assets/style.3995d9a9.css.gz
Binary file not shown.
Binary file removed data/assets/style.c7102921.css.gz
Binary file not shown.
Empty file added data/config.txt
Empty file.
Binary file modified data/index.html.gz
Binary file not shown.
Binary file modified data/setup.html.gz
Binary file not shown.
163 changes: 83 additions & 80 deletions html_pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,24 @@ <h1 class="text-center text-xl">StefanoTesla Dome&Switch</h1>
>

<div class="tab-header" >
<div class="grow">Dome</div>
<div class="grow"><b>Dome</b></div>
<div><button @click="open = ! open"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" stroke="#fff" fill="#fff"><path d="M12 3v2h5.586L5 17.586V12H3v9h9v-2H6.414L19 6.414V12h2V3h-9z"/></svg></button></div>
</div>

<div class="tab-content" x-show="open" x-transition>

<div class="flex text-xl pt-6">Roof State:
<template x-if="dome.actualState === 0"><p>Open</p></template>
<template x-if="dome.actualState === 1"><p>Close</p></template>
<template x-if="dome.actualState === 2"><p>Opening</p></template>
<template x-if="dome.actualState === 3"><p>Closing</p></template>
<template x-if="dome.actualState === 4"><p>Error</p></template>
</div>
<p class="flex text-xl pt-6 pr-2">Roof State:
<template x-if="dome.actualState === 0"><b>Open</b></template>
<template x-if="dome.actualState === 1"><b>Close</b></template>
<template x-if="dome.actualState === 2"><b>Opening</b></template>
<template x-if="dome.actualState === 3"><b>Closing</b></template>
<template x-if="dome.actualState === 4"><b>Error</b></template>
</p>
<div class="flex text-xl">Last Command:
<template x-if="dome.lastCommand === 0"><p>Idle</p></template>
<template x-if="dome.lastCommand === 1"><p>Opening</p></template>
<template x-if="dome.lastCommand === 2"><p>Closing</p></template>
<template x-if="dome.lastCommand === 3"><p>HALT</p></template>
<template x-if="dome.lastCommand === 0"><b>Idle</b></template>
<template x-if="dome.lastCommand === 1"><b>Opening</b></template>
<template x-if="dome.lastCommand === 2"><b>Closing</b></template>
<template x-if="dome.lastCommand === 3"><b>HALT</b></template>
</div>
<div class="grid grid-flow-row grid-rows-3 mx-auto gap-10 pt-6">
<button @click="shutterCmd(1)" class="px-12 py-2 bg-green-600 w-full" >Apri</button>
Expand All @@ -94,12 +94,13 @@ <h1 class="text-center text-xl">StefanoTesla Dome&Switch</h1>
</template>

<!-- COVER CALIBRATOR -->
<template x-if="exist.coverc">
<div class="main-tab bg-slate-600"
x-data="{open:false}"
>

<div class="tab-header" >
<div class="grow">Cover Calibrator</div>
<div class="grow"><b>Cover Calibrator</b></div>
<div><button @click="open = ! open"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" stroke="#fff" fill="#fff"><path d="M12 3v2h5.586L5 17.586V12H3v9h9v-2H6.414L19 6.414V12h2V3h-9z"/></svg></button></div>
</div>

Expand All @@ -110,76 +111,78 @@ <h1 class="text-center text-xl">StefanoTesla Dome&Switch</h1>
</div>

</div>
</template>

<!--SWITCH-->
<div class="main-tab bg-slate-600"
x-data="{open:false}">
<template x-if="exist.switch">
<div class="main-tab bg-slate-600"
x-data="{open:false}">

<div class="tab-header" >
<div class="grow">Switch</div>
<div><button @click="open = ! open"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" stroke="#fff" fill="#fff"><path d="M12 3v2h5.586L5 17.586V12H3v9h9v-2H6.414L19 6.414V12h2V3h-9z"/></svg></button></div>
</div>
<div class="tab-header" >
<div class="grow"><b>Switch</b></div>
<div><button @click="open = ! open"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" stroke="#fff" fill="#fff"><path d="M12 3v2h5.586L5 17.586V12H3v9h9v-2H6.414L19 6.414V12h2V3h-9z"/></svg></button></div>
</div>


<div class="tab-content pt-4" x-show="open" x-transition>
<div class="grid sm:grid-cols-2 gap-4 lg:grid-cols-3 items-stretch text-center">
<template x-for="swi in switches" :key="swi.id">
<div class="card_container">
<p class="card_title" x-text="swi.name"></p>
<p class="card_comment" x-text="swi.description"></p>

<div class="card_command">

<template x-if="swi.type == 3">
<input @change="setAnalogSwValue(swi.id,$event)" type="range" x-bind:min="swi.min" x-bind:max="swi.max" x-bind:value="swi.actualValue" class="py-2" />
</template>

<div class="tab-content pt-4" x-show="open" x-transition>
<div class="grid sm:grid-cols-2 gap-4 lg:grid-cols-3 items-stretch text-center">
<template x-for="swi in switches" :key="swi.id">
<div class="card_container">
<p class="card_title" x-text="swi.name"></p>
<p class="card_comment" x-text="swi.description"></p>

<div class="card_command">

<template x-if="swi.type == 3">
<input @change="setAnalogSwValue(swi.id,$event)" type="range" x-bind:min="swi.min" x-bind:max="swi.max" x-bind:value="swi.actualValue" class="py-2" />
</template>

<template x-if="swi.type == 1">
<div class="flex justify-center">
<button @click="setDigitalSwValue(swi.id,1)" class="button button_green">ON</button>
<button @click="setDigitalSwValue(swi.id,0)" class="button ml-5 button_red">OFF</button>
</div>
</template>

<template x-if="swi.type == 4">
<input type="range" x-bind:min="swi.min" x-bind:max="swi.max" x-bind:value="swi.actualValue" class="py-2 cursor-not-allowed" />
</template>

<template x-if="swi.type == 2">
<div class="flex justify-center">
<button class="button bg-slate-500 cursor-not-allowed">ON</button>
<button class="button bg-slate-500 ml-5 cursor-not-allowed">OFF</button>
</div>
</template>


<template x-if="swi.type == 1">
<div class="flex justify-center">
<button @click="setDigitalSwValue(swi.id,1)" class="button button_green">ON</button>
<button @click="setDigitalSwValue(swi.id,0)" class="button ml-5 button_red">OFF</button>
</div>
</template>

<template x-if="swi.type == 4">
<input type="range" x-bind:min="swi.min" x-bind:max="swi.max" x-bind:value="swi.actualValue" class="py-2 cursor-not-allowed" />
</template>

<template x-if="swi.type == 2">
<div class="flex justify-center">
<button class="button bg-slate-500 cursor-not-allowed">ON</button>
<button class="button bg-slate-500 ml-5 cursor-not-allowed">OFF</button>
</div>
</template>


</div>

<p>Valore Attuale:</p>
<template x-if="swi.type >= 2">
<div class="flex w-full flex-col justify-around ">
<p class="font-semibold" x-text="swi.actualValue"></p>
<p>Min: <span x-text="swi.actualValue"></span> Max: <span x-text="swi.max"></span></p>
</div>

</template>

<template x-if="swi.type <= 1">
<div class="w-full">
<div x-show="swi.actualValue" class="card_actual_value bg-green-600">ON</div>
<div x-show="!swi.actualValue" class="card_actual_value bg-red-600">OFF</div>
</div>
</template>


<p :id="$id('error-message')" class="py-2 bg-red-600 hidden">fdbdb</p>
</div>
</template>

<p>Valore Attuale:</p>
<template x-if="swi.type >= 2">
<div class="flex w-full flex-col justify-around ">
<p class="font-semibold" x-text="swi.actualValue"></p>
<p>Min: <span x-text="swi.actualValue"></span> Max: <span x-text="swi.max"></span></p>
</div>

</template>

<template x-if="swi.type <= 1">
<div class="w-full">
<div x-show="swi.actualValue" class="card_actual_value bg-green-600">ON</div>
<div x-show="!swi.actualValue" class="card_actual_value bg-red-600">OFF</div>
</div>
</template>


<p :id="$id('error-message')" class="py-2 bg-red-600 hidden">fdbdb</p>
</div>
</template>

</div>
</div>
</div>
</div>

</div>
</template>
<!--STATISTIC-->
<div class="main-tab bg-slate-600"
x-data="{open:false}"
Expand Down Expand Up @@ -233,7 +236,7 @@ <h1 class="text-center text-xl">StefanoTesla Dome&Switch</h1>

getDomeData(){
if (this.exist.dome){
fetch('http://172.20.10.5/api/dome')
fetch('/api/dome')
.then(response => response.json())
.then(response => {
this.dome = response.dome;
Expand All @@ -247,7 +250,7 @@ <h1 class="text-center text-xl">StefanoTesla Dome&Switch</h1>

getSwitchData(){
if (this.exist.switch){
fetch('http://172.20.10.5/api/switch')
fetch('/api/switch')
.then(response => response.json())
.then(response => {
this.switches = response.switches;
Expand All @@ -261,7 +264,7 @@ <h1 class="text-center text-xl">StefanoTesla Dome&Switch</h1>

getCoverData(){
if (this.exist.coverc) {
fetch('http://172.20.10.5/api/coverc')
fetch('/api/coverc')
.then(response => response.json())
.then(response => {
this.cover = response.cover;
Expand All @@ -275,7 +278,7 @@ <h1 class="text-center text-xl">StefanoTesla Dome&Switch</h1>
},

updateData(){
fetch('http://172.20.10.5/status')
fetch('/status')
.then(response => response.json())
.then(response => {
this.upTime = this.toHoursAndMinutes(response.upTime);
Expand All @@ -287,7 +290,7 @@ <h1 class="text-center text-xl">StefanoTesla Dome&Switch</h1>
},

initData(){
fetch('http://172.20.10.5/status')
fetch('/status')
.then(response => response.json())
.then(response => {
this.exist.dome = response.dome
Expand Down
21 changes: 21 additions & 0 deletions html_pages/prova.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>

</body>

<script>
let unusablePinForInput= [0,6,7,8,9,10,11,20,21,24,28,29,30,31,37,38]
let unusablePinForOutput= [0,6,7,8,9,10,11,20,21,24,28,29,30,31,34,35,36,37,38,39]
let pin =18
console.log(unusablePinForOutput)
console.log(18)
console.log(unusablePinForOutput.includes(parseInt(pin)))
console.log(unusablePinForOutput.indexOf(parseInt(pin)))
</script>
</html>
Loading

0 comments on commit 0865a55

Please sign in to comment.