Add README and commit previous changes

This commit is contained in:
Jonathan Carter
2024-06-21 18:58:20 +02:00
parent 12e943f65c
commit fff1f8987a
9 changed files with 52 additions and 7 deletions

4
README.md Normal file
View File

@@ -0,0 +1,4 @@
Dependencies
- flask
- pytest
- coverage

View File

View File

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

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,33 @@
from applets.webui import bp
@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="https://unpkg.com/htmx.org@1.9.11" integrity="sha384-0gxUXCCR8yv9FM2b+U3FDbsKthCI66oH5IA9fHppQq9DDMHuMauqq1ZHBpJxQ0J0" 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
""")

View File

@@ -1,7 +1,7 @@
from applets.welcome import bp from applets.welcome import bp
@bp.route('/welcome') @bp.route('/welcome',methods=['GET', 'POST', 'PUT'])
def welcome_index(): def welcome_index():
""" """
The page you'd get if you access the root of The page you'd get if you access the root of
@@ -11,6 +11,12 @@ def welcome_index():
"This is the Welcome Index") "This is the Welcome Index")
@bp.route('/welcome2')
def welcome2_index():
return ("Changins some text in our htmx front-end")
@bp.route('/api/') @bp.route('/api/')
def api_home(): def api_home():
""" """

View File

@@ -16,7 +16,6 @@ SECRET_KEY = "exampls"
DEV_MODE = 1 DEV_MODE = 1
APPS = "main welcome" APPS = "main welcome"
if DEV_MODE == 1: if DEV_MODE == 1:
print("Note: Starting in devmode!") print("Note: Starting in devmode!")
DEBUG = True DEBUG = True
@@ -34,11 +33,8 @@ from applets.main import bp as main_bp
app.register_blueprint(main_bp) app.register_blueprint(main_bp)
from applets.welcome import bp as welcome_bp from applets.welcome import bp as welcome_bp
app.register_blueprint(welcome_bp) app.register_blueprint(welcome_bp)
from applets.webui import bp as webui_bp
app.register_blueprint(webui_bp)
@app.errorhandler(404)
def not_found(error):
return '404 Not Found', 404
# configure logs # configure logs