Compare commits

..

4 Commits

Author SHA1 Message Date
Jonathan Carter
87799719c2 Add images and gitignore 2026-02-04 09:09:00 +02:00
Jonathan Carter
401bfb55d9 some disks refactoring 2026-01-14 13:47:36 +02:00
Jonathan Carter
1c4656ade3 merge 2026-01-12 12:21:46 +02:00
Jonathan Carter
7337daac01 Submit local changes 2026-01-12 12:20:15 +02:00
16 changed files with 251 additions and 27 deletions

2
src/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
__pycache__
.swp

View File

@@ -1,7 +1,9 @@
from flask import Blueprint
bp = Blueprint('disks', __name__,
template_folder='')
template_folder='',
static_folder='static',
static_url_path='/disks/static')
from yasi_applets.disks import routes

View File

@@ -1,31 +1,6 @@
{% extends "layout.html" %}
{% block body %}
<div style="">
<p><b>How would you like to install Debian?</b></p>
<br>
<div class="radios">
<label class="radio">
<input selected type="radio" name="rsvp" />
Preconfigured partitioning &nbsp;
<!-- Let's hide these babies for the initial release.
<label class="radio">
<input type="radio" name="rsvp" disabled />
Erase entire disk
</label>
<label class="radio">
<input type="radio" name="rsvp" disabled />
Install alongside another operating system
</label>
<label class="radio">
<input type="radio" name="rsvp" disabled />
Edit existing partitions
</label>
-->
</div>
<br>
<!--
<div style="">

View File

@@ -0,0 +1,58 @@
{% extends "layout.html" %}
{% block body %}
<p><b>Please confirm the disk to erase:</b></p>
{% for disk in blockdevs["blockdevices"] if disk["name"] != "zram0" and "loop" not in disk["name"] and disk["name"] != "sr0" %}
<div style="padding-top: 20px;"> <!-- partition bars -->
<div style="background-color: gray; padding: 4px 6px 7px 6px; border-radius: 10px;">
<p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black">
<b>{{ disk['name'] }}: &nbsp; </b> {{ disk['model'] }} - {{ disk['tran'] }} disk ({{(disk['size']/1024000000)|round(0)|int }} GB) - Serial: {{ disk['serial'] }} </p>
<center style="padding: 5px; padding-bottom: 5px;">
<td><a hx-get="/disks/choose_disk_erase_disk/{{ disk['name'] }}" hx-swap="outerHTML"><span class="tag is-link"> Select Disk </span></a></td>
</center>
{% if disk['maj:min'] == "252:0" %}
<div class="column">
<div class="box" style="width: 100%; border-radius: 0 0 0px 5px; height: 60px; padding-top: 5px; right: 0px;">
<span class="tag is-link">swap</span>
</p>
</div>
</div>
{% endif %}
{% set colors = ['teal', '#E69F00', '#56B4E9', '#009E73', '#0072B2', '#D55E00', '#CC79A7'] %}
<div id="percentagebar" style="width: 100%; height: 50px; background-color: transparent; display: inline-block; margin: 5; padding: 5; overflow: hidden; display: flex;">
{% for child in disk['children'] %}
<a hx-get="/disks/partition/{{ child['name'] }}" hx-swap="outerHTML">
<div style="min-width: 100px; width: {{ (((child['size'] / disk['size'])*100)|round(0)|int) }}%; height: 100%; background-color: {{ colors[loop.index0 % colors|length] }}; display: inline-block; margin: 1; padding: 1; border-radius: 8px;">
&nbsp; <a hx-get="/disks/partition/{{ child['name'] }}" hx-swap="outerHTML"> <font color="white">{{ child['name'] }} </font>
</div></a>
{% endfor %}
</div>
<table width="100%">
<th>Partition</th>
<th>Type</th>
<th>Mount Point</th>
<th>Label</th>
<th>Size</th>
<th>Used</th>
{% for child in disk['children'] %}
<tr>
<td><a hx-get="/disks/partition/{{ child['name'] }}" hx-swap="outerHTML"><span class="tag is-link">{{ child['name'] }}</span></a></td>
<td>{{ child['fstype'] }}</td>
<td>{{ child['mountpoint'] }}</td>
<td>{{ child['label'] }} </td>
<td>{{ (child['size']/1024000000)|round(2) }} GiB </td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endfor %}
{% endblock %}

View File

@@ -0,0 +1,60 @@
{% extends "layout.html" %}
{% block body %}
<p><b>How would you like to install Debian?</b></p>
<br>
<center>
<a href="">
<div style="width: 200px; float: left; padding: 10px; color: white;">
<img width="130px;" src="/disks/static/img/install_alongside.png"><br>
Install next to existing partition
</div>
</a>
<a href="/disks/choose_partition_erase">
<div style="width: 200px; float: left; padding: 10px; color: white;">
<img width="130px;" src="/disks/static/img/erase_partition.png"><br>
Replace a partition
</div>
</a>
<a href="/disks/choose_disk_erase">
<div style="width: 200px; float: left; padding: 10px; color: white;">
<img width="130px;" src="/disks/static/img/erase_disk.png"><br>
Erase entire disk
</div>
</a>
<a href="/disks/advanced">
<div style="width: 200px; float: left; padding: 10px; color: white;">
<img width="130px;" src="/disks/static/img/advanced_partitioning.png"><br>
Advanced partitioning
</div>
</a>
<a href="">
<div style="width: 200px; float: left; padding: 10px; color: white;">
<img width="130px;" src="/disks/static/img/preconfigured_partitioning.png"><br>
Preconfigured Partitioning
</div>
</a>
</center>
<div style="float: none;">
<p> <b>The following devices have been detected:</b>
<br><br>
<ul>
{% for disk in blockdevs["blockdevices"] if disk["name"] != "zram0" and "loop" not in disk["name"] and disk["name"] != "sr0" %}
<li>{{ disk['name'] }}
{% endfor %}
</ul>
{% endblock %}
</div>

