Compare commits

...

3 Commits

Author SHA1 Message Date
Jonathan Carter
652bbba9c0 re-add yasi-applets 2025-08-23 22:33:58 +02:00
Jonathan Carter
69d6ba277d Move a whole bunch of stuff around 2025-08-23 22:33:41 +02:00
Jonathan Carter
8791c58cbf Various ui work 2025-08-23 16:03:38 +02:00
97 changed files with 209 additions and 253 deletions

View File

@@ -1,7 +0,0 @@
from flask import Blueprint
bp = Blueprint('install', __name__,
template_folder='')
from applets.install import routes

View File

@@ -1,7 +0,0 @@
from flask import Blueprint
bp = Blueprint('main', __name__,
template_folder='')
from applets.main import routes

View File

@@ -1,7 +0,0 @@
from flask import Blueprint
bp = Blueprint('software', __name__,
template_folder='')
from applets.software import routes

View File

@@ -1,7 +0,0 @@
from flask import Blueprint
bp = Blueprint('users', __name__,
template_folder='')
from applets.users import routes

View File

@@ -1,6 +0,0 @@
from flask import Blueprint
bp = Blueprint('webui', __name__)
from applets.webui import routes

View File

@@ -1,94 +0,0 @@
from applets.webui import bp
from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint
@bp.route('/webui')
def webui_index():
"""
The page you'd get if you access the root of
this app in a browser.
"""
return ("""
<head>
<script src="/static/htmx.min.js.gz crossorigin="anonymous"></script>
</head>
<button hx-post="/clicked"
hx-trigger="click"
hx-target="#parent-div"
hx-swap="outerHTML" >
Click Me!
</button>
<div style="background-color: black; color: white; height: 200px; width: 200px;" hx-get="/welcome" hx-trigger="every 2s"></div>
<div hx-post="/welcome" hx-trigger="mouseenter">
1
<br><br><br><br>
[Here Mouse, Mouse!]
<br><Br><br><br>
2
</div>
Welcome to System Installer Daemon POC <br />
This is the WebUI Index
""")
@bp.route('/webui/welcome')
def webui_welcome():
"""
Welcome screen for the webui.
It's job right now is to:
- Obtain the language
- Check basic system eligibility
"""
return render_template('welcome.html')
@bp.route('/webui/users')
def webui_users():
"""
Users screen for the webui.
It's job right now is to:
- Set up an initial user
More functions will follow at a later stage
"""
return render_template('users.html')
@bp.route('/webui/disks')
def webui_disks():
"""
Disks screen for the webui.
"""
return render_template('disks.html')
@bp.route('/webui/disks/partition/<part>')
def webui_disks_partition(part):
"""
Partition modal for the webui partition screen.
"""
return render_template('disks_partition.html')
@bp.route('/webui/software')
def webui_software():
"""
Software screen for the webui.
"""
return render_template('software.html')
@bp.route('/webui/summary')
def webui_summary():
"""
Summary screen for the webui.
"""
return render_template('summary.html')

View File

@@ -1,6 +0,0 @@
from flask import Blueprint
bp = Blueprint('welcome', __name__,
template_folder='')
from applets.welcome import routes

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -1,55 +0,0 @@
{% extends "layout.html" %}
{% block body %}
<img style="width: 100%; border-radius: 8px;"
src="/static/applets/welcome/img/banner.png"
alt="Debian Image banner" />
<p><b> {{ string_dict['welcome_text'] }} </b></p>
<p>{{ string_dict['confirm_text'] }} </p> <br />
<!--
<div style="float: left; padding-left: 100px;">
<button class="button is-dark" style="height: 180px;">
<img src="/static/icons/language.jpg" width="96px" alt="{{ 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>
</button>
</div>
-->
<button class="button is-dark" style="float: left; margin-left: 100px; background-color: #242424; padding: 25px;">
<img src="/static/icons/language.jpg" width="96px" alt="{{ string_dict['language_text'] }}" />
<br> {{ string_dict['language_text'] }} {{ selected_lang }}
</button>
<!--
<div style="float: left; position: relative; top: -10px; padding-left: 100px;"
<button class="button is-dark">
<img src="/static/icons/keyboard.png" width="90px" />
<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-za</option>
</select>
</div>
</div>
</button>
</div>
-->
<div style="float: left; margin-left: 100px; background-color: #242424; padding: 25px;">
<img src="/static/icons/keyboard,png" width="96px" /><br>
Keyboard
</div>
{% endblock %}

