mirror of
https://github.com/natankeddem/bale.git
synced 2026-05-03 06:02:54 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dfcafed973 | |||
| 566fb9442c |
+3
-6
@@ -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
@@ -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
@@ -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()
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user