Made internet setup reactive

This commit is contained in:
Patrick Hatsune 2024-09-17 02:28:54 -07:00
parent c6d94af8e7
commit 5295926757
Signed by: keyemail
GPG key ID: 6FD1A0FDB0D914C2
3 changed files with 108 additions and 60 deletions

View file

@ -1,67 +1,114 @@
<script lang="ts" setup>
import { shallowRef } from 'vue'
const pageTitle="Internet Setup"
interface sectionsType {
title: string,
ID: string,
forms: {
name: string,
class: string,
option: string,
label: string
}[]
}
const sections = shallowRef<sectionsType[]>([]);
sections.value = [
{
title: "Does your internet require a login?",
ID: "internetSetupLogin",
forms: [
{
name: "internetLoginOption",
class: "selectOption",
option: "radio",
label: "Yes"
},
{
name: "internetLoginOption",
class: "selectOption",
option: "radio",
label: "No"
}
]
},
{
title: "Internet IP Address",
ID: "internetSetupIP",
forms: [
{
name: "internetIPOption",
class: "selectOption",
option: "radio",
label: "Dynamic IP from ISP"
},
{
name: "internetIPOption",
class: "selectOption",
option: "radio",
label: "Static IP from ISP"
}
]
},
{
title: "DNS (Domain Name Server) Address",
ID: "internetSetupDNS",
forms: [
{
name: "internetDNSOption",
class: "selectOption",
option: "radio",
label: "Automatic DNS from ISP"
},
{
name: "internetDNSOption",
class: "selectOption",
option: "radio",
label: "Select DNS Servers"
}
]
}, {
title: "Router MAC Address",
ID: "internetSetupMAC",
forms: [
{
name: "internetMACOption",
class: "selectOption",
option: "radio",
label: "Default Address"
},
{
name: "internetMACOption",
class: "selectOption",
option: "radio",
label: "Computer MAC Address"
},
{
name: "internetMACOption",
class: "selectOption",
option: "radio",
label: "Specific MAC Adress"
}
]
}
]
</script>
<template> <template>
<div id="internetSetupComponent"> <div id="internetSetupComponent">
<h2 class="title">Internet Setup</h2> <h2 class="title">{{ pageTitle }}</h2>
<section id="internetSetupLogin"> <section v-for="section in sections" :id="section.ID" :key="section.ID">
<h3>Does your internet connection require a login?</h3> <h3>{{ section.title }}</h3>
<!-- Backend required to finish -->
<form> <form>
<label class="selectOption"> <label :class="form.class" v-for="(form, index) in section.forms">
<input type="radio" name="internetLoginOption" value="1"> <input :type="form.option" :name="form.name" :value="index + 1" :key="form.label">
Yes {{ form.label }}
</label>
<label class="selectOption">
<input type="radio" name="internetLoginOption" value="2">
No
</label> </label>
</form> </form>
</section>
<div class="seperator"></div> <div class="seperator"></div>
<section id="internetSetupIP">
<h3>Internet IP Address</h3>
<form>
<label class="selectOption">
<input type="radio" name="internetIPOption" value="1">
Dynamic IP from ISP
</label>
<label class="selectOption">
<input type="radio" name="internetIPOption" value="2">
Static IP from ISP
</label>
</form>
</section> </section>
<div class="seperator"></div>
<section>
<h3>DNS (Domain Name Server) Address</h3>
<form>
<label class="selectOption">
<input type="radio" name="internetDNSOption" value="1">
Automatic DNS from ISP
</label>
<label class="selectOption">
<input type="radio" name="internetDNSOption" value="2">
Select DNS Servers
</label>
</form>
</section>
<div class="seperator"></div>
<section>
<h3>Router MAC Address</h3>
<form>
<label class="selectOption">
<input type="radio" name="internetMACOption" value="1">
Default Address
</label>
<label class="selectOption">
<input type="radio" name="internetMACOption" value="2">
Computer MAC Address
</label>
<label class="selectOption">
<input type="radio" name="internetMACOption" value="2">
Specific MAC Adress
</label>
</form>
</section>
<div class="seperator"></div>
</div> </div>
</template> </template>

View file

@ -111,7 +111,6 @@
<template> <template>
<div id="overviewComponent"> <div id="overviewComponent">
<h2 class="title">Overview</h2> <h2 class="title">Overview</h2>
<ul v-if="backendOnline">
<ul v-if="backendOnline"> <ul v-if="backendOnline">
<RouterLink :to="overviewItem.link" v-for="overviewItem in overviewItems"> <RouterLink :to="overviewItem.link" v-for="overviewItem in overviewItems">
<li> <li>
@ -122,7 +121,6 @@
</RouterLink> </RouterLink>
</ul> </ul>
<p class="error" v-else>Backend offline or not available, please try again later.</p> <p class="error" v-else>Backend offline or not available, please try again later.</p>
<p class="error" v-else>Backend offline or not available, please try again later.</p>
</div> </div>
</template> </template>

View file

@ -130,6 +130,9 @@
gap: 10px; gap: 10px;
} }
.seperator {
margin-top: 20px;
}
.selectOption { .selectOption {
display: flex; display: flex;
align-items: center; align-items: center;