33import json
44from typing import Any , Tuple , cast
55
6+ from rich .text import Text
67from textual .app import ComposeResult
78from textual .containers import Container , Horizontal , Vertical
89from textual .reactive import reactive
9- from textual .widgets import Button , Select , TabbedContent , TabPane
10+ from textual .widgets import Button , Select , Static , TabbedContent , TabPane
1011from uipath .runtime import UiPathRuntimeFactoryProtocol , UiPathRuntimeProtocol
1112
1213from uipath .dev .ui .widgets .json_input import JsonInput
@@ -46,6 +47,12 @@ def compose(self) -> ComposeResult:
4647 allow_blank = True ,
4748 )
4849
50+ yield Static (
51+ "" ,
52+ id = "error-message" ,
53+ classes = "error-message hidden" ,
54+ )
55+
4956 yield JsonInput (
5057 text = self .initial_input ,
5158 language = "json" ,
@@ -112,6 +119,13 @@ async def on_mount(self) -> None:
112119 async def _load_schema_and_update_input (self , entrypoint : str ) -> None :
113120 """Ensure schema for entrypoint is loaded, then update JSON input."""
114121 json_input = self .query_one ("#json-input" , JsonInput )
122+ error_message = self .query_one ("#error-message" , Static )
123+ select = self .query_one ("#entrypoint-select" , Select )
124+
125+ # Hide error, show input by default
126+ error_message .add_class ("hidden" )
127+ json_input .remove_class ("hidden" )
128+ select .remove_class ("hidden" )
115129
116130 if not entrypoint or entrypoint == "no-entrypoints" :
117131 json_input .text = "{}"
@@ -131,12 +145,12 @@ async def _load_schema_and_update_input(self, entrypoint: str) -> None:
131145 self .entrypoint_schemas [entrypoint ] = input_schema
132146 schema = input_schema
133147 except Exception as e :
134- json_input .text = "{}"
135- self .app .notify (
136- f"Error loading schema for '{ entrypoint } ': { str (e )} " ,
137- severity = "error" ,
138- timeout = 5 ,
148+ json_input .add_class ("hidden" )
149+ select .add_class ("hidden" )
150+ error_message .update (
151+ Text (f"Error loading schema for '{ entrypoint } ':\n \n { str (e )} " )
139152 )
153+ error_message .remove_class ("hidden" )
140154 return
141155 finally :
142156 if runtime is not None :
0 commit comments