View File

@@ -5,6 +5,50 @@ import dmm.lsblk as lsblk
from flask import current_app
@bp.route('/disks')
def disks_welcome():
"""
Welcome menu for partitioning
"""
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
next_step_url = menu[menu.index("disks")+1]
if menu[menu.index("disks")] == 1:
previous_step_url = False
else:
previous_step_url = menu[menu.index("disks")-1]
blockdevs = lsblk.list_block_devices()
return render_template('disks_welcome.html',
menu=current_app.config['CONFIG']['settings']['menu'],
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
previous_step = previous_step_url,
next_step=next_step_url, blockdevs=blockdevs
)
@bp.route('/disks/choose_disk_erase')
def disks_choose_disk_erase():
"""
Choose a disk to erase
"""
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
next_step_url = menu[menu.index("disks")+1]
if menu[menu.index("disks")] == 1:
previous_step_url = False
else:
previous_step_url = menu[menu.index("disks")-1]
blockdevs = lsblk.list_block_devices()
return render_template('disks_erase_menu.html',
menu=current_app.config['CONFIG']['settings']['menu'],
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
previous_step = previous_step_url,
next_step=next_step_url, blockdevs=blockdevs
)
@bp.route('/disks/advanced')
def disks():
"""
Disks screen for the webui.
@@ -25,7 +69,7 @@ def disks():
bottom_menu = ""
build_summary()
return render_template('disks.html', blockdevs=blockdevs,
return render_template('disks_advanced.html', blockdevs=blockdevs,
menu=current_app.config['CONFIG']['settings']['menu'],
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
previous_step = previous_step_url,

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

View File

@@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24">
<defs id="defs3051">
<style type="text/css" id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
</defs>
<g transform="translate(1,1)">
<path style="fill:currentColor" d="M 8 3 L 8 5 L 3 5 L 3 7 L 11.6 7 C 11.1 8.5 10.3 9.4 9.1855469 10.681641 C 8.4665869 9.885369 7.8700275 8.91997 7.3984375 8 L 5.8535156 8 C 6.4178656 9.26012 7.1899 10.542606 8.15625 11.617188 L 4.2207031 15.498047 L 5.3183594 16.595703 L 9.1855469 12.730469 L 11.589844 15.134766 L 12.175781 13.558594 L 10.212891 11.617188 L 10.236328 11.59375 C 11.581488 10.09397 12.43566 8.82447 13 7 L 15 7 L 15 5 L 10 5 L 10 3 L 8 3 z M 14.982422 10 L 11.503906 19 L 13.050781 19 L 13.916016 16.595703 L 17.587891 16.595703 L 18.460938 19 L 20.007812 19 L 16.529297 10 L 14.982422 10 z M 15.755859 11.703125 L 17.007812 15.050781 L 14.503906 15.050781 L 15.755859 11.703125 z " class="ColorScheme-Text"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
viewBox="0 0 24 24"
width="24"
height="24"
version="1.1"
id="svg1"
sodipodi:docname="lang_w.svg"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="48.375"
inkscape:cx="11.989664"
inkscape:cy="12"
inkscape:window-width="2560"
inkscape:window-height="1364"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<defs
id="defs3051">
<style
type="text/css"
id="current-color-scheme">
.ColorScheme-Text {
color:#232629;
}
</style>
</defs>
<g
transform="translate(1,1)"
id="g1"
style="fill:#deddda">
<path
style="fill:#deddda"
d="M 8 3 L 8 5 L 3 5 L 3 7 L 11.6 7 C 11.1 8.5 10.3 9.4 9.1855469 10.681641 C 8.4665869 9.885369 7.8700275 8.91997 7.3984375 8 L 5.8535156 8 C 6.4178656 9.26012 7.1899 10.542606 8.15625 11.617188 L 4.2207031 15.498047 L 5.3183594 16.595703 L 9.1855469 12.730469 L 11.589844 15.134766 L 12.175781 13.558594 L 10.212891 11.617188 L 10.236328 11.59375 C 11.581488 10.09397 12.43566 8.82447 13 7 L 15 7 L 15 5 L 10 5 L 10 3 L 8 3 z M 14.982422 10 L 11.503906 19 L 13.050781 19 L 13.916016 16.595703 L 17.587891 16.595703 L 18.460938 19 L 20.007812 19 L 16.529297 10 L 14.982422 10 z M 15.755859 11.703125 L 17.007812 15.050781 L 14.503906 15.050781 L 15.755859 11.703125 z "
class="ColorScheme-Text"
id="path1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB