some disks refactoring
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
from flask import Blueprint
|
from flask import Blueprint
|
||||||
|
|
||||||
bp = Blueprint('disks', __name__,
|
bp = Blueprint('disks', __name__,
|
||||||
template_folder='')
|
template_folder='',
|
||||||
|
static_folder='static',
|
||||||
|
static_url_path='/disks/static')
|
||||||
|
|
||||||
from yasi_applets.disks import routes
|
from yasi_applets.disks import routes
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1,33 +1,6 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %}
|
||||||
{% block body %}
|
{% 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
|
|
||||||
<!-- 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>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<br>
|
<br>
|
||||||
<!--
|
<!--
|
||||||
<div style="">
|
<div style="">
|
||||||
58
src/yasi_applets/disks/disks_erase_menu.html
Normal file
58
src/yasi_applets/disks/disks_erase_menu.html
Normal 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'] }}: </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;">
|
||||||
|
<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 %}
|
||||||
60
src/yasi_applets/disks/disks_welcome.html
Normal file
60
src/yasi_applets/disks/disks_welcome.html
Normal 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>
|
||||||
@@ -5,6 +5,50 @@ import dmm.lsblk as lsblk
|
|||||||
from flask import current_app
|
from flask import current_app
|
||||||
|
|
||||||
@bp.route('/disks')
|
@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():
|
def disks():
|
||||||
"""
|
"""
|
||||||
Disks screen for the webui.
|
Disks screen for the webui.
|
||||||
@@ -25,7 +69,7 @@ def disks():
|
|||||||
bottom_menu = ""
|
bottom_menu = ""
|
||||||
build_summary()
|
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=current_app.config['CONFIG']['settings']['menu'],
|
||||||
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
|
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
|
||||||
previous_step = previous_step_url,
|
previous_step = previous_step_url,
|
||||||
|
|||||||
BIN
src/yasi_applets/disks/static/img/advanced_partitioning.png
Normal file
BIN
src/yasi_applets/disks/static/img/advanced_partitioning.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 159 KiB |
BIN
src/yasi_applets/disks/static/img/erase_disk.png
Normal file
BIN
src/yasi_applets/disks/static/img/erase_disk.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 147 KiB |
BIN
src/yasi_applets/disks/static/img/erase_partition.png
Normal file
BIN
src/yasi_applets/disks/static/img/erase_partition.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 130 KiB |
BIN
src/yasi_applets/disks/static/img/install_alongside.png
Normal file
BIN
src/yasi_applets/disks/static/img/install_alongside.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 128 KiB |
BIN
src/yasi_applets/disks/static/img/preconfigured_partitioning.png
Normal file
BIN
src/yasi_applets/disks/static/img/preconfigured_partitioning.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 141 KiB |
Reference in New Issue
Block a user