diff --git a/pyproject.toml b/pyproject.toml index aa5c1ff..1642762 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath-dev" -version = "0.0.18" +version = "0.0.19" description = "UiPath Developer Console" readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" diff --git a/src/uipath/dev/ui/panels/new_run_panel.py b/src/uipath/dev/ui/panels/new_run_panel.py index 07cd53b..cea7425 100644 --- a/src/uipath/dev/ui/panels/new_run_panel.py +++ b/src/uipath/dev/ui/panels/new_run_panel.py @@ -3,10 +3,11 @@ import json from typing import Any, Tuple, cast +from rich.text import Text from textual.app import ComposeResult from textual.containers import Container, Horizontal, Vertical from textual.reactive import reactive -from textual.widgets import Button, Select, TabbedContent, TabPane +from textual.widgets import Button, Select, Static, TabbedContent, TabPane from uipath.runtime import UiPathRuntimeFactoryProtocol, UiPathRuntimeProtocol from uipath.dev.ui.widgets.json_input import JsonInput @@ -46,6 +47,12 @@ def compose(self) -> ComposeResult: allow_blank=True, ) + yield Static( + "", + id="error-message", + classes="error-message hidden", + ) + yield JsonInput( text=self.initial_input, language="json", @@ -112,6 +119,13 @@ async def on_mount(self) -> None: async def _load_schema_and_update_input(self, entrypoint: str) -> None: """Ensure schema for entrypoint is loaded, then update JSON input.""" json_input = self.query_one("#json-input", JsonInput) + error_message = self.query_one("#error-message", Static) + select = self.query_one("#entrypoint-select", Select) + + # Hide error, show input by default + error_message.add_class("hidden") + json_input.remove_class("hidden") + select.remove_class("hidden") if not entrypoint or entrypoint == "no-entrypoints": json_input.text = "{}" @@ -131,12 +145,12 @@ async def _load_schema_and_update_input(self, entrypoint: str) -> None: self.entrypoint_schemas[entrypoint] = input_schema schema = input_schema except Exception as e: - json_input.text = "{}" - self.app.notify( - f"Error loading schema for '{entrypoint}': {str(e)}", - severity="error", - timeout=5, + json_input.add_class("hidden") + select.add_class("hidden") + error_message.update( + Text(f"Error loading schema for '{entrypoint}':\n\n{str(e)}") ) + error_message.remove_class("hidden") return finally: if runtime is not None: diff --git a/src/uipath/dev/ui/styles/terminal.tcss b/src/uipath/dev/ui/styles/terminal.tcss index 3e51879..669d751 100644 --- a/src/uipath/dev/ui/styles/terminal.tcss +++ b/src/uipath/dev/ui/styles/terminal.tcss @@ -129,6 +129,16 @@ Screen { border: solid #ff4444; } +.error-message { + color: $error; + background: $surface; + padding: 1 2; + border: solid $error; + height: auto; + max-height: 50%; + overflow-y: auto; +} + .hidden { display: none; } diff --git a/uv.lock b/uv.lock index 5a95b11..96f8873 100644 --- a/uv.lock +++ b/uv.lock @@ -1006,7 +1006,7 @@ wheels = [ [[package]] name = "uipath-dev" -version = "0.0.18" +version = "0.0.19" source = { editable = "." } dependencies = [ { name = "pyperclip" },