View File

@@ -1 +0,0 @@
../../../applets/welcome/img

Binary file not shown.

Before

Width:  |  Height:  |  Size: 304 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
<path d="m 8 0 c -4.40625 0 -8 3.59375 -8 8 s 3.59375 8 8 8 s 8 -3.59375 8 -8 s -3.59375 -8 -8 -8 z m 3.398438 4.507812 c 0.265624 -0.027343 0.527343 0.050782 0.734374 0.21875 c 0.425782 0.351563 0.488282 0.980469 0.140626 1.40625 l -4.5 5.5 c -0.179688 0.21875 -0.441407 0.351563 -0.722657 0.367188 c -0.28125 0.011719 -0.558593 -0.09375 -0.757812 -0.292969 l -2.5 -2.5 c -0.390625 -0.390625 -0.390625 -1.023437 0 -1.414062 s 1.023437 -0.390625 1.414062 0 l 1.71875 1.71875 l 3.800781 -4.644531 c 0.167969 -0.203126 0.410157 -0.335938 0.671876 -0.363282 z m 0 0" fill="#2e3436"/>
</svg>

Before

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
<path d="m 3 1 c -1.644531 0 -3 1.355469 -3 3 v 6 c 0 1.644531 1.355469 3 3 3 h 1 v 3 l 3 -3 h 6 c 1.644531 0 3 -1.355469 3 -3 v -6 c 0 -1.644531 -1.355469 -3 -3 -3 z m 0 0" fill="#2e3436"/>
</svg>

Before

Width:  |  Height:  |  Size: 329 B

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
<path d="m 3 1 c -1.644531 0 -3 1.355469 -3 3 v 6 c 0 1.644531 1.355469 3 3 3 h 1 v 3 l 3 -3 h 6 c 1.644531 0 3 -1.355469 3 -3 v -6 c 0 -1.644531 -1.355469 -3 -3 -3 z m 0 2 h 10 c 0.554688 0 1 0.445312 1 1 v 6 c 0 0.554688 -0.445312 1 -1 1 h -10 c -0.570312 0 -1 -0.429688 -1 -1 v -6 c 0 -0.554688 0.445312 -1 1 -1 z m 0 0" fill="#2e3436" fill-opacity="0.34902"/>
</svg>

Before

Width:  |  Height:  |  Size: 502 B

View File

@@ -38,7 +38,7 @@ if DEV_MODE:
for APP in APPS.split(" "): for APP in APPS.split(" "):
print(f"Loading applet: {APP} ") print(f"Loading applet: {APP} ")
# Dynamically import the blueprint module # Dynamically import the blueprint module
module = importlib.import_module(f"applets.{APP}") module = importlib.import_module(f"yasi_applets.{APP}")
# Get the blueprint (bp) from the imported module # Get the blueprint (bp) from the imported module
bp = getattr(module, "bp") bp = getattr(module, "bp")
# Register the blueprint with the app # Register the blueprint with the app

View File

@@ -3,12 +3,11 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="/static/bulma.css" rel="stylesheet"> <link href="/main/static/bulma.css" rel="stylesheet">
<link href="/static/system-installer.css" rel="stylesheet"> <link href="/main/static/system-installer.css" rel="stylesheet">
<link rel="shortcut icon" href="/static/icons/blippie.png" type="image/x-icon"> <link rel="shortcut icon" href="/main/static/icons/blippie.png" type="image/x-icon">
<link rel="stylesheet" href="/usr/share/fonts-fork-awesome/css/fork-awesome.css"> <link rel="stylesheet" href="/main/static/fork-awesome.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fork-awesome@1.2.0/css/fork-awesome.min.css" integrity="sha256-XoaMnoYC5TH6/+ihMEnospgm0J1PM/nioxbOUdnM8HY=" crossorigin="anonymous"> <script src="/main/static/htmx.min.js" crossorigin="anonymous"></script>
<script src="/static/htmx.min.js" crossorigin="anonymous"></script>
</head> </head>
<body> <body>

View File

