Added labels, made options optional, default selected option

This commit is contained in:
Patrick Hatsune 2024-09-26 17:30:18 -07:00
parent c9b752f8e2
commit ad82a5f6f0
Signed by: keyemail
GPG key ID: A03C1F76E54247A0
3 changed files with 99 additions and 32 deletions

View file

@ -2,95 +2,148 @@
import { shallowRef } from 'vue' import { shallowRef } from 'vue'
const pageTitle="Internet Setup" const pageTitle="Internet Setup"
interface sectionsType { interface Sections {
title: string, title?: string,
ID: string, id: string,
forms: { selectedRadio?: number,
name: string, forms?: {
name?: string,
class: string, class: string,
option: string, option: string,
label: string label?: string,
}[] }[]
} }
const sections = shallowRef<sectionsType[]>([]); const sections = shallowRef<Sections[]>([]);
sections.value = [ sections.value = [
{ {
title: "Does your internet require a login?", title: "Does your internet require a login?",
ID: "internetSetupLogin", id: "internetSetupLogin",
selectedRadio: 0,
forms: [ forms: [
{ {
name: "internetLoginOption", name: "internetLoginOption",
class: "selectOption", class: "selectOption",
option: "radio", option: "radio",
label: "Yes" label: "Yes",
}, },
{ {
name: "internetLoginOption", name: "internetLoginOption",
class: "selectOption", class: "selectOption",
option: "radio", option: "radio",
label: "No" label: "No",
},
{
name: "internetLoginInput",
class: "inputOption",
option: "text",
label: "Username/Email",
},
{
name: "internetLoginInput",
class: "inputOption",
option: "password",
label: "Password",
} }
] ]
}, },
{ {
title: "Internet IP Address", title: "Internet IP Address",
ID: "internetSetupIP", id: "internetSetupIP",
selectedRadio: 0,
forms: [ forms: [
{ {
name: "internetIPOption", name: "internetIPOption",
class: "selectOption", class: "selectOption",
option: "radio", option: "radio",
label: "Dynamic IP from ISP" label: "Dynamic IP from ISP",
}, },
{ {
name: "internetIPOption", name: "internetIPOption",
class: "selectOption", class: "selectOption",
option: "radio", option: "radio",
label: "Static IP from ISP" label: "Static IP from ISP",
} },
{
name: "internetIPInput",
class: "inputOption",
option: "text",
label: "IP Address"
},
{
name: "internetIPInput",
class: "inputOption",
option: "text",
label: "IP Subnet Mask"
},
{
name: "internetIPInput",
class: "inputOption",
option: "text",
label: "Gateway IP Address"
},
] ]
}, },
{ {
title: "DNS (Domain Name Server) Address", title: "DNS (Domain Name Server) Address",
ID: "internetSetupDNS", id: "internetSetupDNS",
selectedRadio: 0,
forms: [ forms: [
{ {
name: "internetDNSOption", name: "internetDNSOption",
class: "selectOption", class: "selectOption",
option: "radio", option: "radio",
label: "Automatic DNS from ISP" label: "Automatic DNS from ISP",
}, },
{ {
name: "internetDNSOption", name: "internetDNSOption",
class: "selectOption", class: "selectOption",
option: "radio", option: "radio",
label: "Select DNS Servers" label: "Select DNS Servers",
} },
{
name: "internetDNSInput",
class: "inputOption",
option: "text",
label: "Primary DNS"
},
{
name: "internetDNSInput",
class: "inputOption",
option: "text",
label: "Secondary DNS"
},
] ]
}, { }, {
title: "Router MAC Address", title: "Router MAC Address",
ID: "internetSetupMAC", id: "internetSetupMAC",
selectedRadio: 0,
forms: [ forms: [
{ {
name: "internetMACOption", name: "internetMACOption",
class: "selectOption", class: "selectOption",
option: "radio", option: "radio",
label: "Default Address" label: "Default Address",
}, },
{ {
name: "internetMACOption", name: "internetMACOption",
class: "selectOption", class: "selectOption",
option: "radio", option: "radio",
label: "Computer MAC Address" label: "Computer MAC Address",
}, },
{ {
name: "internetMACOption", name: "internetMACOption",
class: "selectOption", class: "selectOption",
option: "radio", option: "radio",
label: "Specific MAC Adress" label: "Specific MAC Address",
} },
{
name: "internetMACInput",
class: "inputOption",
option: "text",
label: "MAC Address",
},
] ]
} }
] ]
@ -99,14 +152,28 @@
<template> <template>
<div id="internetSetupComponent"> <div id="internetSetupComponent">
<h2 class="title">{{ pageTitle }}</h2> <h2 class="title">{{ pageTitle }}</h2>
<section v-for="section in sections" :id="section.ID" :key="section.ID"> <section
v-for="section in sections"
:id="section.id"
:key="section.id"
>
<h3>{{ section.title }}</h3> <h3>{{ section.title }}</h3>
<form> <form v-if="section.forms">
<label :class="form.class" v-for="(form, index) in section.forms"> <label
<input :type="form.option" :name="form.name" :value="index + 1" :key="form.label"> :class="form.class"
v-for="(form, index) in section.forms"
>
<input
:type="form.option"
:name="form.name"
:value="form.option === 'radio' ? index : ''"
:checked="section.selectedRadio === index"
:key="form.label"
>
{{ form.label }} {{ form.label }}
</label> </label>
</form> </form>
<template v-else></template>
<div class="seperator"></div> <div class="seperator"></div>
</section> </section>
</div> </div>

View file

@ -35,7 +35,7 @@
<input type="checkbox"> <input type="checkbox">
Enable 20/40 MHz Coexistence Enable 20/40 MHz Coexistence
</label> </label>
<label class="inputName"> <label class="inputOption">
<input type="text" name="wirelessName" value="SomeRandomNetwork"/> <input type="text" name="wirelessName" value="SomeRandomNetwork"/>
Name (SSID) Name (SSID)
</label> </label>
@ -87,7 +87,7 @@
</label> </label>
Security Options Security Options
</label> </label>
<label class="inputName"> <label class="inputOption">
<input type="password" name="wirelessName" value="SomeRandomPassword"/> <input type="password" name="wirelessName" value="SomeRandomPassword"/>
Password (Network) Password (Network)
</label> </label>
@ -105,7 +105,7 @@
<input type="checkbox"> <input type="checkbox">
Enable 20/40 MHz Coexistence Enable 20/40 MHz Coexistence
</label> </label>
<label class="inputName"> <label class="inputOption">
<input type="text" name="wirelessName" value="SomeRandomNetwork"/> <input type="text" name="wirelessName" value="SomeRandomNetwork"/>
Name (SSID) Name (SSID)
</label> </label>
@ -157,7 +157,7 @@
</label> </label>
Security Options Security Options
</label> </label>
<label class="inputName"> <label class="inputOption">
<input type="password" name="wirelessName" value="SomeRandomPassword"/> <input type="password" name="wirelessName" value="SomeRandomPassword"/>
Password (Network) Password (Network)
</label> </label>

View file

@ -145,7 +145,7 @@
user-select: none; user-select: none;
cursor: pointer; cursor: pointer;
} }
.inputName { .inputOption {
display: flex; display: flex;
flex-direction: column-reverse; flex-direction: column-reverse;
input { input {