@@ -37,15 +37,17 @@ def __init__(self, message: str, errors: List[Dict[str, Any]]):
3737class InfrahubClient :
3838 """Client for interacting with the Infrahub API using the official SDK."""
3939
40- def __init__ (self , base_url : str , api_token : Optional [str ] = None , timeout : int = 30 ):
40+ def __init__ (self , base_url : str , api_token : Optional [str ] = None , timeout : int = 30 , ui_url : Optional [ str ] = None ):
4141 """Initialize the Infrahub API client.
4242
4343 Args:
4444 base_url: Base URL of the Infrahub instance (e.g., "http://localhost:8000")
4545 api_token: Optional API token for authentication (not currently used by SDK)
4646 timeout: Request timeout in seconds (default: 30)
47+ ui_url: Optional UI URL for generating browser links (defaults to base_url if not provided)
4748 """
4849 self .base_url = base_url .rstrip ("/" )
50+ self .ui_url = (ui_url or base_url ).rstrip ("/" )
4951 self .api_token = api_token
5052 self .timeout = timeout
5153
@@ -588,9 +590,9 @@ def get_proposed_change_url(self, pc_id: str) -> str:
588590 pc_id: Proposed change ID
589591
590592 Returns:
591- URL string for the proposed change
593+ URL string for the proposed change (uses UI URL for browser access)
592594 """
593- return f"{ self .base_url } /proposed-changes/{ pc_id } "
595+ return f"{ self .ui_url } /proposed-changes/{ pc_id } "
594596
595597 def get_location_rows (self , branch : str = "main" ) -> List [Dict [str , Any ]]:
596598 """Fetch LocationRow objects.
0 commit comments