@@ -3,5 +3,5 @@ from flask import Blueprint
bp = Blueprint('disks', __name__, bp = Blueprint('disks', __name__,
template_folder='') template_folder='')
from applets.disks import routes from yasi_applets.disks import routes

View File

@@ -1,4 +1,4 @@
from applets.disks import bp from yasi_applets.disks import bp
from flask import Flask, request, session, redirect, \ from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint url_for, render_template, flash, Blueprint
import dmm.lsblk as lsblk import dmm.lsblk as lsblk

View File

@@ -3,5 +3,5 @@ from flask import Blueprint
bp = Blueprint('hardware', __name__, bp = Blueprint('hardware', __name__,
template_folder='') template_folder='')
from applets.hardware import routes from yasi_applets.hardware import routes

View File

@@ -1,4 +1,4 @@
from applets.hardware import bp from yasi_applets.hardware import bp
from flask import Flask, request, session, redirect, \ from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint url_for, render_template, flash, Blueprint
from flask import current_app from flask import current_app

View 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

View File

@@ -10,7 +10,7 @@
<br /> <br />
<img style="width: 400px; padding: 20px;" src="/static/slide1.png" /> <br /> <img style="width: 400px; padding: 20px;" src="/install/static/slide1.png" /> <br />
<p> <p>
Installing system, the rest of the process is automated. Installing system, the rest of the process is automated.
</p> </p>

View File

@@ -1,4 +1,4 @@
from applets.install import bp from yasi_applets.install import bp
from flask import Flask, request, session, redirect, \ from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint, jsonify url_for, render_template, flash, Blueprint, jsonify
from flask import current_app from flask import current_app

View 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

View File

@@ -1,4 +1,4 @@
from applets.welcome import bp from yasi_applets.welcome import bp
from flask import Flask, request, session, redirect, \ from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint url_for, render_template, flash, Blueprint
# we use this neat little trick to get config data from the main app # we use this neat little trick to get config data from the main app

View File

@@ -0,0 +1 @@
/usr/share/fonts-fork-awesome/css/fork-awesome.css

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View 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

View File

Before

Width:  |  Height:  |  Size: 585 B

After

Width:  |  Height:  |  Size: 585 B

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View 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

View File

@@ -1,4 +1,4 @@
from applets.software import bp from yasi_applets.software import bp
from flask import Flask, request, session, redirect, \ from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint url_for, render_template, flash, Blueprint
from flask import current_app from flask import current_app
@@ -18,6 +18,8 @@ def webui_software():
sources_button = '&nbsp; <button class="button iis-info"> <i class="fa fa-cloud-download" aria-hidden="true"></i> &nbsp; Edit Sources </button>' sources_button = '&nbsp; <button class="button iis-info"> <i class="fa fa-cloud-download" aria-hidden="true"></i> &nbsp; Edit Sources </button>'
blends_button = '&nbsp; <button class="button iis-info"> <i class="fa fa-download" aria-hidden="true"></i> &nbsp; Install a Blend </button>' blends_button = '&nbsp; <button class="button iis-info"> <i class="fa fa-download" aria-hidden="true"></i> &nbsp; Install a Blend </button>'
bottom_menu = sources_button + blends_button bottom_menu = sources_button + blends_button
# Leave out useless buttons until they do more
bottom_menu = ''
build_summary() build_summary()
return render_template('software.html', return render_template('software.html',
@@ -26,7 +28,8 @@ def webui_software():
previous_step = previous_step_url, previous_step = previous_step_url,
next_step = next_step_url, next_step = next_step_url,
bottom_menu = bottom_menu, bottom_menu = bottom_menu,
popcon=current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']) 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']) @bp.route('/software/settings', methods=['GET', 'POST'])
@@ -42,6 +45,19 @@ def software_settings():
return ('', 204) 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(): def build_menu():
""" """
Define menu items and paths. Define menu items and paths.
@@ -58,7 +74,7 @@ def build_summary():
current_app.config['CONFIG']['Summary']['software'] = {} current_app.config['CONFIG']['Summary']['software'] = {}
current_app.config['CONFIG']['Summary']['software']['heading'] = "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']['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/>No desktop environment selected." 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?") return("ok?")

View File

