Skip to content

Commit 680e2ca

Browse files
committed
fixes
1 parent d366cd4 commit 680e2ca

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

docker-compose.override.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ services:
1111

1212
# Mount local repository for local development
1313
# Used when INFRAHUB_GIT_LOCAL=true to work with local generator/transform changes
14-
infrahub-git:
15-
volumes:
16-
- ./:/upstream
17-
1814
task-worker:
1915
volumes:
2016
- ./:/upstream

service_catalog/Home.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def main() -> None:
4646
# Initialize API client
4747
client = InfrahubClient(
4848
st.session_state.infrahub_url,
49-
api_token=INFRAHUB_API_TOKEN or None
49+
api_token=INFRAHUB_API_TOKEN or None,
50+
ui_url=INFRAHUB_UI_URL
5051
)
5152

5253
# Page title

service_catalog/pages/1_Create_DC.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
GENERATOR_WAIT_TIME,
1515
INFRAHUB_ADDRESS,
1616
INFRAHUB_API_TOKEN,
17+
INFRAHUB_UI_URL,
1718
InfrahubClient,
1819
display_error,
1920
display_logo,
@@ -445,7 +446,8 @@ def main() -> None:
445446
# Initialize API client to fetch locations
446447
client = InfrahubClient(
447448
st.session_state.infrahub_url,
448-
api_token=INFRAHUB_API_TOKEN or None
449+
api_token=INFRAHUB_API_TOKEN or None,
450+
ui_url=INFRAHUB_UI_URL
449451
)
450452

451453
# Fetch locations (cache in session state)

service_catalog/pages/2_Rack_Visualization.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ def main() -> None:
247247

248248
# Initialize API client
249249
client = InfrahubClient(
250-
st.session_state.infrahub_url, api_token=INFRAHUB_API_TOKEN or None
250+
st.session_state.infrahub_url,
251+
api_token=INFRAHUB_API_TOKEN or None,
252+
ui_url=INFRAHUB_UI_URL
251253
)
252254

253255
# Page title

service_catalog/pages/3_VLAN_Management.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,9 @@ def main() -> None:
433433

434434
# Initialize API client (always use "main" branch)
435435
client = InfrahubClient(
436-
st.session_state.infrahub_url, api_token=INFRAHUB_API_TOKEN or None
436+
st.session_state.infrahub_url,
437+
api_token=INFRAHUB_API_TOKEN or None,
438+
ui_url=INFRAHUB_UI_URL
437439
)
438440

439441
# Page title

service_catalog/utils/api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@ def __init__(self, message: str, errors: List[Dict[str, Any]]):
3737
class 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

Comments
 (0)