66 lines
2.4 KiB
Python
66 lines
2.4 KiB
Python
from applets.disks import bp
|
|
from flask import Flask, request, session, redirect, \
|
|
url_for, render_template, flash, Blueprint
|
|
import dmm.lsblk as lsblk
|
|
from flask import current_app
|
|
|
|
@bp.route('/disks')
|
|
def disks():
|
|
"""
|
|
Disks screen for the webui.
|
|
"""
|
|
blockdevs = lsblk.list_block_devices()
|
|
print(lsblk.list_block_devices())
|
|
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]
|
|
|
|
add_disks_button = ' <button class="button iis-info"> <i class="fa fa-hdd-o" aria-hidden="true"></i> Add Disk or Filesystem </button>'
|
|
add_swap_button = ' <button class="button iis-info"> <i class="fa fa-object-group" aria-hidden="true"></i> Swap Configuration </button>'
|
|
bottom_menu = add_disks_button + add_swap_button
|
|
build_summary()
|
|
|
|
return render_template('disks.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,
|
|
next_step = next_step_url,
|
|
bottom_menu = bottom_menu)
|
|
|
|
|
|
@bp.route('/disks/partition/<part>')
|
|
def disks_partition(part):
|
|
"""
|
|
Partition modal for the webui partition screen.
|
|
"""
|
|
print("Partition is: " + part)
|
|
partition = part
|
|
return render_template('disks_partition.html',
|
|
menu=current_app.config['CONFIG']['settings']['menu'],
|
|
partition=partition)
|
|
|
|
|
|
def build_menu():
|
|
"""
|
|
Define menu items and paths.
|
|
"""
|
|
# proper one once translations are done:
|
|
#current_app.config['CONFIG']['settings']['menu']['welcome'] = (build_stringlist()['menu_item'], "/welcome", 10)
|
|
current_app.config['CONFIG']['settings']['menu']['disks'] = ("Disks", "/disks", 30)
|
|
|
|
|
|
def build_summary():
|
|
"""
|
|
Write up a summary of what this module will do.
|
|
"""
|
|
current_app.config['CONFIG']['Summary']['disks'] = {}
|
|
current_app.config['CONFIG']['Summary']['disks']['heading'] = "Disks and Partitions"
|
|
current_app.config['CONFIG']['Summary']['disks']['bleh'] = current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']
|
|
current_app.config['CONFIG']['Summary']['disks']['text'] = "Pre-configured disk layout."
|
|
return("ok?")
|
|
|
|
build_menu()
|