@@ -4,26 +4,45 @@
<p> <b> Would you like fries with that? </b></p> <p> <b> Would you like fries with that? </b></p>
<br> <br>
<big> Popularity Contest </big>
<div style="background-color: gray; padding: 4px 6px 7px 6px; <br><br>
border-radius: 10px; margin-bottom: 20px;">
<span style="width: 100%; border-radius: 8px 8px 0 0;"
class="tag is-black">
Popularity Contest
</span>
<div style="padding-left: 15px; padding-right: 15px; background-color: #fff;
color: #000;">
<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> <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" <input style="background-color: #777777;" type="checkbox" id="popcon"
name="popcon" hx-post="/software/settings" hx-trigger="change" name="popcon" hx-post="/software/settings" hx-trigger="change"
{% if popcon %} checked {% endif %}> {% if popcon %} checked {% endif %}>
<label for="popcon"> Participate in PopCon </label><br> <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> </div>
</div> </form>
<!--
<div style="background-color: gray; padding: 4px 6px 7px 6px; border-radius: 10px;"> <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"> <p> <span style="width: 100%; border-radius: 8px 8px 0 0;" class="tag is-black">
@@ -56,5 +75,6 @@ Select software from Debian archives</span>
</div> </div>
</div> </div>
</div> </div>
-->
{% endblock %} {% endblock %}

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -3,5 +3,5 @@ from flask import Blueprint
bp = Blueprint('summary', __name__, bp = Blueprint('summary', __name__,
template_folder='') template_folder='')
from applets.summary import routes from yasi_applets.summary import routes

View File

@@ -1,4 +1,4 @@
from applets.summary import bp from yasi_applets.summary import bp
from flask import Flask, request, session, redirect, \ from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint url_for, render_template, flash, Blueprint
from flask import current_app from flask import current_app

View 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

View File

@@ -1,4 +1,4 @@
from applets.software import bp from yasi_applets.software import bp
from flask import Flask, request, session, redirect, \ from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint url_for, render_template, flash, Blueprint
import gettext import gettext
@@ -38,6 +38,7 @@ def users_root():
ad_button = '&nbsp; <button class="button is-light"> <i class="fa fa-address-card" aria-hidden="true"></i> &nbsp; Connect AD </button>' ad_button = '&nbsp; <button class="button is-light"> <i class="fa fa-address-card" aria-hidden="true"></i> &nbsp; Connect AD </button>'
csv_button = '&nbsp; <button class="button is-light"> <i class="fa fa-users" aria-hidden="true"></i> &nbsp; Import CSV </button>' csv_button = '&nbsp; <button class="button is-light"> <i class="fa fa-users" aria-hidden="true"></i> &nbsp; Import CSV </button>'
bottom_menu = root_button + ldap_button + ad_button + csv_button bottom_menu = root_button + ldap_button + ad_button + csv_button
bottom_menu = ""
initial_user = current_app.config['CONFIG']['recipe']['users']['users'][0] initial_user = current_app.config['CONFIG']['recipe']['users']['users'][0]
@@ -55,28 +56,32 @@ def users_root():
@bp.route('/users/user-check/', methods=['GET', 'POST', 'PUT']) @bp.route('/users/user-check/', methods=['GET', 'POST', 'PUT'])
def check_user(): def check_user():
if request.method == 'POST': if request.method == 'POST':
print("Ok, so method is POST")
print("keys are: ", request.form.keys())
username = request.form["username"] username = request.form["username"]
fullname = request.form["fullname"] fullname = request.form["fullname"]
password = request.form["password"]
password_confirm = request.form["password_confirm"]
print(current_app.config['CONFIG']['recipe']['users']['users'][0])
print("fullname is: " + fullname)
print("password is: " + password)
print("password_confirm is: " + password_confirm)
current_app.config['CONFIG']['recipe']['users']['users'][0]['username'] = username current_app.config['CONFIG']['recipe']['users']['users'][0]['username'] = username
current_app.config['CONFIG']['recipe']['users']['users'][0]['fullname'] = fullname current_app.config['CONFIG']['recipe']['users']['users'][0]['fullname'] = fullname
current_app.config['CONFIG']['recipe']['users']['users'][0]['password'] = password
current_app.config['CONFIG']['recipe']['users']['users'][0]['password_confirm'] = password_confirm
if username in ["root", "games"]: if username in ["root", "games"]:
return('<p class="has-text-danger"><b>That username is not available</b> </p>') return('<p class="has-text-danger"><b>That username is not available</b> </p>')
else: else:
return('<p class="has-text-success"><b>That username is available</b> </p>') return('<p class="has-text-success"><b>That username is available</b> </p>')
build_summary() build_summary()
return("bleh") 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(): def build_stringlist():
""" """

