forked from yangzhong-freebsd/lua-httpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_page.html
179 lines (166 loc) · 5.21 KB
/
main_page.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{lang["Install FreeBSD"][cur_lang]}}</title>
<link rel="stylesheet" href="/style">
</head>
<body>
<script>
function writePkgsets() {
let pkgsets = document.getElementsByName("packages");
selected_sets = [...pkgsets].filter(set => set.checked).map(set => set.value);
fetch("/pkgsets", {
method : "POST",
body : JSON.stringify(selected_sets),
});
}
function startup() {
let pkgsets = document.getElementsByName("packages");
pkgsets.forEach(set => {
set.addEventListener("change", writePkgsets);
});
}
window.addEventListener("load", startup);
</script>
<div class="wrapper">
<div class="column is-narrow">
<div class="section">
<header class="header">
<h1 class="title">{{lang["Install FreeBSD"][cur_lang]}}</h1>
<a class="link" href="/language">{{lang["Change language"][cur_lang]}}</a>
</header>
</div>
<div class="section-box section-box-nested">
<header class="sub-box">
<h2>{{lang["Settings"][cur_lang]}}</h2>
</header>
<div class="sub-box-table">
<table>
<tr>
<th>{{lang["Keymap"][cur_lang]}}</th>
<td>{{keymap_string}}<a href="/keymap" class="link change-link">{{lang["Change"][cur_lang]}}</a></td>
</tr>
<tr>
<th>{{lang["Timezone"][cur_lang]}}</th>
<td>Setting goes here</td>
</tr>
</table>
</div>
</div>
<div class="section-box section-box-nested">
<header class="sub-box">
<h2>{{lang["Network"][cur_lang]}}</h2>
</header>
<div class="sub-box">
<div>{{network_string}}</div> <!--TODO rename these 'strings' -->
<a class="button" href="/network">{{lang["Configure the network"][cur_lang]}}</a>
</div>
</div>
<div class="section-box section-box-nested">
<header class="sub-box">
<h2>{{lang["Filesystem"][cur_lang]}}</h2>
</header>
<div class="sub-box">
<div>
{% for dev, info in pairsByKeys(disks) do %}
{% if selected_disks[dev] then %}
<div>
{{info["Disk descr."]}}
({{info["mediasize in bytes human"]}})
</div>
{% end %}
{% end %}
</div>
<a class="button" href="/zfs">{{lang["Configure ZFS"][cur_lang]}}</a>
</div>
</div>
<div class="section-box section-box-nested">
<header class="sub-box" id="users">
<h2>{{lang["Users"][cur_lang]}}</h2>
</header>
{% if #users ~= 0 then %}
<div class="sub-box-table">
<table class="users">
<thead>
<tr>
<th>{{lang["Username"][cur_lang]}}</th>
<th>{{lang["Full name"][cur_lang]}}</th>
<th>{{lang["Groups"][cur_lang]}}</th>
<th>{{lang["Shell"][cur_lang]}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{% for _, usr in ipairs(users) do %}
<tr>
<td>{{usr.username}}</td>
<td>{{usr.full_name}}</td>
<td>{{usr.groups}}</td>
<td>{{usr.shell}}</td>
<td><a class="link" href="/edituser/{{usr.username}}">{{lang["Edit"][cur_lang]}}</a></td>
<td>
<form action="/deleteuser/{{usr.username}}" method="POST">
<input name="test" hidden></input> <!-- TODO: fix forms so that I can have empty submissions -->
<button class="link delete" type="submit">x</button>
</form>
</td>
</tr>
{% end %}
</tbody>
</table>
</div>
{% end %}
<div class="sub-box">
<a href="/adduser" class="button">+ {{lang["Add user"][cur_lang]}}</a>
</div>
</div>
<form action="/install" method="POST">
<div class="section-box section-box-nested">
<header class="sub-box">
<h2>{{lang["Packages"][cur_lang]}}</h2>
</header>
<div class="sub-box">
<p class="description">{{lang["Select the packages to be installed on your system."][cur_lang]}}</p>
{% for _, pkgset in ipairs(packages) do %}
<label class="grouped">
<input type="checkbox" value={{pkgset.name}} name="packages"
{{checked(selected_packages[pkgset.name])}} {{disabled(pkgset.vital)}}>
{{pkgset.name_human}}
</input>
</label>
{% end %}
</div>
</div>
<div class="section-box section-box-nested">
<header class="sub-box">
<h2>{{lang["System Settings"][cur_lang]}}</h2>
</header>
<div class="sub-box">
<label>
<span class="label">{{lang["Hostname"][cur_lang]}}</span>
<input class="input" type="text" name="hostname" value="freebsd">
</label>
</div>
<div class="sub-box">
<label>
<span class="label">{{lang["Root password"][cur_lang]}}</span>
<input class="input" type="password" name="root_password"
placeholder="{{lang["enter password..."][cur_lang]}}">
</label>
</div>
</div>
<div class="section">
<div class="field">
<div class="control">
<button class="button primary" type="submit" {{disabled(not ready)}}>{{lang["Install"][cur_lang]}}</button>
</div>
</div>
</div>
</form>
</div>
</div>
</body>
</html>