feat(worker-ui): adjust thumbnails, log view, and button logic to match web dashboard
Ampel / ampel (push) Failing after 40s
Ampel / ampel (push) Failing after 40s
This commit is contained in:
+37
-26
@@ -364,7 +364,7 @@ def main(page: ft.Page):
|
|||||||
r"^\[.*? (\d{2}:\d{2}:\d{2}),.*?: (INFO|WARNING|ERROR|SUCCESS).*?\] (.*)"
|
r"^\[.*? (\d{2}:\d{2}:\d{2}),.*?: (INFO|WARNING|ERROR|SUCCESS).*?\] (.*)"
|
||||||
)
|
)
|
||||||
|
|
||||||
log_view = ft.ListView(expand=1, spacing=2, auto_scroll=True)
|
log_view = ft.ListView(expand=1, spacing=0, auto_scroll=True)
|
||||||
queue_view = ft.ListView(height=120, spacing=4, auto_scroll=False)
|
queue_view = ft.ListView(height=120, spacing=4, auto_scroll=False)
|
||||||
|
|
||||||
def add_log(zeile):
|
def add_log(zeile):
|
||||||
@@ -395,8 +395,7 @@ def main(page: ft.Page):
|
|||||||
font_family="Consolas",
|
font_family="Consolas",
|
||||||
weight=ft.FontWeight.BOLD,
|
weight=ft.FontWeight.BOLD,
|
||||||
),
|
),
|
||||||
ft.Text(
|
msg, color=c_text, size=12, font_family="Consolas", expand=True, selectable=True
|
||||||
msg, color=c_text, size=12, font_family="Consolas", expand=True
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
spacing=10,
|
spacing=10,
|
||||||
@@ -405,7 +404,7 @@ def main(page: ft.Page):
|
|||||||
log_view.controls.append(row)
|
log_view.controls.append(row)
|
||||||
else:
|
else:
|
||||||
log_view.controls.append(
|
log_view.controls.append(
|
||||||
ft.Text(z, color=c_muted, size=12, font_family="Consolas")
|
ft.Text(z, color=c_muted, size=12, font_family="Consolas", selectable=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(log_view.controls) > 200:
|
if len(log_view.controls) > 200:
|
||||||
@@ -418,10 +417,7 @@ def main(page: ft.Page):
|
|||||||
def toggle_worker(e):
|
def toggle_worker(e):
|
||||||
if not worker_laeuft():
|
if not worker_laeuft():
|
||||||
worker_starten(add_log)
|
worker_starten(add_log)
|
||||||
btn_toggle.text = "Worker läuft"
|
btn_toggle.visible = False
|
||||||
btn_toggle.icon = ft.icons.CHECK
|
|
||||||
btn_toggle.bgcolor = "#1e293b"
|
|
||||||
btn_toggle.disabled = True
|
|
||||||
page.update()
|
page.update()
|
||||||
|
|
||||||
btn_toggle = ft.ElevatedButton(
|
btn_toggle = ft.ElevatedButton(
|
||||||
@@ -506,11 +502,18 @@ def main(page: ft.Page):
|
|||||||
active_poster = ft.Image(
|
active_poster = ft.Image(
|
||||||
src="",
|
src="",
|
||||||
visible=False,
|
visible=False,
|
||||||
width=64,
|
width=72,
|
||||||
height=96,
|
height=108,
|
||||||
border_radius=8,
|
border_radius=10,
|
||||||
fit=ft.ImageFit.COVER,
|
fit=ft.ImageFit.COVER,
|
||||||
)
|
)
|
||||||
|
active_poster_container = ft.Container(
|
||||||
|
content=active_poster,
|
||||||
|
border=ft.border.all(1, c_warning),
|
||||||
|
border_radius=10,
|
||||||
|
shadow=ft.BoxShadow(spread_radius=1, blur_radius=5, color=ft.colors.with_opacity(0.3, ft.colors.BLACK)),
|
||||||
|
visible=False
|
||||||
|
)
|
||||||
|
|
||||||
dashboard_card = ft.Container(
|
dashboard_card = ft.Container(
|
||||||
content=ft.Column(
|
content=ft.Column(
|
||||||
@@ -520,7 +523,7 @@ def main(page: ft.Page):
|
|||||||
ft.Container(height=5),
|
ft.Container(height=5),
|
||||||
ft.Row(
|
ft.Row(
|
||||||
[
|
[
|
||||||
active_poster,
|
active_poster_container,
|
||||||
progress_stack,
|
progress_stack,
|
||||||
ft.Column(
|
ft.Column(
|
||||||
[job_title, eta_text],
|
[job_title, eta_text],
|
||||||
@@ -632,12 +635,17 @@ def main(page: ft.Page):
|
|||||||
row_items = []
|
row_items = []
|
||||||
if poster:
|
if poster:
|
||||||
row_items.append(
|
row_items.append(
|
||||||
ft.Image(
|
ft.Container(
|
||||||
|
content=ft.Image(
|
||||||
src=poster,
|
src=poster,
|
||||||
width=40,
|
width=32,
|
||||||
height=60,
|
height=48,
|
||||||
border_radius=5,
|
border_radius=6,
|
||||||
fit=ft.ImageFit.COVER,
|
fit=ft.ImageFit.COVER,
|
||||||
|
),
|
||||||
|
border=ft.border.all(1, "#334155"),
|
||||||
|
border_radius=6,
|
||||||
|
shadow=ft.BoxShadow(spread_radius=1, blur_radius=3, color=ft.colors.with_opacity(0.3, ft.colors.BLACK))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
row_items.append(
|
row_items.append(
|
||||||
@@ -665,7 +673,8 @@ def main(page: ft.Page):
|
|||||||
progress_percentage.value = "0%"
|
progress_percentage.value = "0%"
|
||||||
job_title.value = "Nichts in Arbeit"
|
job_title.value = "Nichts in Arbeit"
|
||||||
eta_text.value = "Bereit"
|
eta_text.value = "Bereit"
|
||||||
active_poster.visible = False
|
active_poster_container.visible = False
|
||||||
|
btn_toggle.visible = True
|
||||||
btn_toggle.disabled = False
|
btn_toggle.disabled = False
|
||||||
btn_toggle.text = "Worker Starten"
|
btn_toggle.text = "Worker Starten"
|
||||||
btn_toggle.icon = ft.icons.PLAY_ARROW
|
btn_toggle.icon = ft.icons.PLAY_ARROW
|
||||||
@@ -675,7 +684,11 @@ def main(page: ft.Page):
|
|||||||
status_text.color = c_warning
|
status_text.color = c_warning
|
||||||
progress_ring.value = 0
|
progress_ring.value = 0
|
||||||
progress_percentage.value = "0%"
|
progress_percentage.value = "0%"
|
||||||
active_poster.visible = False
|
active_poster_container.visible = False
|
||||||
|
btn_toggle.visible = True
|
||||||
|
btn_toggle.disabled = True
|
||||||
|
btn_toggle.text = "Warte auf Verbindung..."
|
||||||
|
btn_toggle.bgcolor = "#1e293b"
|
||||||
elif job:
|
elif job:
|
||||||
status_text.value = "Aktiv: Komprimiert"
|
status_text.value = "Aktiv: Komprimiert"
|
||||||
status_text.color = c_success
|
status_text.color = c_success
|
||||||
@@ -699,9 +712,11 @@ def main(page: ft.Page):
|
|||||||
|
|
||||||
if poster:
|
if poster:
|
||||||
active_poster.src = poster
|
active_poster.src = poster
|
||||||
active_poster.visible = True
|
active_poster_container.visible = True
|
||||||
else:
|
else:
|
||||||
active_poster.visible = False
|
active_poster_container.visible = False
|
||||||
|
|
||||||
|
btn_toggle.visible = False
|
||||||
else:
|
else:
|
||||||
status_text.value = "Verbunden & Bereit"
|
status_text.value = "Verbunden & Bereit"
|
||||||
status_text.color = c_accent
|
status_text.color = c_accent
|
||||||
@@ -709,12 +724,8 @@ def main(page: ft.Page):
|
|||||||
progress_percentage.value = "0%"
|
progress_percentage.value = "0%"
|
||||||
job_title.value = "Warte auf Encoder-Aufträge..."
|
job_title.value = "Warte auf Encoder-Aufträge..."
|
||||||
eta_text.value = "Nichts in Arbeit"
|
eta_text.value = "Nichts in Arbeit"
|
||||||
active_poster.visible = False
|
active_poster_container.visible = False
|
||||||
|
btn_toggle.visible = False
|
||||||
btn_toggle.disabled = True
|
|
||||||
btn_toggle.text = "Worker läuft"
|
|
||||||
btn_toggle.icon = ft.icons.CHECK
|
|
||||||
btn_toggle.bgcolor = "#1e293b"
|
|
||||||
|
|
||||||
page.update()
|
page.update()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user