Some partition ui stuff

This commit is contained in:
Jonathan Carter
2026-01-11 21:19:29 +02:00
parent d823bdd251
commit 7eec15b7df
9 changed files with 92 additions and 12 deletions

View File

@@ -86,9 +86,11 @@ fssize: {{ child['fssize'] }}
<p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black"> <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> <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;"> <center style="padding: 5px; padding-bottom: 5px;">
<td><a hx-get="/disks/todo }}" hx-swap="outerHTML"><span class="tag is-link"> New Partition Table </span></a></td> <td><a hx-get="/disks/details/{{ disk['name'] }}" hx-swap="outerHTML"><span class="tag is-link"> Disk Details </span></a></td>
<td><a hx-get="/disks/todo }}" hx-swap="outerHTML"><span class="tag is-link"> Disk Details </span></a></td> <td><a hx-get="/disks/wipe_table/{{ disk['name'] }}" hx-swap="outerHTML"><span class="tag is-link"> Wipe Disk </span></a></td>
<td><a hx-get="/disks/todo }}" hx-swap="outerHTML"><span class="tag is-link"> Replicate Layout </span></a></td> <td><a hx-get="/disks/new_partition/{{ disk['name'] }}" hx-swap="outerHTML"><span class="tag is-link"> New Partition </span></a></td>
<td><a hx-get="/disks/replicate/{{ disk['name'] }}" hx-swap="outerHTML"><span class="tag is-link"> Replicate Layout </span></a></td>
<td><a hx-get="/disks/diagnostics/{{ disk['name'] }}" hx-swap="outerHTML"><span class="tag is-link"> Diagnostics </span></a></td>
</center> </center>
{% if disk['maj:min'] == "252:0" %} {% if disk['maj:min'] == "252:0" %}
@@ -102,11 +104,12 @@ fssize: {{ child['fssize'] }}
{% set colors = ['teal', '#E69F00', '#56B4E9', '#009E73', '#0072B2', '#D55E00', '#CC79A7'] %} {% set colors = ['teal', '#E69F00', '#56B4E9', '#009E73', '#0072B2', '#D55E00', '#CC79A7'] %}
<div id="percentagebar" style="width: 100%; height: 50px; background-color: white; display: inline-block; margin: 5; padding: 5; overflow: hidden; display: flex;"> <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'] %} {% for child in disk['children'] %}
<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; corners: rounded;"> <a hx-get="/disks/partition/{{ child['name'] }}" hx-swap="outerHTML">
&nbsp; {{ child['name'] }} <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;">
</div> &nbsp; <a hx-get="/disks/partition/{{ child['name'] }}" hx-swap="outerHTML"> <font color="white">{{ child['name'] }} </font>
</div></a>
{% endfor %} {% endfor %}
</div> </div>

View File

@@ -0,0 +1,40 @@
<div class="modal is-active">
<div class="modal-background"></div>
<div class="modal-content">
<div style="background-color: #424242; padding: 15px; border-radius: 15px; boders: none; color: white;">
<h1 class="is-size-4"> Disk: {{ disk }} </h1>
<p>
{% for pdisk in blockdevs["blockdevices"] if pdisk["name"] != "zram0" and "loop" not in pdisk["name"] and pdisk["name"] != "sr0" %}
{% if pdisk['name'] == disk %}
<p> Model: {{ pdisk['model'] }} </p>
<p> Revision: {{ pdisk['rev'] }} </p>
<p> Serial: {{ pdisk['serial'] }} </p>
<p> Link: {{ pdisk['id-link'] }} </p>
<p> Path: {{ pdisk['path'] }} </p>
<p> Label: {{ pdisk['label'] }} </p>
<p> Partition type: {{ pdisk['pttype'] }} </p>
<p> Interface: {{ pdisk['tran'] }} </p>
<p> Size: {{ pdisk['size'] }} </p>
<p> Flags: {{ pdisk['flags'] }} </p>
<p> UUID: {{ pdisk['uuid'] }} </p>
<p> Partitions: {{ pdisk['children']|count }} </p>
{% endif %}
{% endfor %}
</p>
<div class="columns">
<a href="/disks">
<div class="column"><button class="button is-light">Cancel</button></div>
</a>
<a href="/disks"><div class="column"><button class="button is-link">Continue</button></div></a>
</div>
</div>
</div>
</div>

View File

@@ -11,12 +11,11 @@
<div class="select"> <div class="select">
<select> <select>
<option>Local file system</option> <option>Local file system</option>
<option>Remote file system</option>
<option>Logical volume for ZFS zpool</option> <option>Logical volume for ZFS zpool</option>
<option>Logical volume for LVM</option> <option>Logical volume for LVM</option>
<option>Logical volume for LUKS encryption</option> <option>Logical volume for LUKS encryption</option>
<option>Logical volume for Linux (mdadm) RAID</option> <option>Logical volume for Linux (mdadm) RAID</option>
<option>Logical volume for Microsoft LDM RAID</option> <option>Logical volume for (existing) Microsoft LDM RAID</option>
<option>Swap partition</option> <option>Swap partition</option>
<option>Do not configure</option> <option>Do not configure</option>
</select> </select>
@@ -49,9 +48,6 @@
<option>jfs</option> <option>jfs</option>
<option>ntfs</option> <option>ntfs</option>
<option>vfat</option> <option>vfat</option>
<option>nfs</option>
<option>nbd</option>
<option>samba</option>
</select> </select>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,24 @@
<div class="modal is-active">
<div class="modal-background"></div>
<div class="modal-content">
<div style="background-color: #424242; padding: 15px; border-radius: 15px; boders: none; color: white;">
<h1 class="is-size-4"> Wipe partition: {{ disk }} </h1>
<p>Warning: wiping the partition table effectively destroys all data on the disk.</p>
<p>What kind of partition would you like to create? </p>
<p>DOS/MBR (Only use for legacy purposes, disks smaller than 2TB</p>
<p>GPT (Usable on all disk sizes, modern systems)</p>
<div class="columns">
<a href="/disks">
<div class="column"><button class="button is-light">Cancel</button></div>
</a>
<a href="/disks"><div class="column"><button class="button is-link">Continue</button></div></a>
</div>
</div>
</div>
</div>

View File

@@ -47,6 +47,23 @@ def disks_partition(part):
partition=partition) partition=partition)
@bp.route('/disks/details/<disk>')
def disks_details(disk):
"""
Show some details about a disk.
"""
blockdevs = lsblk.list_block_devices()
return render_template('disks_details.html', disk=disk, blockdevs=blockdevs)
@bp.route('/disks/wipe_table/<disk>')
def disks_wipe_table(disk):
"""
Create a new partition table
"""
return render_template('disks_wipe_partition.html', disk=disk)
def build_menu(): def build_menu():
""" """
Define menu items and paths. Define menu items and paths.