-
Notifications
You must be signed in to change notification settings - Fork 0
/
frontend.py
49 lines (40 loc) · 1.86 KB
/
frontend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from fastapi import FastAPI
from nicegui import ui
from hive_cli.config import load_settings
from hive_cli import __version__
row = ui.row()
HEADER_STYLE = "text-lg"
def setup_ui(app: FastAPI | None = None):
settings = load_settings()
with ui.header(elevated=True).style('background-color: #3874c8').classes('items-center justify-between'):
ui.label("CareDevOps")
with ui.row().classes("flex w-4/6 mx-auto"):
with ui.column().classes("grow"):
ui.label("Status").tailwind(HEADER_STYLE)
if settings.log_path:
# TODO: #1 Improve styling of log output @aleneum
ui.label("Log").tailwind(HEADER_STYLE)
with ui.scroll_area().classes("grow"):
with open(settings.log_path) as f:
for line in f.readlines():
ui.label(line)
with ui.column().classes("flex"):
ui.label("Einstellungen").tailwind(HEADER_STYLE)
with ui.grid(columns="auto 1fr").classes('items-center'):
ui.label("UUID:").style('text-align: right;')
ui.label(settings.hive_uuid)
ui.label("Update interval:").style('text-align: right;')
ui.number(value=settings.update_interval,
min=10, max=44_640, step=10,
precision=0,
on_change=lambda e: print(f'Number changed to {e.value}'))
ui.label("CLI Version:").style('text-align: right;')
ui.label(__version__)
ui.label("Recipe Version:").style('text-align: right;')
ui.label(settings.version)
with ui.row().classes("justify-end grow w-full"):
ui.button("Save").on_click(lambda: print("Save clicked"))
if app:
ui.run_with(app)
else:
ui.run()