Compare commits
10 Commits
0.0.0.1
...
373ce1247e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
373ce1247e | ||
|
|
eaa983e955 | ||
|
|
652bbba9c0 | ||
|
|
69d6ba277d | ||
|
|
8791c58cbf | ||
|
|
258a359ce1 | ||
|
|
21b210a689 | ||
|
|
430b144d92 | ||
|
|
d4cfa4815c | ||
|
|
9f8f89fde2 |
@@ -1,7 +0,0 @@
|
||||
from flask import Blueprint
|
||||
|
||||
bp = Blueprint('install', __name__,
|
||||
template_folder='')
|
||||
|
||||
from applets.install import routes
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
{% 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="/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>
|
||||
</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 %}
|
||||
@@ -1,37 +0,0 @@
|
||||
from applets.install import bp
|
||||
from flask import Flask, request, session, redirect, \
|
||||
url_for, render_template, flash, Blueprint
|
||||
from flask import current_app
|
||||
|
||||
@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")
|
||||
|
||||
|
||||
@bp.route('/install-status',methods=['GET', 'POST', 'PUT'])
|
||||
def install_status():
|
||||
"""
|
||||
Update on the status of the installation process.
|
||||
"""
|
||||
print("installation en coers")
|
||||
|
||||
|
||||
@bp.route('/settings',methods=['GET', 'POST', 'PUT'])
|
||||
def settings():
|
||||
"""
|
||||
Manage settings for the installation module.
|
||||
"""
|
||||
print("Settings")
|
||||
@@ -1,7 +0,0 @@
|
||||
from flask import Blueprint
|
||||
|
||||
bp = Blueprint('main', __name__,
|
||||
template_folder='')
|
||||
|
||||
from applets.main import routes
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
from applets.main import bp
|
||||
|
||||
|
||||
@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")
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
from flask import Blueprint
|
||||
|
||||
bp = Blueprint('software', __name__,
|
||||
template_folder='')
|
||||
|
||||
from applets.software import routes
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
from flask import Blueprint
|
||||
|
||||
bp = Blueprint('users', __name__,
|
||||
template_folder='')
|
||||
|
||||
from applets.users import routes
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
from flask import Blueprint
|
||||
|
||||
bp = Blueprint('webui', __name__)
|
||||
|
||||
from applets.webui import routes
|
||||
|
||||
@@ -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')
|
||||
@@ -1,6 +0,0 @@
|
||||
from flask import Blueprint
|
||||
|
||||
bp = Blueprint('welcome', __name__,
|
||||
template_folder='')
|
||||
|
||||
from applets.welcome import routes
|
||||
|
Before Width: | Height: | Size: 14 KiB |
@@ -1 +0,0 @@
|
||||
../../../applets/welcome/img
|
||||
|
Before Width: | Height: | Size: 304 KiB |
|
Before Width: | Height: | Size: 8.2 KiB |
|
Before Width: | Height: | Size: 21 KiB |
@@ -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 |
|
Before Width: | Height: | Size: 35 KiB |
@@ -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 |
@@ -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 |
@@ -12,7 +12,8 @@ import importlib
|
||||
import yaml
|
||||
|
||||
# configuration
|
||||
CONFIGFILE="templates/dmm-installer-template.yaml"
|
||||
#CONFIGFILE="templates/dmm-installer-template.yaml"
|
||||
CONFIGFILE="templates/dmm-installer-vm-template.yaml"
|
||||
|
||||
# import config
|
||||
global config
|
||||
@@ -37,7 +38,7 @@ if DEV_MODE:
|
||||
for APP in APPS.split(" "):
|
||||
print(f"Loading applet: {APP} ")
|
||||
# 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
|
||||
bp = getattr(module, "bp")
|
||||
# Register the blueprint with the app
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<!-- Buttons on the left -->
|
||||
<div style="position: absolute; bottom: 15px; left: 15px;">
|
||||
|
||||
{% if previous_step %}
|
||||
<a href="/{{ previous_step }}"><button class="button is-light">Back</button></a>
|
||||
{% endif %}
|
||||
|
||||
{% if bottom_menu %}
|
||||
{{ bottom_menu | safe }}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Buttons on the right -->
|
||||
<div style="position: absolute; bottom: 15px; right: 15px;">
|
||||
{% if next_step %}
|
||||
{% if next_step == "install" %}
|
||||
<a href="/{{ next_step }}"><button hx-trigger="click, keyup[shiftKey&&key=='I'] from:body" class="button is-link">Install</button></a>
|
||||
{% else %}
|
||||
<a href="/{{ next_step }}"><button hx-trigger="click, keyup[shiftKey&&key=='N'] from:body" hx-target="/{{ next_step }}" class="button is-link">Next</button></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -1,20 +0,0 @@
|
||||
<!-- Header -->
|
||||
<div id="titlebar" style="padding: 15px; margin: -15px; padding-bottom: 30px;">
|
||||
|
||||
<!-- drag region class: -->
|
||||
<!-- <div id="titlebar" class="pywebview-drag-region" style="padding: 15px; margin: -15px; padding-bottom: 30px;"> -->
|
||||
|
||||
<button class="button is-link"> ☰ </button>
|
||||
|
||||
{% for item in menu_order %}
|
||||
<a href="{{ menu[item][1]}}"> <button class="button is-{% if request.path == menu[item][1] %}info{% else %}dark{% endif %}"> {{ menu[item][0]}} </button></a>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<div style="position: absolute; top: 15px; right: 15px;">
|
||||
<a href="/help"> <button class="button is-light"> <b> ? </b> </button></a>
|
||||
<button onclick="closeApp()" class="button is-danger" > 🗙 </button>
|
||||
</div>
|
||||
|
||||
</div> <!-- end pywebview-drag-region -->
|
||||
<!-- End Header -->
|
||||
@@ -1,28 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="/static/bulma.css" rel="stylesheet">
|
||||
<link href="/static/system-installer.css" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="/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="https://cdn.jsdelivr.net/npm/fork-awesome@1.2.0/css/fork-awesome.min.css" integrity="sha256-XoaMnoYC5TH6/+ihMEnospgm0J1PM/nioxbOUdnM8HY=" crossorigin="anonymous">
|
||||
<script src="/static/htmx.min.js" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="frame">
|
||||
{% include "header.html" %}
|
||||
|
||||
<div class="applet">
|
||||
{% block body %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
{% include "footer.html" %}
|
||||
|
||||
</div> <!-- class "frame" -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,5 +3,5 @@ from flask import Blueprint
|
||||
bp = Blueprint('disks', __name__,
|
||||
template_folder='')
|
||||
|
||||
from applets.disks import routes
|
||||
from yasi_applets.disks import routes
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from applets.disks import bp
|
||||
from yasi_applets.disks import bp
|
||||
from flask import Flask, request, session, redirect, \
|
||||
url_for, render_template, flash, Blueprint
|
||||
import dmm.lsblk as lsblk
|
||||
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/img/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")
|
||||
BIN
src/yasi_applets/install/static/img/slide1.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
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
|
||||
|
||||
36
src/yasi_applets/main/footer.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<!-- Buttons on the left -->
|
||||
<div style="position: absolute; bottom: 15px; left: 15px;">
|
||||
|
||||
{% if previous_step %}
|
||||
<!-- Why two of these? So that we can use two different keyboard shortcuts for back. -->
|
||||
<button style="display: none;" hx-get="/{{ previous_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[altKey&&key=='b'] from:body"></button>
|
||||
<a href="/{{ previous_step }}"><button hx-get="/{{ previous_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[ctrlKey&&code=='PageUp'] from:body" class="button is-light">Back</button></a>
|
||||
{% endif %}
|
||||
|
||||
{% if bottom_menu %}
|
||||
{{ bottom_menu | safe }}
|
||||
{% endif %}
|
||||
|
||||
</div> <!-- end buttons on the left -->
|
||||
|
||||
|
||||
<!-- Buttons on the right -->
|
||||
<div style="position: absolute; bottom: 15px; right: 15px;">
|
||||
|
||||
{% if next_step %}
|
||||
|
||||
{% if next_step == "install" %}
|
||||
<a href="/{{ next_step }}"><button hx-get="/{{ next_step }}" hx-target="body"
|
||||
hx-trigger="click, keyup[altKey&&key=='i'] from:body" class="button is-link">Install</button></a>
|
||||
{% else %}
|
||||
<!-- Why two of these? So that we can use two different keyboard shortcuts for next. -->
|
||||
<a href="/{{ next_step }}"<button hx-get="/{{ next_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[ctrlKey&&code=='PageDown'] from:body" class=""></button></a>
|
||||
<a href="/{{ next_step }}"<button hx-get="/{{ next_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[altKey&&key=='n'] from:body" class="button is-link">Next</button></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
</div> <!-- end buttons on the right -->
|
||||
20
src/yasi_applets/main/header.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!-- Header -->
|
||||
<div id="titlebar" style="padding: 15px; margin: -15px; padding-bottom: 30px;">
|
||||
|
||||
<!-- drag region class: -->
|
||||
<div id="titlebar" class="pywebview-drag-region" style="padding: 15px; margin: -15px; padding-bottom: 30px;">
|
||||
|
||||
<a hx-get="/main/menu" hx-swap="outerHTML"/> <button class="button is-link"> ☰ </button </a>
|
||||
|
||||
{% for item in menu_order %}
|
||||
<a href="{{ menu[item][1]}}"> <button class="button is-{% if request.path == menu[item][1] %}info{% else %}dark{% endif %}"> {{ menu[item][0]}} </button></a>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<div style="position: absolute; top: 15px; right: 15px;">
|
||||
<a hx-get="/main/help" hx-swap="outerHTML"/> <button class="button is-light"> <i class="fa fa-question" aria-hidden="true"></i> </button></a>
|
||||
<a hx-get="/main/quit" hx-swap="outerHTML"/><button onclick="closeApp()" class="button is-danger" > 🗙 </button></a>
|
||||
</div>
|
||||
|
||||
</div> <!-- end pywebview-drag-region -->
|
||||
<!-- End Header -->
|
||||
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>
|
||||
27
src/yasi_applets/main/layout.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="/main/static/bulma.css" rel="stylesheet">
|
||||
<link href="/main/static/system-installer.css" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="/main/static/icons/blippie.png" type="image/x-icon">
|
||||
<link rel="stylesheet" href="/main/static/fork-awesome.css">
|
||||
<script src="/main/static/htmx.min.js" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="frame">
|
||||
{% include "header.html" %}
|
||||
|
||||
<div class="applet">
|
||||
{% block body %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
{% include "footer.html" %}
|
||||
|
||||
</div> <!-- class "frame" -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
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/fork-awesome.css
Symbolic link
@@ -0,0 +1 @@
|
||||
/usr/share/fonts-fork-awesome/css/fork-awesome.css
|
||||
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 |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
BIN
src/yasi_applets/main/static/icons/language.png
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 |
|
Before Width: | Height: | Size: 585 B After Width: | Height: | Size: 585 B |
36
src/yasi_applets/main/templates/footer.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<!-- Buttons on the left -->
|
||||
<div style="position: absolute; bottom: 15px; left: 15px;">
|
||||
|
||||
{% if previous_step %}
|
||||
<!-- Why two of these? So that we can use two different keyboard shortcuts for back. -->
|
||||
<button style="display: none;" hx-get="/{{ previous_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[altKey&&key=='b'] from:body"></button>
|
||||
<a href="/{{ previous_step }}"><button hx-get="/{{ previous_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[ctrlKey&&code=='PageUp'] from:body" class="button is-light">Back</button></a>
|
||||
{% endif %}
|
||||
|
||||
{% if bottom_menu %}
|
||||
{{ bottom_menu | safe }}
|
||||
{% endif %}
|
||||
|
||||
</div> <!-- end buttons on the left -->
|
||||
|
||||
|
||||
<!-- Buttons on the right -->
|
||||
<div style="position: absolute; bottom: 15px; right: 15px;">
|
||||
|
||||
{% if next_step %}
|
||||
|
||||
{% if next_step == "install" %}
|
||||
<a href="/{{ next_step }}"><button hx-get="/{{ next_step }}" hx-target="body"
|
||||
hx-trigger="click, keyup[altKey&&key=='i'] from:body" class="button is-link">Install</button></a>
|
||||
{% else %}
|
||||
<!-- Why two of these? So that we can use two different keyboard shortcuts for next. -->
|
||||
<a href="/{{ next_step }}"<button hx-get="/{{ next_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[ctrlKey&&code=='PageDown'] from:body" class=""></button></a>
|
||||
<a href="/{{ next_step }}"<button hx-get="/{{ next_step }}" hx-target="body"
|
||||
hx-trigger="click, keydown[altKey&&key=='n'] from:body" class="button is-link">Next</button></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
</div> <!-- end buttons on the right -->
|
||||
20
src/yasi_applets/main/templates/header.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!-- Header -->
|
||||
<div id="titlebar" style="padding: 15px; margin: -15px; padding-bottom: 30px;">
|
||||
|
||||
<!-- drag region class: -->
|
||||
<div id="titlebar" class="pywebview-drag-region" style="padding: 15px; margin: -15px; padding-bottom: 30px;">
|
||||
|
||||
<a hx-get="/main/menu" hx-swap="outerHTML"/> <button class="button is-link"> ☰ </button </a>
|
||||
|
||||
{% for item in menu_order %}
|
||||
<a href="{{ menu[item][1]}}"> <button class="button is-{% if request.path == menu[item][1] %}info{% else %}dark{% endif %}"> {{ menu[item][0]}} </button></a>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<div style="position: absolute; top: 15px; right: 15px;">
|
||||
<a hx-get="/main/help" hx-swap="outerHTML"/> <button class="button is-light"> <b> ? </b> </button></a>
|
||||
<a hx-get="/main/quit" hx-swap="outerHTML"/><button onclick="closeApp()" class="button is-danger" > 🗙 </button></a>
|
||||
</div>
|
||||
|
||||
</div> <!-- end pywebview-drag-region -->
|
||||
<!-- End Header -->
|
||||
27
src/yasi_applets/main/templates/layout.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="/main/static/bulma.css" rel="stylesheet">
|
||||
<link href="/main/static/system-installer.css" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="/main/static/icons/blippie.png" type="image/x-icon">
|
||||
<link rel="stylesheet" href="/main/static/fork-awesome.css">
|
||||
<script src="/main/static/htmx.min.js" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="frame">
|
||||
{% include "header.html" %}
|
||||
|
||||
<div class="applet">
|
||||
{% block body %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
{% include "footer.html" %}
|
||||
|
||||
</div> <!-- class "frame" -->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from applets.software import bp
|
||||
from yasi_applets.software import bp
|
||||
from flask import Flask, request, session, redirect, \
|
||||
url_for, render_template, flash, Blueprint
|
||||
from flask import current_app
|
||||
@@ -18,6 +18,8 @@ def webui_software():
|
||||
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',
|
||||
@@ -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']) + "<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?")
|
||||
|
||||
|
||||
@@ -4,26 +4,45 @@
|
||||
<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">
|
||||
Popularity Contest
|
||||
</span>
|
||||
|
||||
<div style="padding-left: 15px; padding-right: 15px; background-color: #fff;
|
||||
color: #000;">
|
||||
|
||||
<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>
|
||||
</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">
|
||||
@@ -56,5 +75,6 @@ Select software from Debian archives</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
{% endblock %}
|
||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
@@ -3,5 +3,5 @@ from flask import Blueprint
|
||||
bp = Blueprint('summary', __name__,
|
||||
template_folder='')
|
||||
|
||||
from applets.summary import routes
|
||||
from yasi_applets.summary import routes
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from applets.summary import bp
|
||||
from yasi_applets.summary import bp
|
||||
from flask import Flask, request, session, redirect, \
|
||||
url_for, render_template, flash, Blueprint
|
||||
from flask import current_app
|
||||
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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from applets.software import bp
|
||||
from yasi_applets.software import bp
|
||||
from flask import Flask, request, session, redirect, \
|
||||
url_for, render_template, flash, Blueprint
|
||||
import gettext
|
||||
@@ -33,11 +33,12 @@ def users_root():
|
||||
else:
|
||||
previous_step_url = menu[menu.index("users")-1]
|
||||
|
||||
root_button = ' <button class="button is-light"> <i class="fa fa-user" aria-hidden="true"></i> Setup root user </button>'
|
||||
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]
|
||||
|
||||
@@ -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('<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("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():
|
||||
"""
|
||||
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
|
||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
@@ -7,7 +7,7 @@
|
||||
|
||||
<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;">
|
||||
|
||||
@@ -18,16 +18,22 @@
|
||||
<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 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">
|
||||
<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>
|
||||
@@ -37,7 +43,7 @@
|
||||
<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/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">
|
||||
<i class="fa fa-address-card" aria-hidden="true"></i>
|
||||
</span>
|
||||
@@ -47,10 +53,13 @@
|
||||
<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/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">
|
||||
<i class="fa fa-address-card" aria-hidden="true"></i>
|
||||
</span>
|
||||
<div id="password-status">
|
||||
<p> </p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
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
|
||||