From 8791c58cbf82d546dc2bb1ce9ef47266cae31655 Mon Sep 17 00:00:00 2001 From: Jonathan Carter Date: Sat, 23 Aug 2025 16:03:38 +0200 Subject: [PATCH] Various ui work --- src/applets/software/routes.py | 20 +++++++++++-- src/applets/software/software.html | 46 +++++++++++++++++++++--------- src/applets/users/routes.py | 27 +++++++++++------- src/applets/users/users.html | 15 ++++++++-- src/applets/welcome/welcome.html | 39 +++++++------------------ 5 files changed, 90 insertions(+), 57 deletions(-) diff --git a/src/applets/software/routes.py b/src/applets/software/routes.py index f40ef6f..cc58537 100644 --- a/src/applets/software/routes.py +++ b/src/applets/software/routes.py @@ -18,6 +18,8 @@ def webui_software(): sources_button = '  ' blends_button = '  ' bottom_menu = sources_button + blends_button + # Leave out useless buttons until they do more + bottom_menu = '' build_summary() return render_template('software.html', @@ -26,7 +28,8 @@ def webui_software(): previous_step = previous_step_url, next_step = next_step_url, 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']) @@ -42,6 +45,19 @@ def software_settings(): 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. @@ -58,7 +74,7 @@ def build_summary(): 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']) + "
No desktop environment selected." + current_app.config['CONFIG']['Summary']['software']['text'] = "Participate in Popularity Contest: " + str(current_app.config['CONFIG']['recipe']['popcon']['enable_popcon']) + "
Desktop environment selected: " + str(current_app.config['CONFIG']['recipe']['install_desktop_environment']['packages']) return("ok?") diff --git a/src/applets/software/software.html b/src/applets/software/software.html index 663e68f..13fc4f5 100644 --- a/src/applets/software/software.html +++ b/src/applets/software/software.html @@ -4,26 +4,45 @@

Would you like fries with that?


- -
- - -Popularity Contest - - -
- + Popularity Contest +

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.



+ +
+

Desktop Environment

+
+

Would you like to install a graphical environment for this system?

+ +
+ +
+ -
+ + + + + + + {% endblock %} diff --git a/src/applets/users/routes.py b/src/applets/users/routes.py index 1ca77d1..c9a42b3 100644 --- a/src/applets/users/routes.py +++ b/src/applets/users/routes.py @@ -38,6 +38,7 @@ def users_root(): 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] @@ -55,28 +56,32 @@ def users_root(): @bp.route('/users/user-check/', methods=['GET', 'POST', 'PUT']) def check_user(): if request.method == 'POST': - print("Ok, so method is POST") - print("keys are: ", request.form.keys()) username = request.form["username"] 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]['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"]: return('

That username is not available

') else: return('

That username is available

') 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('

Passwords do not match

') + else: + return('

Passwords match

') + build_summary() + return("") + def build_stringlist(): """ diff --git a/src/applets/users/users.html b/src/applets/users/users.html index c61bad4..d07fc8b 100644 --- a/src/applets/users/users.html +++ b/src/applets/users/users.html @@ -18,16 +18,22 @@ +
- + +

{{ string_dict['user_name_hint'] }}

@@ -37,7 +43,7 @@
- + @@ -47,10 +53,13 @@
- + +
+

+
diff --git a/src/applets/welcome/welcome.html b/src/applets/welcome/welcome.html index 2a7614d..7b6ac45 100644 --- a/src/applets/welcome/welcome.html +++ b/src/applets/welcome/welcome.html @@ -8,10 +8,8 @@

{{ string_dict['welcome_text'] }}

{{ string_dict['confirm_text'] }}


- + +
- - - - -
-
-Keyboard -
- + +
{% endblock %}