@@ -241,11 +241,23 @@ def platform_title(self) -> str:
241241 return working_platform .platform .safe_platform ['config' ]['instance_name' ]
242242
243243 # === vars for platform details ===
244+ @rx .var
245+ def password_field (self ) -> str :
246+ if self .current_uid == "" :
247+ return ""
248+ working_platform : Instance | None = self .platforms .get (self .current_uid , None )
249+ if working_platform is None :
250+ return ""
251+ return working_platform .password
252+
244253 @rx .var
245254 def platform_deployed (self ) -> bool :
246255 if self .current_uid == "" :
247256 return False
248- return False
257+ working_platform : Instance | None = self .platforms .get (self .current_uid , None )
258+ if working_platform is None :
259+ return ""
260+ return working_platform .deployed
249261
250262 # === end of platform detail vars ===
251263
@@ -368,7 +380,12 @@ def instance_uncaught(self) -> bool:
368380
369381 @rx .var
370382 def instance_deployable (self ) -> bool :
371- return True
383+ if self .current_uid == "" :
384+ return False
385+ working_platform : Instance | None = self .platforms .get (self .current_uid , None )
386+ if working_platform is None :
387+ return False
388+ return self .check_instance_deployable (working_platform )
372389 # === end of instance validation bars ===
373390
374391 # Events
@@ -545,6 +562,11 @@ def toggle_federation(self):
545562 working_platform : Instance = self .platforms [self .current_uid ]
546563 working_platform .federation_checked = not working_platform .federation_checked
547564
565+ @rx .event
566+ def update_password_field (self , value : str ):
567+ working_platform_instance = self .platforms [self .current_uid ]
568+ working_platform_instance .password = value
569+
548570 @rx .event
549571 def update_detail (self , field : str , value ):
550572 working_platform_instance = self .platforms [self .current_uid ]
@@ -565,13 +587,15 @@ def update_platform_config_detail(self, field: str, value: str):
565587 @rx .event
566588 async def handle_deploy (self ):
567589 working_platform : Instance = self .platforms [self .current_uid ]
568-
569- if working_platform .uncaught != False and working_platform .valid :
570- working_platform .safe_host_entry = working_platform .host .to_dict ()
571- working_platform .uncaught = False
572- await deploy_platform (working_platform .platform .config .instance_name )
590+ try :
591+ response = await deploy_platform (working_platform .platform .config .instance_name , working_platform .password )
592+ working_platform .deployed = True
593+ logger .debug (f"response: { response .json ()} " )
573594 yield rx .toast .success ("Deployed Successfully!" )
574-
595+ except Exception as e :
596+ logger .debug (f"there was an error deploying platform { working_platform .platform .config .instance_name } . e: { e } " )
597+ yield rx .toast .error (f"There was an error deploying platform: { working_platform .platform .config .instance_name } " )
598+
575599 @rx .event
576600 async def handle_save (self ):
577601 working_platform : Instance = self .platforms [self .current_uid ]
@@ -730,6 +754,9 @@ def check_instance_savable(self, working_platform: Instance) -> bool:
730754
731755 return savable
732756
757+ def check_instance_deployable (self , working_platform : Instance ) -> bool :
758+ return True if self .check_instance_uncaught (working_platform ) == False and working_platform .new_instance == False else False
759+
733760 def connection_validity (self , working_platform : Instance ) -> tuple [bool , dict [str , bool ]]:
734761 valid = True
735762 validity_map : dict [str , bool ] = {
0 commit comments