3 Commits

Author SHA1 Message Date
Natan Keddem dfcafed973 refactor startup builders 2023-11-16 19:34:52 -05:00
Natan Keddem 566fb9442c added arbitrary target path selection 2023-11-16 19:05:53 -05:00
Natan Keddem 3b13ca89bd update to nicegui 1.4.2 2023-11-15 18:38:14 -05:00
5 changed files with 20 additions and 20 deletions
+3 -6
View File
@@ -1,3 +1,4 @@
import asyncio
from nicegui import ui
from bale import elements as el
import bale.logo as logo
@@ -26,7 +27,7 @@ class Content:
self._automation = None
self._history = None
def build(self):
async def build(self):
self._header = ui.header(bordered=True).classes("bg-dark q-pt-sm q-pb-xs")
self._header.tailwind.border_color(f"[{el.orange}]").min_width("[920px]")
self._header.visible = False
@@ -44,11 +45,7 @@ class Content:
self._tab_panels = (
ui.tab_panels(self._tabs, value="Manage", on_change=lambda e: self._tab_changed(e), animated=False).classes("w-full h-full").bind_visibility_from(self._header)
)
ui.timer(1, self.select_default, once=True)
async def select_default(self):
tab = Tab(spinner=None)
default = tab.common.get("default", "")
default = Tab(spinner=None).common.get("default", "")
if default != "":
await self.host_selected(default)
+10 -8
View File
@@ -162,16 +162,17 @@ class FInput(ui.input):
class DSelect(ui.select):
def __init__(
self,
options: List | Dict,
options: Union[List, Dict],
*,
label: str | None = None,
label: Optional[str] = None,
value: Any = None,
on_change: Callable[..., Any] | None = None,
on_change: Optional[Callable[..., Any]] = None,
with_input: bool = False,
new_value_mode: Optional[Literal["add", "add-unique", "toggle"]] = None,
multiple: bool = False,
clearable: bool = False,
) -> None:
super().__init__(options, label=label, value=value, on_change=on_change, with_input=with_input, multiple=multiple, clearable=clearable)
super().__init__(options, label=label, value=value, on_change=on_change, with_input=with_input, new_value_mode=new_value_mode, multiple=multiple, clearable=clearable)
self.tailwind.width("full")
if multiple is True:
self.props("use-chips")
@@ -180,16 +181,17 @@ class DSelect(ui.select):
class FSelect(ui.select):
def __init__(
self,
options: List | Dict,
options: Union[List, Dict],
*,
label: str | None = None,
label: Optional[str] = None,
value: Any = None,
on_change: Callable[..., Any] | None = None,
on_change: Optional[Callable[..., Any]] = None,
with_input: bool = False,
new_value_mode: Optional[Literal["add", "add-unique", "toggle"]] = None,
multiple: bool = False,
clearable: bool = False,
) -> None:
super().__init__(options, label=label, value=value, on_change=on_change, with_input=with_input, multiple=multiple, clearable=clearable)
super().__init__(options, label=label, value=value, on_change=on_change, with_input=with_input, new_value_mode=new_value_mode, multiple=multiple, clearable=clearable)
self.tailwind.width("64")
+4 -3
View File
@@ -1,4 +1,5 @@
from nicegui import app, ui
import asyncio
from nicegui import app, Client, ui
from bale import elements as el
from bale.drawer import Drawer
from bale.content import Content
@@ -10,7 +11,7 @@ logger = logging.getLogger(__name__)
def build():
@ui.page("/")
def page() -> None:
async def index(client: Client) -> None:
app.add_static_files("/static", "static")
el.load_element_css()
cli.load_terminal_css()
@@ -28,4 +29,4 @@ def build():
content = Content()
drawer = Drawer(column, content.host_selected, content.hide)
drawer.build()
content.build()
await content.build()
+2 -2
View File
@@ -491,10 +491,10 @@ class Automation(Tab):
row.tailwind.width("[860px]").justify_content("center")
with ui.column() as col:
col.tailwind.height("full").width("[420px]")
self.hosts = el.DSelect(source_hosts, label="Source Host(s)", multiple=True, with_input=True)
self.target_host = el.DSelect(target_host, label="Target Host", on_change=target_host_selected)
self.target_paths = [""]
self.target_path = el.DSelect(self.target_paths, value="", label="Target Path", on_change=target_path_selected)
self.target_path = el.DSelect(self.target_paths, value="", label="Target Path", new_value_mode="add-unique", on_change=target_path_selected)
self.hosts = el.DSelect(source_hosts, label="Source Host(s)", multiple=True, with_input=True)
all_fs_to_lists()
with ui.scroll_area().classes("col"):
self.parentchildren = el.DSelect(
+1 -1
View File
@@ -2,7 +2,7 @@ APScheduler==3.10.4
SQLAlchemy==2.0.22
cron-descriptor==1.4.0
cron-validator==1.0.8
nicegui==1.4.1
nicegui==1.4.2
zfs-autobackup==3.2
netifaces==0.11.0
asyncssh==2.14.0