Skip to content

Commit 41ddc5f

Browse files
authored
Allow custom drive sizes in bespoke UI; other sundry improvements (#813)
* Allow custom drive image sizes in the bespoke UI. Addresses Issue#748 * Clarify what the Pi repo mirror setup is good for. * Use the number input type for rudimentary input validation. * Append byte unit. * More granular input validation using html5 attributes. Max allowed input is 256GiB in bytes. * Correct use of html5 number input elements.
1 parent eeae12a commit 41ddc5f

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

python/web/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ You may edit the files under `mock/bin` to simulate Linux command responses.
2121
TODO: rascsi-web uses protobuf commands to send and receive data from rascsi.
2222
A separate mocking solution will be needed for this interface.
2323

24-
## Pushing to the Pi via git
24+
## (Optional) Pushing to the Pi via git
25+
26+
This is a setup for pushing code changes from your local development environment to the Raspberry Pi without a roundtrip to the remote GitHub repository.
2527

2628
Setup a bare repo on the rascsi
2729
```

python/web/src/templates/drives.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h2>{{ _("Hard Drives") }}</h2>
3434
<input type="hidden" name="revision" value="{{ hd.revision }}">
3535
<input type="hidden" name="blocks" value="{{ hd.blocks }}">
3636
<input type="hidden" name="block_size" value="{{ hd.block_size }}">
37-
<input type="hidden" name="size" value="{{ hd.size }}">
37+
{{ _("Size:") }} <input type="number" name="size" min="512" max="274877906944" step="512" value="{{ hd.size }}">{{ _("B") }}
3838
<input type="hidden" name="file_type" value="{{ hd.file_type }}">
3939
<label for="file_name">{{ _("Save as:") }}</label>
4040
<input type="text" name="file_name" value="{{ hd.secure_name }}" required />.{{ hd.file_type }}
@@ -124,7 +124,7 @@ <h2>{{ _("Removable Drives") }}</h2>
124124
<input type="hidden" name="revision" value="{{ rm.revision }}">
125125
<input type="hidden" name="blocks" value="{{ rm.blocks }}">
126126
<input type="hidden" name="block_size" value="{{ rm.block_size }}">
127-
<input type="hidden" name="size" value="{{ rm.size }}">
127+
{{ _("Size:") }} <input type="number" name="size" min="512" max="274877906944" step="512" value="{{ rm.size }}">{{ _("B") }}
128128
<input type="hidden" name="file_type" value="{{ rm.file_type }}">
129129
<label for="file_name">{{ _("Save as:") }}</label>
130130
<input type="text" name="file_name" value="{{ rm.secure_name }}" required />.{{ rm.file_type }}

python/web/src/templates/index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@
258258
{% endfor %}
259259
</select>
260260
<label for="unit">{{ _("LUN") }}</label>
261-
<input name="unit" type="number" size="2" value="0" min="0" max="31">
261+
<input name="unit" type="number" value="0" min="0" max="31" step="1">
262262
{% if file["detected_type"] != "UNDEFINED" %}
263263
<input name="type" type="hidden" value="{{ file['detected_type'] }}">
264264
{{ file['detected_type_name'] }}
@@ -337,7 +337,7 @@
337337
{% for key, value in device_types[type]["params"].items() %}
338338
<label for="{{ key }}">{{ key }}:</label>
339339
{% if value.isnumeric() %}
340-
<input name="{{ key }}" type="number" size="{{ value|length }}" value="{{ value }}">
340+
<input name="{{ key }}" type="number" value="{{ value }}">
341341
{% elif key == "interface" %}
342342
<select name="interface">
343343
{% for if in netinfo["ifs"] %}
@@ -359,7 +359,7 @@
359359
{% endfor %}
360360
</select>
361361
<label for="unit">{{ _("LUN") }}</label>
362-
<input name="unit" type="number" size="2" value="0" min="0" max="31">
362+
<input name="unit" type="number" value="0" min="0" max="31" step="1">
363363
<input type="submit" value="{{ _("Attach") }}">
364364
</form>
365365
</td>
@@ -416,7 +416,7 @@
416416
gb: "{{ _("GB") }}",
417417
mb: "{{ _("MB") }}",
418418
kb: "{{ _("KB") }}",
419-
b: "{{ _("b") }}"
419+
b: "{{ _("B") }}"
420420
}
421421
}
422422
</script>
@@ -572,7 +572,7 @@
572572
</option>
573573
</select>
574574
<label for="size">{{ _("Size:") }}</label>
575-
<input name="size" type="number" placeholder="{{ _("MB") }}" min="1" size="6" required>
575+
<input name="size" type="number" placeholder="{{ _("MB") }}" min="1" max="262144" required>
576576
<input type="submit" value="{{ _("Create") }}">
577577
</form>
578578
</td>
@@ -607,7 +607,7 @@
607607
<td style="border: none; vertical-align:top;">
608608
<form action="/logs/show" method="post">
609609
<label for="lines">{{ _("Log Lines:") }}</label>
610-
<input name="lines" type="number" value="200" min="1" size="4">
610+
<input name="lines" type="number" value="200" min="0" max="99999" step="100">
611611
<label for="scope">{{ _("Scope:") }}</label>
612612
<select name="scope">
613613
<option value="">

0 commit comments

Comments
 (0)