re-add yasi-applets
7
src/yasi_applets/disks/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
bp = Blueprint('disks', __name__,
|
||||||
|
template_folder='')
|
||||||
|
|
||||||
|
from yasi_applets.disks import routes
|
||||||
|
|
||||||
155
src/yasi_applets/disks/disks.html
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
{% 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 type="radio" name="rsvp" />
|
||||||
|
Preconfigured partitioning
|
||||||
|
<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 class="columns" width="100%">
|
||||||
|
<div class="column"><p> <br>Proposed layout: </p></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<div style="">
|
||||||
|
<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">Physical disk: TOSHIBA HDWD120 (2000 GB) <br>
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column is-narrow is-primary">
|
||||||
|
<div class="box" style="min-width: 220px; border-radius: 0 0 0px 5px; height: 60px; padding-top: 5px;">
|
||||||
|
<p class="is-tiny">/dev/sda1</p>
|
||||||
|
<p class="title is-5"><span class="tag is-black">/boot/efi</span>
|
||||||
|
<span class="tag is-dark">200 MB</span>
|
||||||
|
<span class="tag is-link">vfat</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<a hx-get="/disks/partition/sda" hx-swap="outerHTML"/>
|
||||||
|
<div class="column">
|
||||||
|
<div class="box" style="border-radius: 0 0 5px 0px; height: 60px; padding-top: 5px;">
|
||||||
|
<p class="is-tiny">/dev/sda2</p>
|
||||||
|
<p class="title is-5"><span class="tag is-black">/</span> <span class="tag is-dark">18 GB</span> <span class="tag is-link">btrfs</span></p>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<p> There are {{ blockdevs["blockdevices"]|count }} block devices detected. </p>
|
||||||
|
<p> They are </p>
|
||||||
|
<br>
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- {% for disk in blockdevs["blockdevices"] if disk["name"] != "zram0"%} -->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
|
||||||
|
<h1> Raw data </h1>
|
||||||
|
{{ disk }}
|
||||||
|
|
||||||
|
<h1> Children </h1>
|
||||||
|
|
||||||
|
{% for child in disk['children'] %}
|
||||||
|
|
||||||
|
<h2> <big><b> Child </b></big> </h2>
|
||||||
|
Path: {{ child['path'] }}
|
||||||
|
fstype: {{ child['fstype'] }}
|
||||||
|
fssize: {{ child['fssize'] }}
|
||||||
|
{{ child }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<div style=""> <!-- 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">
|
||||||
|
<small><small>{{ disk['name'] }} ({{(disk['size']/1024000000)|round(0)|int }} GB) - Serial: {{ disk['serial'] }}</small></small>
|
||||||
|
<div class="columns">
|
||||||
|
{% for child in disk['children'] %}
|
||||||
|
<a hx-get="/disks/partition/{{ child['name'] }}" hx-swap="outerHTML"/>
|
||||||
|
<div class="column is-narrow is-primary">
|
||||||
|
<div class="box" style="min-width: 220px; border-radius: 0 0 0px 5px; height: 60px; padding-top: 5px;">
|
||||||
|
<p class="is-tiny">{{ child['name'] }} ({{ (child['size']/1024000000)|round(2) }} GiB) </p>
|
||||||
|
<p class="title is-5"><span class="tag is-black">{{ child['mountpoint'] }}</span>
|
||||||
|
<span class="tag is-link">{{ child['fstype'] }}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
{% endfor %}
|
||||||
|
{% if disk['maj:min'] == "252:0" %}
|
||||||
|
<div class="column is-narrow is-primary">
|
||||||
|
<div class="box" style="width: 100%; border-radius: 0 0 0px 5px; height: 60px; padding-top: 5px; right: 0px;">
|
||||||
|
<p class="is-tiny"> {{ disk['name'] }} ({{ (disk['size']/1024000000)|round(2) }} GiB) </p>
|
||||||
|
<p class="title is-5"><span class="tag is-black">/dev/{{ disk['name'] }}</span>
|
||||||
|
<span class="tag is-link">swap</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
<p> Diskname: {{ disk['name'] }} </p>
|
||||||
|
<p> Model: {{ disk['model'] }} </p>
|
||||||
|
<p> Serial: {{ disk['serial'] }} </p>
|
||||||
|
<p> Removable: {{ disk['rm'] }} </p>
|
||||||
|
<p> Size: {{ disk['size'] | int / 1024000000 | round(2) }} GiB </p>
|
||||||
|
<p> ID: {{disk['id'] }} </p>
|
||||||
|
<p> pttype: {{disk['pttype'] }} </p>
|
||||||
|
<p> Maj:min: {{disk['maj:min']}} </p>
|
||||||
|
<p> phy-sec: {{ disk['phy-sec'] }}. log-sec: {{ disk['log-sec'] }} </p>
|
||||||
|
<p> There are {{ disk['children']|count }} Children </p>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
{% for child in disk['children'] %}
|
||||||
|
<br>
|
||||||
|
<p> Name: {{ child['name'] }}. Path: {{ child['path'] }}. {{ child['size'] }}. Block: {{ child['subsystems'] }} {{ child['maj:min'] }} {{ child['type'] }} </p>
|
||||||
|
<p> Fstype: {{ child['fstype'] }}. Label: {{ child['label'] }}. Rota: {{ child['rota'] }}</p>
|
||||||
|
<p> Parttypename: {{ child['parttypename'] }}
|
||||||
|
<br>
|
||||||
|
{% endfor %}
|
||||||
|
-->
|
||||||
|
|
||||||
|
<br>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<!-- Add Undetected Disk
|
||||||
|
Add Virtual Filesystem
|
||||||
|
Add Network Filesystem -->
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
88
src/yasi_applets/disks/disks_partition.html
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<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"> Edit partition: {{ partition }} </h1>
|
||||||
|
<p class="title is-6"><span class="tag is-black">Primary Partition</span>
|
||||||
|
|
||||||
|
<span>
|
||||||
|
<p>Select usage: <div class="control is-link">
|
||||||
|
<div class="select">
|
||||||
|
<select>
|
||||||
|
<option>Local file system</option>
|
||||||
|
<option>Remote file system</option>
|
||||||
|
<option>Logical volume for ZFS zpool</option>
|
||||||
|
<option>Logical volume for LVM</option>
|
||||||
|
<option>Logical volume for LUKS encryption</option>
|
||||||
|
<option>Logical volume for Linux (mdadm) RAID</option>
|
||||||
|
<option>Logical volume for Microsoft LDM RAID</option>
|
||||||
|
<option>Swap partition</option>
|
||||||
|
<option>Do not configure</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span>
|
||||||
|
<p>Select Mount Point: <div class="control is-link">
|
||||||
|
<div class="select">
|
||||||
|
<select>
|
||||||
|
<option>/</option>
|
||||||
|
<option>/usr</option>
|
||||||
|
<option>/var</option>
|
||||||
|
<option>Other...</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span>
|
||||||
|
<p>Select Filesystem: <div class="control is-link">
|
||||||
|
<div class="select">
|
||||||
|
<select>
|
||||||
|
<option is-active>btrfs</option>
|
||||||
|
<option>ext4</option>
|
||||||
|
<option>ext3</option>
|
||||||
|
<option>ext2</option>
|
||||||
|
<option>xfs</option>
|
||||||
|
<option>jfs</option>
|
||||||
|
<option>ntfs</option>
|
||||||
|
<option>vfat</option>
|
||||||
|
<option>nfs</option>
|
||||||
|
<option>nbd</option>
|
||||||
|
<option>samba</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="checkboxes">
|
||||||
|
<label class="checkbox">
|
||||||
|
<input type="checkbox" />
|
||||||
|
noatime
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="checkbox">
|
||||||
|
<input type="checkbox" />
|
||||||
|
nodiratime
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label class="checkbox">
|
||||||
|
<input type="checkbox" />
|
||||||
|
discard
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<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>
|
||||||
65
src/yasi_applets/disks/routes.py
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
from yasi_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()
|
||||||
7
src/yasi_applets/hardware/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
bp = Blueprint('hardware', __name__,
|
||||||
|
template_folder='')
|
||||||
|
|
||||||
|
from yasi_applets.hardware import routes
|
||||||
|
|
||||||
41
src/yasi_applets/hardware/hardware.html
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{% extends "layout.html" %}
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<p> <b> Would you like fries with that? </b></p>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div style="background-color: gray; padding: 4px 6px 7px 6px;
|
||||||
|
border-radius: 10px; margin-bottom: 20px;">
|
||||||
|
<span style="width: 100%; border-radius: 8px 8px 0 0;"
|
||||||
|
class="tag is-black">
|
||||||
|
Real-time Clock
|
||||||
|
</span>
|
||||||
|
<div style="padding-left: 15px; padding-right: 15px; background-color: #fff;
|
||||||
|
color: #000;">
|
||||||
|
<p>Date / time. / timezone</p> <br>
|
||||||
|
<input style="background-color: #777777;" type="checkbox" id="popcon"
|
||||||
|
name="popcon" hx-post="/software/settings" hx-trigger="change"
|
||||||
|
{% if popcon %} checked {% endif %}>
|
||||||
|
<label for="popcon"> Participate in PopCon </label><br>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="background-color: gray; padding: 4px 6px 7px 6px;
|
||||||
|
border-radius: 10px; margin-bottom: 20px;">
|
||||||
|
<span style="width: 100%; border-radius: 8px 8px 0 0;"
|
||||||
|
class="tag is-black">
|
||||||
|
Firmware
|
||||||
|
</span>
|
||||||
|
<div style="padding-left: 15px; padding-right: 15px; background-color: #fff;
|
||||||
|
color: #000;">
|
||||||
|
<p>Install additional firmware.</p> <br>
|
||||||
|
<input style="background-color: #777777;" type="checkbox" id="popcon"
|
||||||
|
name="popcon" hx-post="/software/settings" hx-trigger="change"
|
||||||
|
{% if popcon %} checked {% endif %}>
|
||||||
|
<label for="popcon"> Participate in PopCon </label><br>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
65
src/yasi_applets/hardware/routes.py
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
from yasi_applets.hardware import bp
|
||||||
|
from flask import Flask, request, session, redirect, \
|
||||||
|
url_for, render_template, flash, Blueprint
|
||||||
|
from flask import current_app
|
||||||
|
|
||||||
|
@bp.route('/hardware')
|
||||||
|
def webui_hardware():
|
||||||
|
"""
|
||||||
|
Hardware screen for the webui.
|
||||||
|
"""
|
||||||
|
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
|
||||||
|
next_step_url = menu[menu.index("hardware")+1]
|
||||||
|
if menu[menu.index("hardware")] == 1:
|
||||||
|
previous_step_url = False
|
||||||
|
else:
|
||||||
|
previous_step_url = menu[menu.index("hardware")-1]
|
||||||
|
|
||||||
|
sources_button = ' <button class="button iis-info"> <i class="fa fa-cloud-download" aria-hidden="true"></i> Configure Network </button>'
|
||||||
|
blends_button = ' <button class="button iis-info"> <i class="fa fa-download" aria-hidden="true"></i> Install a Blend </button>'
|
||||||
|
bottom_menu = sources_button + blends_button
|
||||||
|
build_summary()
|
||||||
|
|
||||||
|
return render_template('hardware.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,
|
||||||
|
bottom_menu = bottom_menu,
|
||||||
|
popcon=current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'])
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/hardware/settings', methods=['GET', 'POST'])
|
||||||
|
def hardware_settings():
|
||||||
|
"""
|
||||||
|
Receive settings for the hardware applet.
|
||||||
|
"""
|
||||||
|
if request.method == 'POST':
|
||||||
|
popcon = "popcon" in request.form
|
||||||
|
current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'] = popcon
|
||||||
|
print(current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'])
|
||||||
|
build_summary()
|
||||||
|
return ('', 204)
|
||||||
|
|
||||||
|
|
||||||
|
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']['hardware'] = ("Hardware", "/hardware", 40)
|
||||||
|
|
||||||
|
|
||||||
|
def build_summary():
|
||||||
|
"""
|
||||||
|
Write up a summary of what this module will do.
|
||||||
|
"""
|
||||||
|
current_app.config['CONFIG']['Summary']['hardware'] = {}
|
||||||
|
current_app.config['CONFIG']['Summary']['hardware']['heading'] = "Hardware"
|
||||||
|
current_app.config['CONFIG']['Summary']['hardware']['bleh'] = current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']
|
||||||
|
current_app.config['CONFIG']['Summary']['hardware']['text'] = "Participate in Popularity Contest: " + str(current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']) + "<br/>No desktop environment selected."
|
||||||
|
return("ok?")
|
||||||
|
|
||||||
|
|
||||||
|
build_menu()
|
||||||
9
src/yasi_applets/install/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
bp = Blueprint('install', __name__,
|
||||||
|
template_folder='',
|
||||||
|
static_folder='static',
|
||||||
|
static_url_path='/welcome/static')
|
||||||
|
|
||||||
|
from yasi_applets.install import routes
|
||||||
|
|
||||||
52
src/yasi_applets/install/install.html
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{% extends "layout.html" %}
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<center>
|
||||||
|
<p style="position: absolute: left: 45px; top: 10px;">
|
||||||
|
<big><big>
|
||||||
|
Installing...
|
||||||
|
</big></big>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<img style="width: 400px; padding: 20px;" src="/install/static/slide1.png" /> <br />
|
||||||
|
<p>
|
||||||
|
Installing system, the rest of the process is automated.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p style="margin: 20px;">
|
||||||
|
<input style="background-color: #777777;" type="checkbox"
|
||||||
|
id="reboot" name="reboot" value="reboot" checked>
|
||||||
|
<label for="reboot"> Reboot automatically when ready </label></p><br>
|
||||||
|
|
||||||
|
<div id="output"></div>
|
||||||
|
|
||||||
|
<!-- Hidden input to track last line -->
|
||||||
|
<div id="last-line-container">
|
||||||
|
<input type="hidden" id="last-line" name="last_line" value="0">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Poller -->
|
||||||
|
<div hx-get="/install/status"
|
||||||
|
hx-trigger="load, every 1s"
|
||||||
|
hx-include="#last-line"
|
||||||
|
hx-swap-oob="true"
|
||||||
|
hx-target="this"
|
||||||
|
hx-ext="json-enc"
|
||||||
|
hx-vars="{}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</center>
|
||||||
|
|
||||||
|
<div style="position: absolute; padding: 10px; background-color: #26495e; left: 40px;
|
||||||
|
right: 40px; bottom: 40px; height: text-align: middle;">
|
||||||
|
<center> Initializing... </center>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
109
src/yasi_applets/install/routes.py
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
from yasi_applets.install import bp
|
||||||
|
from flask import Flask, request, session, redirect, \
|
||||||
|
url_for, render_template, flash, Blueprint, jsonify
|
||||||
|
from flask import current_app
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import threading
|
||||||
|
|
||||||
|
|
||||||
|
status = {
|
||||||
|
"status": "idle", # idle | running | finished
|
||||||
|
"output": "",
|
||||||
|
"exit_code": None,
|
||||||
|
"lines": []
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/install',methods=['GET', 'POST', 'PUT'])
|
||||||
|
def install_index():
|
||||||
|
"""
|
||||||
|
The page you'd get if you access the root of
|
||||||
|
this app in a browser.
|
||||||
|
"""
|
||||||
|
install_start()
|
||||||
|
return render_template('install.html')
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/install-start',methods=['GET', 'POST', 'PUT'])
|
||||||
|
def install_start():
|
||||||
|
"""
|
||||||
|
Trigger the installation process
|
||||||
|
"""
|
||||||
|
print("The installation process is starting!... in theory at least")
|
||||||
|
if status["status"] == "running":
|
||||||
|
return jsonify({"status": "already running"}), 409 # Conflict
|
||||||
|
threading.Thread(target=run_script).start()
|
||||||
|
return jsonify({"status": "started"})
|
||||||
|
print("did it finish?")
|
||||||
|
|
||||||
|
|
||||||
|
def run_script():
|
||||||
|
global status
|
||||||
|
status["status"] = "running"
|
||||||
|
|
||||||
|
process = subprocess.Popen(
|
||||||
|
["bash", "/data/jonathan/devel/highvoltage/system-installer/daemon/src/fake-install-shell.sh"],
|
||||||
|
stdout = subprocess.PIPE,
|
||||||
|
stderr = subprocess.STDOUT,
|
||||||
|
text = True)
|
||||||
|
|
||||||
|
lines = []
|
||||||
|
for line in iter(process.stdout.readline,''):
|
||||||
|
#lines.append(line.strip())
|
||||||
|
#status["output"] = "\n".join(lines)
|
||||||
|
status["lines"].append(line.strip())
|
||||||
|
|
||||||
|
process.wait()
|
||||||
|
status["status"] = 'finished'
|
||||||
|
status["exit_code"] = process.returncode
|
||||||
|
|
||||||
|
print(lines)
|
||||||
|
print("status:", status["status"], "code:", status["exit_code"])
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/install/status', methods=['GET', 'POST'])
|
||||||
|
def install_status():
|
||||||
|
"""
|
||||||
|
Update on the status of the installation process.
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Keep track of the last line posted, so that we can include
|
||||||
|
# any new lines not provided to the UI yet
|
||||||
|
last_line = int(request.args.get("last_line", 0))
|
||||||
|
new_lines = status["lines"][last_line:]
|
||||||
|
|
||||||
|
if not new_lines and status["status"] == "finished":
|
||||||
|
return "" # Empty response = HTMX will stop polling
|
||||||
|
|
||||||
|
lines_html = ""
|
||||||
|
for i, line in enumerate(new_lines, start=last_line + 1):
|
||||||
|
lines_html += f'<div>{line}</div>'
|
||||||
|
|
||||||
|
return {
|
||||||
|
"output": status['output'],
|
||||||
|
"status": status['status'],
|
||||||
|
"lines": lines_html,
|
||||||
|
"last_line": f'<input type="hidden" id="last-line" name="last_line" value="{last_line + len(new_lines)}">'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/install/cancel', methods=["POST"])
|
||||||
|
def install_cancel():
|
||||||
|
"""
|
||||||
|
Cancel the installation process.
|
||||||
|
"""
|
||||||
|
if status["status"] != "running" or not status["process"]:
|
||||||
|
return Response("No running script", status=400)
|
||||||
|
process["process"].terminate()
|
||||||
|
process["status"] = "cancelled"
|
||||||
|
process["exit_code"] = -1
|
||||||
|
return Response("Cancelled", status=200)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/settings',methods=['GET', 'POST', 'PUT'])
|
||||||
|
def settings():
|
||||||
|
"""
|
||||||
|
Manage settings for the installation module.
|
||||||
|
"""
|
||||||
|
print("Settings")
|
||||||
9
src/yasi_applets/main/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
bp = Blueprint('main', __name__,
|
||||||
|
template_folder='',
|
||||||
|
static_folder='static',
|
||||||
|
static_url_path='/main/static')
|
||||||
|
|
||||||
|
from yasi_applets.main import routes
|
||||||
|
|
||||||
18
src/yasi_applets/main/help.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<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"> Help </h1>
|
||||||
|
<br/><p class="title is-6"><span class="tag is-danger">The help system is not yet implemented.</span>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="columns">
|
||||||
|
<a href="/welcome"><div class="column"><button class="button is-link">Continue</button></div></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
17
src/yasi_applets/main/menu.html
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<div class="modal is-active">
|
||||||
|
<div class="modal-background"></div>
|
||||||
|
<div class="modal-content">
|
||||||
|
|
||||||
|
<div style="background-color: #424242; padding: 15px; border-radius: 15px; borders: none; color: white;">
|
||||||
|
<h1 class="is-size-4"> Main menu </h1>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<p> There's nothing yet to do here.</p>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div class="columns">
|
||||||
|
<a href="/welcome"><div class="column"><button class="button is-link">Continue</button></div></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
19
src/yasi_applets/main/quit.html
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<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"> Exit system installer </h1>
|
||||||
|
<br /><p class="title is-6"><span class="tag is-danger">Quitting is not yet implemented.</span>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<p> ALT+F4 will bring up a dialog that works though. </p>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<div class="columns">
|
||||||
|
<a href="/welcome"><div class="column"><button class="button is-link">Continue</button></div></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
49
src/yasi_applets/main/routes.py
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
from yasi_applets.welcome import bp
|
||||||
|
from flask import Flask, request, session, redirect, \
|
||||||
|
url_for, render_template, flash, Blueprint
|
||||||
|
# we use this neat little trick to get config data from the main app
|
||||||
|
from flask import current_app
|
||||||
|
import gettext
|
||||||
|
import dmm.lsblk as lsblk
|
||||||
|
|
||||||
|
@bp.route('/')
|
||||||
|
def index():
|
||||||
|
"""
|
||||||
|
The page you'd get if you access the root of
|
||||||
|
this app in a browser.
|
||||||
|
"""
|
||||||
|
return ("Welcome to System Installer Daemon POC <br />"
|
||||||
|
"Version: Unavailable")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/api/v0')
|
||||||
|
def apihome():
|
||||||
|
"""
|
||||||
|
Not sure what this function should do, but have
|
||||||
|
a feeling that it should exist.
|
||||||
|
"""
|
||||||
|
return ("0")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/main/help',methods=['GET', 'POST', 'PUT'])
|
||||||
|
def main_welcome():
|
||||||
|
"""
|
||||||
|
Manages the main help system.
|
||||||
|
"""
|
||||||
|
return render_template('help.html')
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/main/quit',methods=['GET', 'POST', 'PUT'])
|
||||||
|
def main_quit():
|
||||||
|
"""
|
||||||
|
Manages the quit dialog.
|
||||||
|
"""
|
||||||
|
return render_template('quit.html')
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/main/menu',methods=['GET', 'POST', 'PUT'])
|
||||||
|
def main_menu():
|
||||||
|
"""
|
||||||
|
Manages the main menu.
|
||||||
|
"""
|
||||||
|
return render_template('menu.html')
|
||||||
1
src/yasi_applets/main/static/bulma.css
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/share/bulma/css/bulma.css
|
||||||
1
src/yasi_applets/main/static/fork-awesome.css
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/share/fonts-fork-awesome/css/fork-awesome.css
|
||||||
1
src/yasi_applets/main/static/htmx.min.js
vendored
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/usr/share/javascript/htmx/htmx.min.js
|
||||||
BIN
src/yasi_applets/main/static/icons/highvoltage.png
Normal file
|
After Width: | Height: | Size: 121 KiB |
BIN
src/yasi_applets/main/static/icons/keyboard.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
53
src/yasi_applets/main/static/icons/keyboard.svg
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
width="16"
|
||||||
|
height="16"
|
||||||
|
version="1.1"
|
||||||
|
id="svg2"
|
||||||
|
sodipodi:docname="keyboard.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">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview2"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#000000"
|
||||||
|
borderopacity="0.25"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:zoom="52.375"
|
||||||
|
inkscape:cx="8"
|
||||||
|
inkscape:cy="8"
|
||||||
|
inkscape:window-width="1236"
|
||||||
|
inkscape:window-height="1041"
|
||||||
|
inkscape:window-x="662"
|
||||||
|
inkscape:window-y="199"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="svg2" />
|
||||||
|
<g
|
||||||
|
font-weight="400"
|
||||||
|
fill="#474747"
|
||||||
|
id="g2"
|
||||||
|
style="fill:#c0bfbc">
|
||||||
|
<path
|
||||||
|
d="M3.702 1C2.17 1 .984 2.32.984 3.844v8.344c0 1.524 1.185 2.843 2.718 2.843h8.58c1.532 0 2.75-1.32 2.75-2.844V3.845c0-1.525-1.218-2.844-2.75-2.844zm.782 1.031c3.526.256 5.317.134 7.047 0 .754-.058 1.532.616 1.532 1.438v7.375c0 .665-.532 1.095-1.188 1.187-2.836.397-4.753.44-7.673 0-.655-.099-1.187-.522-1.187-1.187V3.5c0-.822.714-1.524 1.469-1.469z"
|
||||||
|
style="line-height:normal;-inkscape-font-specification:'Bitstream Vera Sans';text-indent:0;text-align:start;text-decoration-line:none;text-transform:none;marker:none;fill:#c0bfbc"
|
||||||
|
color="#bebebe"
|
||||||
|
font-family="Bitstream Vera Sans"
|
||||||
|
overflow="visible"
|
||||||
|
id="path1" />
|
||||||
|
<path
|
||||||
|
d="M10.564 5.977l-2.939.044.016 1 2.879-.043c.2.018.33.076.396.135.067.06.105.121.105.293l-.008.604H8.517l.037.002a1.457 1.457 0 00-1.164.43 1.558 1.558 0 00-.416 1.023c-.013.367.092.75.352 1.053.26.303.687.496 1.162.482h3.482l.051-3.59v-.004c0-.402-.16-.786-.435-1.035-.276-.249-.63-.364-.998-.393zM8.48 9.01h2.519l-.014.99H8.457c-.22.007-.302-.051-.371-.133a.553.553 0 01-.112-.367.587.587 0 01.141-.371c.079-.083.163-.134.363-.12zm2.862-5.985l-3 1 .316.95 3-1z"
|
||||||
|
style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal;marker:none;fill:#c0bfbc"
|
||||||
|
color="#000"
|
||||||
|
font-family="sans-serif"
|
||||||
|
overflow="visible"
|
||||||
|
id="path2" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.7 KiB |
BIN
src/yasi_applets/main/static/icons/language.jpg
Normal file
|
After Width: | Height: | Size: 22 KiB |
1
src/yasi_applets/main/static/icons/language.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640"><!--!Font Awesome Free 7.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M192 64C209.7 64 224 78.3 224 96L224 128L352 128C369.7 128 384 142.3 384 160C384 177.7 369.7 192 352 192L342.4 192L334 215.1C317.6 260.3 292.9 301.6 261.8 337.1C276 345.9 290.8 353.7 306.2 360.6L356.6 383L418.8 243C423.9 231.4 435.4 224 448 224C460.6 224 472.1 231.4 477.2 243L605.2 531C612.4 547.2 605.1 566.1 589 573.2C572.9 580.3 553.9 573.1 546.8 557L526.8 512L369.3 512L349.3 557C342.1 573.2 323.2 580.4 307.1 573.2C291 566 283.7 547.1 290.9 531L330.7 441.5L280.3 419.1C257.3 408.9 235.3 396.7 214.5 382.7C193.2 399.9 169.9 414.9 145 427.4L110.3 444.6C94.5 452.5 75.3 446.1 67.4 430.3C59.5 414.5 65.9 395.3 81.7 387.4L116.2 370.1C132.5 361.9 148 352.4 162.6 341.8C148.8 329.1 135.8 315.4 123.7 300.9L113.6 288.7C102.3 275.1 104.1 254.9 117.7 243.6C131.3 232.3 151.5 234.1 162.8 247.7L173 259.9C184.5 273.8 197.1 286.7 210.4 298.6C237.9 268.2 259.6 232.5 273.9 193.2L274.4 192L64.1 192C46.3 192 32 177.7 32 160C32 142.3 46.3 128 64 128L160 128L160 96C160 78.3 174.3 64 192 64zM448 334.8L397.7 448L498.3 448L448 334.8z"/></svg>
|
||||||
|
After Width: | Height: | Size: 1.2 KiB |
8
src/yasi_applets/main/static/icons/tab-new-symbolic.svg
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g fill="#2e3436">
|
||||||
|
<path d="m 3 0 c -1.644531 0 -3 1.355469 -3 3 v 10 c 0 1.644531 1.355469 3 3 3 h 10 c 1.644531 0 3 -1.355469 3 -3 v -10 c 0 -1.644531 -1.355469 -3 -3 -3 z m 0 2 h 10 c 0.570312 0 1 0.429688 1 1 v 10 c 0 0.570312 -0.429688 1 -1 1 h -10 c -0.570312 0 -1 -0.429688 -1 -1 v -10 c 0 -0.570312 0.429688 -1 1 -1 z m 0 0"/>
|
||||||
|
<path d="m 4 7 h 8 v 2 h -8 z m 0 0"/>
|
||||||
|
<path d="m 9 4 v 8 h -2 v -8 z m 0 0"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 585 B |
BIN
src/yasi_applets/main/static/slide1.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
37
src/yasi_applets/main/static/system-installer-blippie.css
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
html {
|
||||||
|
/* Overwrite the white that is set by bulma.css */
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
font-family: Noto Sans;
|
||||||
|
color: white;
|
||||||
|
overflow: hidden;
|
||||||
|
min-width: 1050px;
|
||||||
|
min-height: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.frame {
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: #0f1933;
|
||||||
|
padding: 15px 15px 15px 15px;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 600px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.applet a:link a:hover a:active {
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.applet {
|
||||||
|
width: 100%;
|
||||||
|
height: 470px;
|
||||||
|
bottom: 0px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio:hover {
|
||||||
|
color: #f1f1f1;
|
||||||
|
}
|
||||||
41
src/yasi_applets/main/static/system-installer-dark.css
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
html {
|
||||||
|
/* Overwrite the white that is set by bulma.css */
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
font-family: Sans; Roboto; Lato; Noto Sans;
|
||||||
|
color: white;
|
||||||
|
overflow: hidden;
|
||||||
|
min-width: 1050px;
|
||||||
|
min-height: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
html, body {margin: 0; height: 100%; overflow: hidden;}
|
||||||
|
|
||||||
|
.frame {
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: #404040;
|
||||||
|
padding: 15px 15px 15px 15px;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 600px;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.applet a:link a:hover a:active {
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.applet {
|
||||||
|
width: 100%;
|
||||||
|
height: 442px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio:hover {
|
||||||
|
color: #f1f1f1;
|
||||||
|
}
|
||||||
37
src/yasi_applets/main/static/system-installer-light.css
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
html {
|
||||||
|
/* Overwrite the white that is set by bulma.css */
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
display: flex;
|
||||||
|
font-family: Noto Sans;
|
||||||
|
color: white;
|
||||||
|
overflow: hidden;
|
||||||
|
min-width: 1050px;
|
||||||
|
min-height: 600px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.frame {
|
||||||
|
border-radius: 10px;
|
||||||
|
background-color: #e9e8e4;
|
||||||
|
padding: 15px;
|
||||||
|
max-width: 1050px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.applet a:link a:hover a:active {
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
.applet {
|
||||||
|
color: #383838;
|
||||||
|
width: 1040px;
|
||||||
|
height: 470px;
|
||||||
|
overflow-y: scroll;
|
||||||
|
overflow-x: hidden;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio:hover {
|
||||||
|
color: #404040;
|
||||||
|
}
|
||||||
1
src/yasi_applets/main/static/system-installer.css
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
system-installer-dark.css
|
||||||
9
src/yasi_applets/software/__init__.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
bp = Blueprint('software', __name__,
|
||||||
|
template_folder='',
|
||||||
|
static_folder='static',
|
||||||
|
static_url_path='/software/static')
|
||||||
|
|
||||||
|
from yasi_applets.software import routes
|
||||||
|
|
||||||
81
src/yasi_applets/software/routes.py
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
from yasi_applets.software import bp
|
||||||
|
from flask import Flask, request, session, redirect, \
|
||||||
|
url_for, render_template, flash, Blueprint
|
||||||
|
from flask import current_app
|
||||||
|
|
||||||
|
@bp.route('/software')
|
||||||
|
def webui_software():
|
||||||
|
"""
|
||||||
|
Software screen for the webui.
|
||||||
|
"""
|
||||||
|
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
|
||||||
|
next_step_url = menu[menu.index("software")+1]
|
||||||
|
if menu[menu.index("software")] == 1:
|
||||||
|
previous_step_url = False
|
||||||
|
else:
|
||||||
|
previous_step_url = menu[menu.index("software")-1]
|
||||||
|
|
||||||
|
sources_button = ' <button class="button iis-info"> <i class="fa fa-cloud-download" aria-hidden="true"></i> Edit Sources </button>'
|
||||||
|
blends_button = ' <button class="button iis-info"> <i class="fa fa-download" aria-hidden="true"></i> Install a Blend </button>'
|
||||||
|
bottom_menu = sources_button + blends_button
|
||||||
|
# Leave out useless buttons until they do more
|
||||||
|
bottom_menu = ''
|
||||||
|
build_summary()
|
||||||
|
|
||||||
|
return render_template('software.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,
|
||||||
|
bottom_menu = bottom_menu,
|
||||||
|
popcon=current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'],
|
||||||
|
desktop=current_app.config['CONFIG']['recipe']['install_desktop_environment']['packages'])
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/software/settings', methods=['GET', 'POST'])
|
||||||
|
def software_settings():
|
||||||
|
"""
|
||||||
|
Receive settings for the software applet.
|
||||||
|
"""
|
||||||
|
if request.method == 'POST':
|
||||||
|
popcon = "popcon" in request.form
|
||||||
|
current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'] = popcon
|
||||||
|
print(current_app.config['CONFIG']['recipe']['popcon']['enable_popcon'])
|
||||||
|
build_summary()
|
||||||
|
return ('', 204)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/software/select-desktop', methods=['GET', 'POST'])
|
||||||
|
def software_select_desktop():
|
||||||
|
"""
|
||||||
|
Select a desktop environment for installation
|
||||||
|
"""
|
||||||
|
if request.method == 'POST':
|
||||||
|
desktop = request.form['software-desktop']
|
||||||
|
print(desktop)
|
||||||
|
current_app.config['CONFIG']['recipe']['install_desktop_environment']['packages'] = desktop
|
||||||
|
build_summary()
|
||||||
|
return ('', 204)
|
||||||
|
|
||||||
|
|
||||||
|
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']['software'] = ("Software", "/software", 40)
|
||||||
|
|
||||||
|
|
||||||
|
def build_summary():
|
||||||
|
"""
|
||||||
|
Write up a summary of what this module will do.
|
||||||
|
"""
|
||||||
|
current_app.config['CONFIG']['Summary']['software'] = {}
|
||||||
|
current_app.config['CONFIG']['Summary']['software']['heading'] = "Software"
|
||||||
|
current_app.config['CONFIG']['Summary']['software']['bleh'] = current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']
|
||||||
|
current_app.config['CONFIG']['Summary']['software']['text'] = "Participate in Popularity Contest: " + str(current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']) + "<br/>Desktop environment selected: " + str(current_app.config['CONFIG']['recipe']['install_desktop_environment']['packages'])
|
||||||
|
return("ok?")
|
||||||
|
|
||||||
|
|
||||||
|
build_menu()
|
||||||
80
src/yasi_applets/software/software.html
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
{% extends "layout.html" %}
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<p> <b> Would you like fries with that? </b></p>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<big> Popularity Contest </big>
|
||||||
|
<br><br>
|
||||||
|
<p>The Popularity Contest (popcon) is a programme where anonymous data is sent back to Debian, tracking the number of packages installed. More information can be obtained at https://popcon.debian.org.</p> <br>
|
||||||
|
|
||||||
|
<input style="background-color: #777777;" type="checkbox" id="popcon"
|
||||||
|
name="popcon" hx-post="/software/settings" hx-trigger="change"
|
||||||
|
{% if popcon %} checked {% endif %}>
|
||||||
|
<label for="popcon"> Participate in PopCon </label><br>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<big><h3> Desktop Environment </h3></big>
|
||||||
|
<br>
|
||||||
|
<p>Would you like to install a graphical environment for this system?</p>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<div class="control is-link">
|
||||||
|
<div class="select">
|
||||||
|
<select hx-post="/software/select-desktop" hx-target="body" name="software-desktop" style="width: 220px">
|
||||||
|
<option value="" {% if desktop == "None" %} selected=selected {% endif %}> None</option>
|
||||||
|
<option value="task-gnome-desktop" {% if desktop == "task-gnome-desktop" %} selected=selected {% endif %} >GNOME</option>
|
||||||
|
<option value="task-kde-desktop" {% if desktop == "task-kde-desktop" %} selected=selected {% endif %}>KDE Plasma</option>
|
||||||
|
<option value="task-xfce-desktop" {% if desktop == "task-xfce-desktop" %} selected=selected {% endif %}>Xfce</option>
|
||||||
|
<option value="task-lxde-desktop" {% if desktop == "task-lxde-desktop" %} selected=selected {% endif %}>LXDE</option>
|
||||||
|
<option value="task-lxqt-desktop" {% if desktop == "task-lxqt-desktop" %} selected=selected {% endif %}>LXQt</option>
|
||||||
|
<option value="task-mate-desktop" {% if desktop == "task-mate-desktop" %} selected=selected {% endif %}>MATE</option>
|
||||||
|
<option value="lomiri" {% if desktop == "lomiri" %} selected=selected {% endif %}>Lomiri</option>
|
||||||
|
<option value="task-cinnamon-desktop" {% if desktop == "task-cinnamon-desktop" %} selected=selected {% endif %}>Cinnamon</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
|
||||||
|
<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">
|
||||||
|
Desktop Environment</span>
|
||||||
|
<div style="padding: 15px; padding-top: 10px; padding-bottom: 5px; background-color: #fff; color: #000;">
|
||||||
|
<p>
|
||||||
|
<img src="/static/icons/console.png" width="48px" alt="" style="padding-right: 10px;" />
|
||||||
|
<img src="/static/icons/gnome.jpeg" width="48px" alt="" style="padding-right: 10px;" />
|
||||||
|
<img src="/static/icons/kde.jpeg" width="48px" alt="" style="padding-right: 10px;" />
|
||||||
|
<img src="/static/icons/xfce.jpeg" width="48px" alt="" style="padding-right: 10px;" />
|
||||||
|
<img src="/static/icons/mate.jpeg" width="48px" alt="" style="padding-right: 10px;" />
|
||||||
|
<img src="/static/icons/lxde.jpeg" width="48px" alt="" style="padding-right: 10px;" />
|
||||||
|
<p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div style="background-color: gray; padding: 4px 6px 7px 6px; border-radius: 10px; margin-bottom: 20px;">
|
||||||
|
<p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black">
|
||||||
|
Select software from Debian archives</span>
|
||||||
|
<div style="padding-left: 15px; padding-right: 15px; padding-bottom: 5px; background-color: #fff; color: #000;">
|
||||||
|
<p><b>Select packages or selections of packages from the Debian archives.</b></p>
|
||||||
|
<button class="button is-dark">Games</button>
|
||||||
|
<button class="button is-dark">Productivity</button>
|
||||||
|
<button class="button is-dark">Creativity</button>
|
||||||
|
<button class="button is-dark">Server</button>
|
||||||
|
<button class="button is-dark">Development</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
BIN
src/yasi_applets/software/static/img/console.png
Normal file
|
After Width: | Height: | Size: 18 KiB |
BIN
src/yasi_applets/software/static/img/gnome.jpeg
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
src/yasi_applets/software/static/img/kde.jpeg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
src/yasi_applets/software/static/img/lxde.jpeg
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
src/yasi_applets/software/static/img/mate.jpeg
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
src/yasi_applets/software/static/img/xfce.jpeg
Normal file
|
After Width: | Height: | Size: 20 KiB |
7
src/yasi_applets/summary/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
bp = Blueprint('summary', __name__,
|
||||||
|
template_folder='')
|
||||||
|
|
||||||
|
from yasi_applets.summary import routes
|
||||||
|
|
||||||
42
src/yasi_applets/summary/routes.py
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
from yasi_applets.summary import bp
|
||||||
|
from flask import Flask, request, session, redirect, \
|
||||||
|
url_for, render_template, flash, Blueprint
|
||||||
|
from flask import current_app
|
||||||
|
|
||||||
|
@bp.route('/summary',methods=['GET', 'POST', 'PUT'])
|
||||||
|
def summary_index():
|
||||||
|
"""
|
||||||
|
The page you'd get if you access the root of
|
||||||
|
this app in a browser.
|
||||||
|
"""
|
||||||
|
build_menu()
|
||||||
|
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
|
||||||
|
previous_step_url = menu[menu.index("summary")-1]
|
||||||
|
next_step_url = "install"
|
||||||
|
|
||||||
|
config = current_app.config['CONFIG']
|
||||||
|
print (current_app.config['CONFIG']['Summary'])
|
||||||
|
html = (str(current_app.config['CONFIG']['Summary']['welcome']) + "<br>" + str(current_app.config['CONFIG']['Summary']['software']))
|
||||||
|
summary = config['Summary']
|
||||||
|
|
||||||
|
return render_template('summary.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,
|
||||||
|
config=config,
|
||||||
|
html=html,
|
||||||
|
summary=summary)
|
||||||
|
|
||||||
|
|
||||||
|
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']['summary'] = ("Summary", "/summary", 60)
|
||||||
|
|
||||||
|
|
||||||
|
build_menu()
|
||||||
|
|
||||||
30
src/yasi_applets/summary/summary.html
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{% extends "layout.html" %}
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<p><b> Ready to install! Please review all changes.</b></p>
|
||||||
|
|
||||||
|
<p> This is the last chance to back out before committing to install, please ensure all the details are correct. </p>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
{% for module in summary %}
|
||||||
|
|
||||||
|
<h3> <big> {{ summary[module]['heading'] }} </big> </h3>
|
||||||
|
|
||||||
|
<!-- {{ summary[module]['bleh'] }}
|
||||||
|
{{ summary[module]['settings'] }} -->
|
||||||
|
{{ summary[module]['text']|safe }}
|
||||||
|
|
||||||
|
<br /><br />
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<br><br/>
|
||||||
|
|
||||||
|
<!-- <p>Config is: <code> {{ config }} </code></p> -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
10
src/yasi_applets/users/__init__.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
bp = Blueprint('users', __name__,
|
||||||
|
template_folder='',
|
||||||
|
static_folder='static',
|
||||||
|
static_url_path='/users/static')
|
||||||
|
|
||||||
|
|
||||||
|
from yasi_applets.users import routes
|
||||||
|
|
||||||
BIN
src/yasi_applets/users/locales/af/LC_MESSAGES/users.mo
Normal file
65
src/yasi_applets/users/locales/af/LC_MESSAGES/users.po
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2025-06-20 15:48+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: routes.py:33
|
||||||
|
msgid "Let's set up an initial user."
|
||||||
|
msgstr "Kom on stel 'n gebruiker op."
|
||||||
|
|
||||||
|
msgid "Users"
|
||||||
|
msgstr "Gebruikers"
|
||||||
|
|
||||||
|
#: routes.py:34
|
||||||
|
msgid "Full Name"
|
||||||
|
msgstr "Volle Naam"
|
||||||
|
|
||||||
|
#: routes.py:35
|
||||||
|
msgid "Username"
|
||||||
|
msgstr "Gebruikersnaam"
|
||||||
|
|
||||||
|
#: routes.py:36
|
||||||
|
msgid "This username is available"
|
||||||
|
msgstr "Hierdie gebruikersnaam is nie beskikbaar nie."
|
||||||
|
|
||||||
|
#: routes.py:37
|
||||||
|
msgid "This username is not available"
|
||||||
|
msgstr "Hierdie gebruikersnaam is nie beskikbaar nie."
|
||||||
|
|
||||||
|
#: routes.py:38
|
||||||
|
msgid "This username is reserved by the system"
|
||||||
|
msgstr "Hierdie gebruikersnaam is reserveerd deur vir die sisteem."
|
||||||
|
|
||||||
|
#: routes.py:39
|
||||||
|
msgid "The username must be one word, lowercase, with no special characters"
|
||||||
|
msgstr "Die gebruikersnaam moet een woord wees, kleinletters, met geen spesiale karakters."
|
||||||
|
|
||||||
|
#: routes.py:40
|
||||||
|
msgid "Password"
|
||||||
|
msgstr "Wagwoord"
|
||||||
|
|
||||||
|
#: routes.py:41
|
||||||
|
msgid "Password (confirm)"
|
||||||
|
msgstr "Wagwoord (bevestig)"
|
||||||
|
|
||||||
|
#: routes.py:42
|
||||||
|
msgid "These passwords do now match"
|
||||||
|
msgstr "Hierdie wagwoorde is nie dieselfde nie"
|
||||||
|
|
||||||
|
#: routes.py:43
|
||||||
|
msgid "This password is too short"
|
||||||
|
msgstr "Hierdie wagwoord is te kort"
|
||||||
62
src/yasi_applets/users/locales/users.pot
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2025-06-20 15:48+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: routes.py:33
|
||||||
|
msgid "Let's set up an initial user."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:34
|
||||||
|
msgid "Full Name"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:35
|
||||||
|
msgid "Username"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:36
|
||||||
|
msgid "This username is available"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:37
|
||||||
|
msgid "This username is not available"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:38
|
||||||
|
msgid "This username is reserved by the system"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:39
|
||||||
|
msgid "The username must be one word, lowercase, with no special characters"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:40
|
||||||
|
msgid "Password"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:41
|
||||||
|
msgid "Password (confirm)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:42
|
||||||
|
msgid "These passwords do now match"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:43
|
||||||
|
msgid "This password is too short"
|
||||||
|
msgstr ""
|
||||||
126
src/yasi_applets/users/routes.py
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
from yasi_applets.software import bp
|
||||||
|
from flask import Flask, request, session, redirect, \
|
||||||
|
url_for, render_template, flash, Blueprint
|
||||||
|
import gettext
|
||||||
|
# we use this neat little trick to get config data from the main app
|
||||||
|
from flask import current_app
|
||||||
|
|
||||||
|
# Set up Gettext
|
||||||
|
def set_language(LANG):
|
||||||
|
"""
|
||||||
|
Sets language for this applet
|
||||||
|
"""
|
||||||
|
translations = gettext.translation("users", './applets/users/locales',
|
||||||
|
fallback=True, languages=[LANG])
|
||||||
|
translations.install()
|
||||||
|
_ = translations.gettext
|
||||||
|
|
||||||
|
set_language('')
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/users')
|
||||||
|
def users_root():
|
||||||
|
"""
|
||||||
|
Users screen for the webui.
|
||||||
|
"""
|
||||||
|
set_language(current_app.config['CONFIG']['settings']['language'])
|
||||||
|
string_dict = build_stringlist()
|
||||||
|
build_menu()
|
||||||
|
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
|
||||||
|
next_step_url = menu[menu.index("users")+1]
|
||||||
|
if menu[menu.index("users")] == 1:
|
||||||
|
previous_step_url = False
|
||||||
|
else:
|
||||||
|
previous_step_url = menu[menu.index("users")-1]
|
||||||
|
|
||||||
|
root_button = ' <button class="button not-allowed is-light"> <i class="fa fa-user" aria-hidden="true"></i> Setup root user </button>'
|
||||||
|
ldap_button = ' <button class="button is-light"> <i class="fa fa-address-card" aria-hidden="true"></i> Connect LDAP </button>'
|
||||||
|
ad_button = ' <button class="button is-light"> <i class="fa fa-address-card" aria-hidden="true"></i> Connect AD </button>'
|
||||||
|
csv_button = ' <button class="button is-light"> <i class="fa fa-users" aria-hidden="true"></i> Import CSV </button>'
|
||||||
|
bottom_menu = root_button + ldap_button + ad_button + csv_button
|
||||||
|
bottom_menu = ""
|
||||||
|
|
||||||
|
initial_user = current_app.config['CONFIG']['recipe']['users']['users'][0]
|
||||||
|
|
||||||
|
build_summary()
|
||||||
|
|
||||||
|
return render_template('users.html', string_dict=string_dict,
|
||||||
|
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,
|
||||||
|
initial_user=initial_user)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/users/user-check/', methods=['GET', 'POST', 'PUT'])
|
||||||
|
def check_user():
|
||||||
|
if request.method == 'POST':
|
||||||
|
username = request.form["username"]
|
||||||
|
fullname = request.form["fullname"]
|
||||||
|
current_app.config['CONFIG']['recipe']['users']['users'][0]['username'] = username
|
||||||
|
current_app.config['CONFIG']['recipe']['users']['users'][0]['fullname'] = fullname
|
||||||
|
if username in ["root", "games"]:
|
||||||
|
return('<p class="has-text-danger"><b>That username is not available</b> </p>')
|
||||||
|
else:
|
||||||
|
return('<p class="has-text-success"><b>That username is available</b> </p>')
|
||||||
|
build_summary()
|
||||||
|
return("")
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/users/password-check/', methods=['GET', 'POST', 'PUT'])
|
||||||
|
def check_password():
|
||||||
|
if request.method == 'POST':
|
||||||
|
password = request.form["password"]
|
||||||
|
password_confirm = request.form["password_confirm"]
|
||||||
|
current_app.config['CONFIG']['recipe']['users']['users'][0]['password'] = password
|
||||||
|
current_app.config['CONFIG']['recipe']['users']['users'][0]['password_confirm'] = password_confirm
|
||||||
|
if password != password_confirm:
|
||||||
|
return('<p class="has-text-danger"><b>Passwords do not match</b> </p>')
|
||||||
|
else:
|
||||||
|
return('<p class="has-text-success"><b>Passwords match</b> </p>')
|
||||||
|
build_summary()
|
||||||
|
return("")
|
||||||
|
|
||||||
|
|
||||||
|
def build_stringlist():
|
||||||
|
"""
|
||||||
|
Return all the strings that is used in this applet.
|
||||||
|
"""
|
||||||
|
string_dict = {}
|
||||||
|
string_dict['menu_item'] = _("Users")
|
||||||
|
string_dict['initial_user_text'] = _("Let's set up an initial user.")
|
||||||
|
string_dict['full_name'] = _("Full Name")
|
||||||
|
string_dict['user_name'] = _("Username")
|
||||||
|
string_dict['user_name_hint'] = _("One word, all lowercase")
|
||||||
|
string_dict['user_name_available'] = _("This username is available")
|
||||||
|
string_dict['user_name_not_available'] = _("This username is not available")
|
||||||
|
string_dict['user_name_reserved'] = _("This username is reserved by the system")
|
||||||
|
string_dict['user_name_characters'] = _("The username must be one word, lowercase, with no special characters")
|
||||||
|
string_dict['password'] = _("Password")
|
||||||
|
string_dict['password_confirm'] = _("Password (confirm)")
|
||||||
|
string_dict['password_nomatch'] = _("These passwords do now match")
|
||||||
|
string_dict['password_tooshort'] = _("This password is too short")
|
||||||
|
return string_dict
|
||||||
|
|
||||||
|
|
||||||
|
def build_menu():
|
||||||
|
"""
|
||||||
|
Define menu items and paths.
|
||||||
|
"""
|
||||||
|
current_app.config['CONFIG']['settings']['menu']['users'] = (build_stringlist()['menu_item'], "/users", 20)
|
||||||
|
print(current_app.config['CONFIG']['settings']['menu'])
|
||||||
|
|
||||||
|
|
||||||
|
def build_summary():
|
||||||
|
"""
|
||||||
|
Write up a summary of what this module will do.
|
||||||
|
"""
|
||||||
|
current_app.config['CONFIG']['Summary']['users'] = {}
|
||||||
|
current_app.config['CONFIG']['Summary']['users']['heading'] = "Users and Identity"
|
||||||
|
current_app.config['CONFIG']['Summary']['users']['bleh'] = current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']
|
||||||
|
current_app.config['CONFIG']['Summary']['users']['settings'] = current_app.config['CONFIG']['recipe']['users']['users']
|
||||||
|
current_app.config['CONFIG']['Summary']['users']['text'] = "Add primary user with the username: " + str(current_app.config['CONFIG']['recipe']['users']['users'][0]['username'])
|
||||||
|
return("ok?")
|
||||||
|
|
||||||
|
build_menu()
|
||||||
24
src/yasi_applets/users/routes.py.bak
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
from applets.software import bp
|
||||||
|
from flask import Flask, request, session, redirect, \
|
||||||
|
url_for, render_template, flash, Blueprint
|
||||||
|
# we use this neat little trick to get config data from the main app
|
||||||
|
from flask import current_app
|
||||||
|
|
||||||
|
|
||||||
|
def build_stringlist():
|
||||||
|
"""
|
||||||
|
Return all the strings that is used in this applet.
|
||||||
|
"""
|
||||||
|
string_dict = {}
|
||||||
|
string_dict['initial_user_text'] = _("Let's set up an initial user.")
|
||||||
|
string_dict['full_name'] = _("Full Name")
|
||||||
|
string_dict['user_name'] = _("Username")
|
||||||
|
string_dict['user_name_available'] = _("This username is available")
|
||||||
|
string_dict['user_name_not_available'] = _("This username is not available")
|
||||||
|
string_dict['user_name_reserved'] = _("This username is reserved by the system")
|
||||||
|
string_dict['user_name_characters'] = _("The username must be one word, lowercase, with no special characters")
|
||||||
|
string_dict['password'] = _("Password")
|
||||||
|
string_dict['password_confirm'] = _("Password (confirm)")
|
||||||
|
string_dict['password_nomatch'] = _("These passwords do now match")
|
||||||
|
string_dict['password_tooshort'] = _("This password is too short")
|
||||||
|
return string_dict
|
||||||
22
src/yasi_applets/users/static/img/avatar-default.svg
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<linearGradient id="a" gradientUnits="userSpaceOnUse" x1="16.98286657496" x2="113.51232281881" y1="91.79046347784" y2="91.79046347784">
|
||||||
|
<stop offset="0" stop-color="#e6f0fc"/>
|
||||||
|
<stop offset="0.0383542" stop-color="#cadff8" stop-opacity="0.996078"/>
|
||||||
|
<stop offset="0.124655" stop-color="#d4e5f9" stop-opacity="0.992157"/>
|
||||||
|
<stop offset="0.901364" stop-color="#b2d0f4" stop-opacity="0.964706"/>
|
||||||
|
<stop offset="0.9589" stop-color="#d0e3f9" stop-opacity="0.964706"/>
|
||||||
|
<stop offset="1" stop-color="#98c1f1" stop-opacity="0.964706"/>
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="b" gradientUnits="userSpaceOnUse" x1="35.05556157496" x2="88.56691281881" y1="91.79046347784" y2="91.79046347784">
|
||||||
|
<stop offset="0" stop-color="#e6f0fc"/>
|
||||||
|
<stop offset="0.230125" stop-color="#cadff8" stop-opacity="0.996078"/>
|
||||||
|
<stop offset="0.383542" stop-color="#d4e5f9" stop-opacity="0.992157"/>
|
||||||
|
<stop offset="0.588996" stop-color="#b2d0f4" stop-opacity="0.964706"/>
|
||||||
|
<stop offset="0.753397" stop-color="#d0e3f9" stop-opacity="0.964706"/>
|
||||||
|
<stop offset="1" stop-color="#98c1f1" stop-opacity="0.964706"/>
|
||||||
|
</linearGradient>
|
||||||
|
<path d="m 65.007812 67.363281 c -24.257812 0.027344 -44.703124 16.957031 -49.898437 39.847657 c -1.597656 5.96875 1.65625 9.007812 5.269531 9.007812 h 88.402344 c 4.75 0 7.4375 -4.191406 6.222656 -8.734375 c -5.097656 -23.042969 -25.625 -40.109375 -49.996094 -40.121094 z m 0 0" fill="url(#a)"/>
|
||||||
|
<path d="m 89.351562 33.375 c 0 14.257812 -11.554687 25.8125 -25.8125 25.8125 c -14.257812 0 -25.816406 -11.554688 -25.816406 -25.8125 s 11.558594 -25.816406 25.816406 -25.816406 c 14.257813 0 25.8125 11.558594 25.8125 25.816406 z m 0 0" fill="url(#b)"/>
|
||||||
|
<path d="m 65.007812 64.082031 c -24.257812 0.03125 -44.703124 16.074219 -49.898437 38.96875 c -1.597656 5.96875 1.65625 9.007813 5.269531 9.007813 h 88.402344 c 4.75 0 7.4375 -4.191406 6.222656 -8.734375 c -5.097656 -23.042969 -25.625 -39.226563 -49.996094 -39.242188 z m 24.34375 -34.046875 c 0 14.257813 -11.554687 25.8125 -25.8125 25.8125 c -14.257812 0 -25.816406 -11.554687 -25.816406 -25.8125 c 0 -14.257812 11.558594 -25.816406 25.816406 -25.816406 c 14.257813 0 25.8125 11.558594 25.8125 25.816406 z m 0 0" fill="#f6f9fe" fill-opacity="0.996078"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.4 KiB |
73
src/yasi_applets/users/users.html
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
{% extends "layout.html" %}
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<p><b> {{ string_dict['initial_user_text'] }} </b></p>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<form action="/users" method="POST">
|
||||||
|
|
||||||
|
<img src="/users/static/img/avatar-default.svg" width="160px" style="float: left; position: absolute;" />
|
||||||
|
|
||||||
|
<div style="margin-left: 180px;">
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label>{{ string_dict['full_name'] }}</label>
|
||||||
|
<div class="control has-icons-left has-icons-right">
|
||||||
|
<input class="input" name="fullname" type="text" placeholder="Full Name" value="{% if initial_user['fullname'] %}{{ initial_user['fullname'] }}{% endif %}" hx-post="/users/user-check" hx-trigger="keyup changed delay:500ms" hx-target="#username-name">
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fa fa-user-circle-o" aria-hidden="true"></i>
|
||||||
|
</span>
|
||||||
|
<!-- <span class="icon is-small is-right">
|
||||||
|
<img src="/static/icons/emblem-default-symbolic.svg">
|
||||||
|
</span> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label>{{ string_dict['user_name'] }}</label>
|
||||||
|
<div class="control has-icons-left has-icons-right">
|
||||||
|
<input class="input" type="text" placeholder="{{ string_dict['user_name'] }}" value="{% if initial_user['username'] %}{{ initial_user['username'] }}{% endif %}" name="username" hx-post="/users/user-check" hx-trigger="keyup changed delay:200ms" hx-trigger="load" hx-target="#username-status">
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fa fa-user-circle-o" aria-hidden="true"></i>
|
||||||
|
</span>
|
||||||
|
<!-- <span class="icon is-small is-right">
|
||||||
|
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
|
||||||
|
</span> -->
|
||||||
|
</div>
|
||||||
|
<div id="username-status">
|
||||||
|
<p> {{ string_dict['user_name_hint'] }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label class="password">{{ string_dict['password'] }}</label>
|
||||||
|
<div class="control has-icons-left has-icons-right">
|
||||||
|
<input class="input" name="password" type="password" placeholder="{{ string_dict['password'] }}" value="{% if initial_user['password'] %}{{ initial_user['password'] }}{% endif %}" hx-post="/users/password-check" hx-trigger="keyup changed delay:200ms" hx-target="#password-status">
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fa fa-address-card" aria-hidden="true"></i>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<label class="password">{{ string_dict['password_confirm'] }}</label>
|
||||||
|
<div class="control has-icons-left has-icons-right">
|
||||||
|
<input class="input" name="password_confirm" type="password" placeholder="{{ string_dict['password_confirm'] }}" value="{% if initial_user['password_confirm'] %}{{ initial_user['password_confirm'] }}{% endif %}" hx-post="/users/password-check" hx-trigger="keyup changed delay:200ms" hx-target="#password-status">
|
||||||
|
<span class="icon is-small is-left">
|
||||||
|
<i class="fa fa-address-card" aria-hidden="true"></i>
|
||||||
|
</span>
|
||||||
|
<div id="password-status">
|
||||||
|
<p> </p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div> <!-- style 180 -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
8
src/yasi_applets/welcome/__init__.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
bp = Blueprint('welcome', __name__,
|
||||||
|
template_folder='',
|
||||||
|
static_folder='static',
|
||||||
|
static_url_path='/welcome/static')
|
||||||
|
|
||||||
|
from yasi_applets.welcome import routes
|
||||||
BIN
src/yasi_applets/welcome/locales/af/LC_MESSAGES/welcome.mo
Normal file
33
src/yasi_applets/welcome/locales/af/LC_MESSAGES/welcome.po
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2024-12-15 21:52+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: en\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: UTF-8\n"
|
||||||
|
|
||||||
|
#: routes.py:27
|
||||||
|
msgid "Welcome! This setup program will install Debian on to your system."
|
||||||
|
msgstr "Welkom! Hierdie program sal jou deur die proses lei om Debian te installeer na jou sisteem."
|
||||||
|
|
||||||
|
#: routes.py:28
|
||||||
|
msgid "Please confirm the following details:"
|
||||||
|
msgstr "Bevestig asseblief die volgende:"
|
||||||
|
|
||||||
|
#: routes.py:29
|
||||||
|
msgid "Language:"
|
||||||
|
msgstr "Taal:"
|
||||||
|
|
||||||
|
#: routes.py:30
|
||||||
|
msgid "Keyboard Layout:"
|
||||||
|
msgstr "Knoppies Uitleg:"
|
||||||
|
|
||||||
|
#: routes.py:31
|
||||||
|
msgid "Time Zone:"
|
||||||
|
msgstr "Tyd Zone:"
|
||||||
BIN
src/yasi_applets/welcome/locales/en-za/LC_MESSAGES/welcome.mo
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2024-12-15 21:52+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: en-za\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: UTF-8\n"
|
||||||
|
|
||||||
|
#: routes.py:27
|
||||||
|
msgid "Welcome! This setup program will install Debian on to your system."
|
||||||
|
msgstr "Howzit! This setup program will install Debian on to your system."
|
||||||
|
|
||||||
|
#: routes.py:28
|
||||||
|
msgid "Please confirm the following details:"
|
||||||
|
msgstr "Please confirm the following details:"
|
||||||
|
|
||||||
|
#: routes.py:29
|
||||||
|
msgid "Language:"
|
||||||
|
msgstr "Language:"
|
||||||
|
|
||||||
|
#: routes.py:30
|
||||||
|
msgid "Keyboard Layout:"
|
||||||
|
msgstr "Keyboard Layout:"
|
||||||
|
|
||||||
|
#: routes.py:31
|
||||||
|
msgid "Time Zone:"
|
||||||
|
msgstr "Time Zone:"
|
||||||
BIN
src/yasi_applets/welcome/locales/en/LC_MESSAGES/welcome.mo
Normal file
33
src/yasi_applets/welcome/locales/en/LC_MESSAGES/welcome.po
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2024-12-15 21:52+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: en\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: UTF-8\n"
|
||||||
|
|
||||||
|
#: routes.py:27
|
||||||
|
msgid "Welcome! This setup program will install Debian on to your system."
|
||||||
|
msgstr "Welcomen! This setup program will install Debian on to your system."
|
||||||
|
|
||||||
|
#: routes.py:28
|
||||||
|
msgid "Please confirm the following details:"
|
||||||
|
msgstr "Please confirmen the following details:"
|
||||||
|
|
||||||
|
#: routes.py:29
|
||||||
|
msgid "Language:"
|
||||||
|
msgstr "Language:"
|
||||||
|
|
||||||
|
#: routes.py:30
|
||||||
|
msgid "Keyboard Layout:"
|
||||||
|
msgstr "Keyboard Layout:"
|
||||||
|
|
||||||
|
#: routes.py:31
|
||||||
|
msgid "Time Zone:"
|
||||||
|
msgstr "Time Zone:"
|
||||||
BIN
src/yasi_applets/welcome/locales/fr/LC_MESSAGES/welcome.mo
Normal file
33
src/yasi_applets/welcome/locales/fr/LC_MESSAGES/welcome.po
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2024-12-15 21:52+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: fr\n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: UTF-8\n"
|
||||||
|
|
||||||
|
#: routes.py:27
|
||||||
|
msgid "Welcome! This setup program will install Debian on to your system."
|
||||||
|
msgstr "Bienvienue! This setup program will install Debian on to your system."
|
||||||
|
|
||||||
|
#: routes.py:28
|
||||||
|
msgid "Please confirm the following details:"
|
||||||
|
msgstr "Please confirmen the following details:"
|
||||||
|
|
||||||
|
#: routes.py:29
|
||||||
|
msgid "Language:"
|
||||||
|
msgstr "Language:"
|
||||||
|
|
||||||
|
#: routes.py:30
|
||||||
|
msgid "Keyboard Layout:"
|
||||||
|
msgstr "Keyboard Layout:"
|
||||||
|
|
||||||
|
#: routes.py:31
|
||||||
|
msgid "Time Zone:"
|
||||||
|
msgstr "Time Zone:"
|
||||||
38
src/yasi_applets/welcome/locales/welcome.pot
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2024-12-15 21:52+0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: routes.py:27
|
||||||
|
msgid "Welcome! This setup program will install Debian on to your system."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:28
|
||||||
|
msgid "Please confirm the following details:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:29
|
||||||
|
msgid "Language:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:30
|
||||||
|
msgid "Keyboard Layout:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: routes.py:31
|
||||||
|
msgid "Time Zone:"
|
||||||
|
msgstr ""
|
||||||
114
src/yasi_applets/welcome/routes.py
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
from yasi_applets.welcome import bp
|
||||||
|
from flask import Flask, request, session, redirect, \
|
||||||
|
url_for, render_template, flash, Blueprint
|
||||||
|
# we use this neat little trick to get config data from the main app
|
||||||
|
from flask import current_app
|
||||||
|
import gettext
|
||||||
|
import dmm.lsblk as lsblk
|
||||||
|
import dmm.timezone as timezone
|
||||||
|
|
||||||
|
# Set up Gettext
|
||||||
|
def set_language(LANG):
|
||||||
|
"""
|
||||||
|
Sets language for this applet
|
||||||
|
"""
|
||||||
|
translations = gettext.translation("welcome", './applets/welcome/locales',
|
||||||
|
fallback=True, languages=[LANG])
|
||||||
|
translations.install()
|
||||||
|
_ = translations.gettext
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/welcome',methods=['GET', 'POST', 'PUT'])
|
||||||
|
def welcome_index():
|
||||||
|
"""
|
||||||
|
The page you'd get if you access the root of
|
||||||
|
this app in a browser.
|
||||||
|
"""
|
||||||
|
set_language(current_app.config['CONFIG']['settings']['language'])
|
||||||
|
if request.method == 'POST':
|
||||||
|
if "lang" in request.form.keys():
|
||||||
|
current_app.config['CONFIG']['settings']['language'] = request.form["lang"]
|
||||||
|
LANG = current_app.config['CONFIG']['settings']['language']
|
||||||
|
set_language(LANG)
|
||||||
|
FORMLANG = request.form["lang"]
|
||||||
|
if "keyboard" in request.form.keys():
|
||||||
|
print(request.form["keyboard"])
|
||||||
|
if "timezone" in request.form.keys():
|
||||||
|
print(request.form["timezone"])
|
||||||
|
global lang
|
||||||
|
lang = current_app.config['CONFIG']['settings']['language']
|
||||||
|
blkid = lsblk.list_scsi_devices()
|
||||||
|
string_dict = build_stringlist()
|
||||||
|
build_menu()
|
||||||
|
build_summary()
|
||||||
|
menu = current_app.config['CONFIG']['settings']['menu_order'].split(" ")
|
||||||
|
next_step_url = menu[menu.index("welcome")+1]
|
||||||
|
previous_step_url = menu[menu.index("welcome")-1]
|
||||||
|
|
||||||
|
print("index is: " , menu.index("welcome"))
|
||||||
|
if menu.index("welcome") == 0:
|
||||||
|
previous_step_url = False
|
||||||
|
else:
|
||||||
|
previous_step_url = menu[menu.index("users")-1]
|
||||||
|
|
||||||
|
print("next is: " + next_step_url)
|
||||||
|
print("previous is: " , previous_step_url)
|
||||||
|
power_button = '<button class="button is-dark"> <i class="fa fa-check" aria-hidden="true"></i> Power: AC </button>'
|
||||||
|
internet_button = ' <button class="button is-dark"> <i class="fa fa-check" aria-hidden="true"></i> Internet </button>'
|
||||||
|
bottom_menu = power_button + internet_button
|
||||||
|
|
||||||
|
return render_template('welcome.html',
|
||||||
|
string_dict=string_dict, selected_lang=lang,
|
||||||
|
menu=current_app.config['CONFIG']['settings']['menu'],
|
||||||
|
menu_order=current_app.config['CONFIG']['settings']['menu_order'].split(),
|
||||||
|
timezones=timezone.list_timezones()[1].split("\n"),
|
||||||
|
previous_step=previous_step_url,
|
||||||
|
next_step=next_step_url,
|
||||||
|
bottom_menu=bottom_menu)
|
||||||
|
|
||||||
|
|
||||||
|
def build_stringlist():
|
||||||
|
"""
|
||||||
|
Return all the strings that is used in this applet."
|
||||||
|
"""
|
||||||
|
string_dict = {}
|
||||||
|
string_dict['menu_item'] = _("Welcome")
|
||||||
|
string_dict['welcome_text'] = _("Welcome! This setup program will install Debian on to your system.")
|
||||||
|
string_dict['confirm_text'] = _("Please confirm the following details:")
|
||||||
|
string_dict['language_text'] = _("Language:")
|
||||||
|
string_dict['keylayout_text'] = _("Keyboard Layout:")
|
||||||
|
string_dict['timezone_text'] = _("Time Zone:")
|
||||||
|
string_dict['basicsettings_text'] = _("Basic Settings:")
|
||||||
|
lang_dict = {}
|
||||||
|
lang_dict['af'] = _("Afrikaans")
|
||||||
|
lang_dict['en'] = _("English (International)")
|
||||||
|
lang_dict['en-us'] = _("English (United States)")
|
||||||
|
lang_dict['en-uk'] = _("English (United Kingdom)")
|
||||||
|
lang_dict['en-za'] = _("English (South Africa)")
|
||||||
|
string_dict['lang_list'] = lang_dict
|
||||||
|
return string_dict
|
||||||
|
|
||||||
|
def build_menu():
|
||||||
|
"""
|
||||||
|
Define menu items and paths.
|
||||||
|
"""
|
||||||
|
current_app.config['CONFIG']['settings']['menu']['welcome'] = (build_stringlist()['menu_item'], "/welcome", 10)
|
||||||
|
|
||||||
|
|
||||||
|
def build_summary():
|
||||||
|
"""
|
||||||
|
Write up a summary of what this module will do.
|
||||||
|
"""
|
||||||
|
html = ("<b><big>Basic settings</big></b><p> Language: " + lang + "</p>")
|
||||||
|
if not 'Summary' in current_app.config['CONFIG']:
|
||||||
|
current_app.config['CONFIG']['Summary'] = {}
|
||||||
|
current_app.config['CONFIG']['Summary']['welcome'] = {}
|
||||||
|
current_app.config['CONFIG']['Summary']['welcome']['heading'] = "Basic Settings"
|
||||||
|
print(current_app.config['CONFIG']['Summary']['welcome'])
|
||||||
|
text = "Language: " + str(current_app.config['CONFIG']['settings']['language'])
|
||||||
|
current_app.config['CONFIG']['Summary']['welcome']['text'] = text
|
||||||
|
return(html)
|
||||||
|
|
||||||
|
|
||||||
|
set_language(current_app.config['CONFIG']['settings']['language'])
|
||||||
|
build_menu
|
||||||
BIN
src/yasi_applets/welcome/static/img/banner.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
38
src/yasi_applets/welcome/welcome.html
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
{% extends "layout.html" %}
|
||||||
|
{% block body %}
|
||||||
|
|
||||||
|
<img style="width: 100%; border-radius: 8px;"
|
||||||
|
src="/welcome/static/img/banner.png"
|
||||||
|
alt="Debian Image banner" />
|
||||||
|
|
||||||
|
<p><b> {{ string_dict['welcome_text'] }} </b></p>
|
||||||
|
<p>{{ string_dict['confirm_text'] }} </p> <br />
|
||||||
|
|
||||||
|
<form action="/welcome" method="POST">
|
||||||
|
<i class="fa fa-language" aria-hidden="true"></i> {{ string_dict['language_text'] }}
|
||||||
|
<div class="control is-link" width="180px">
|
||||||
|
<div class="select">
|
||||||
|
<select hx-post="/welcome" hx-target="body" name="lang" style="width: 220px">
|
||||||
|
{% for lang in string_dict['lang_list'] %}
|
||||||
|
<option value="{{lang}}" {% if lang == selected_lang %} selected=selected {% endif %}>{{ string_dict['lang_list'][lang] }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<i class="fa fa-keyboard-o" aria-hidden="true"></i> {{ string_dict['keylayout_text'] }}
|
||||||
|
<div class="control is-link">
|
||||||
|
<div class="select">
|
||||||
|
<select hx-post="/welcome" hx-target="body" name="keyboard" style="width: 220px">
|
||||||
|
<option>en-us</option>
|
||||||
|
<option>en-uk</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||