View 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

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -7,7 +7,7 @@
<form action="/users" method="POST"> <form action="/users" method="POST">
<img src="/static/icons/avatar-default.svg" width="160px" style="float: left; position: absolute;" /> <img src="/users/static/img/avatar-default.svg" width="160px" style="float: left; position: absolute;" />
<div style="margin-left: 180px;"> <div style="margin-left: 180px;">
@@ -18,16 +18,22 @@
<span class="icon is-small is-left"> <span class="icon is-small is-left">
<i class="fa fa-user-circle-o" aria-hidden="true"></i> <i class="fa fa-user-circle-o" aria-hidden="true"></i>
</span> </span>
<!-- <span class="icon is-small is-right">
<img src="/static/icons/emblem-default-symbolic.svg">
</span> -->
</div> </div>
</div> </div>
<div class="field"> <div class="field">
<label>{{ string_dict['user_name'] }}</label> <label>{{ string_dict['user_name'] }}</label>
<div class="control has-icons-left has-icons-right"> <div class="control has-icons-left has-icons-right">
<input class="input is-success" 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"> <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"> <span class="icon is-small is-left">
<i class="fa fa-user-circle-o" aria-hidden="true"></i> <i class="fa fa-user-circle-o" aria-hidden="true"></i>
</span> </span>
<!-- <span class="icon is-small is-right">
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
</span> -->
</div> </div>
<div id="username-status"> <div id="username-status">
<p> {{ string_dict['user_name_hint'] }}</p> <p> {{ string_dict['user_name_hint'] }}</p>
@@ -37,7 +43,7 @@
<div class="field"> <div class="field">
<label class="password">{{ string_dict['password'] }}</label> <label class="password">{{ string_dict['password'] }}</label>
<div class="control has-icons-left has-icons-right"> <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/user-check" hx-trigger="keyup changed delay:200ms" hx-target="#username-status"> <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"> <span class="icon is-small is-left">
<i class="fa fa-address-card" aria-hidden="true"></i> <i class="fa fa-address-card" aria-hidden="true"></i>
</span> </span>
@@ -47,10 +53,13 @@
<div class="field"> <div class="field">
<label class="password">{{ string_dict['password_confirm'] }}</label> <label class="password">{{ string_dict['password_confirm'] }}</label>
<div class="control has-icons-left has-icons-right"> <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/user-check" hx-trigger="keyup changed delay:200ms" hx-target="#password-status"> <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"> <span class="icon is-small is-left">
<i class="fa fa-address-card" aria-hidden="true"></i> <i class="fa fa-address-card" aria-hidden="true"></i>
</span> </span>
<div id="password-status">
<p> </p>
</div>
</div> </div>
</div> </div>

View 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

View File

@@ -1,4 +1,4 @@
from applets.welcome import bp from yasi_applets.welcome import bp
from flask import Flask, request, session, redirect, \ from flask import Flask, request, session, redirect, \
url_for, render_template, flash, Blueprint url_for, render_template, flash, Blueprint
# we use this neat little trick to get config data from the main app # we use this neat little trick to get config data from the main app
@@ -53,8 +53,8 @@ def welcome_index():
print("next is: " + next_step_url) print("next is: " + next_step_url)
print("previous is: " , previous_step_url) print("previous is: " , previous_step_url)
power_button = '<button class="button is-dark"> <img width="16px;" src="/static/icons/greencheck.png"> &nbsp; Power: AC </button>' power_button = '<button class="button is-dark"> <i class="fa fa-check" aria-hidden="true"></i> &nbsp; Power: AC </button>'
internet_button = '&nbsp; <button class="button is-dark"> <img width="16px;" src="/static/icons/greencheck.png"> &nbsp; Internet </button>' internet_button = '&nbsp; <button class="button is-dark"> <i class="fa fa-check" aria-hidden="true"></i> &nbsp; Internet </button>'
bottom_menu = power_button + internet_button bottom_menu = power_button + internet_button
return render_template('welcome.html', return render_template('welcome.html',

View File

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View 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 %}