diff --git a/csaxs_bec/bec_ipython_client/plugins/tool_box/tool_box.py b/csaxs_bec/bec_ipython_client/plugins/tool_box/debug_tools.py similarity index 88% rename from csaxs_bec/bec_ipython_client/plugins/tool_box/tool_box.py rename to csaxs_bec/bec_ipython_client/plugins/tool_box/debug_tools.py index fbb7892..648fb73 100644 --- a/csaxs_bec/bec_ipython_client/plugins/tool_box/tool_box.py +++ b/csaxs_bec/bec_ipython_client/plugins/tool_box/debug_tools.py @@ -22,11 +22,14 @@ from slugify import slugify if TYPE_CHECKING: from bec_ipython_client.main import BECClient from bec_lib.scans import Scans + from bec_widgets.cli.client_utils import BECGuiClient scans: Scans # type: ignore[no-redef] bec: BECClient # type: ignore[no-redef] + gui: BECGuiClient # type: ignore[no-redef] + class Detector(BaseModel): """Model representing a detector configuration.""" @@ -239,3 +242,17 @@ class DebugTools: return True except OSError: return False + + def open_it_service_page(self): + """Open the overview of IT services hosted by Science IT (Leo Sala) for cSAXS.""" + try: + dock_area = gui.new() + except Exception as e: + print(f"Could not open new GUI dock area: {e}") + return + print("Opening IT service page in new dock...") + url = "https://metrics.psi.ch/d/saf8mxv/x12sa?orgId=1&from=now-24h&to=now&timezone=browser&var-receiver_hosts=sls-jfjoch-001.psi.ch&var-writer_hosts=xbl-daq-34.psi.ch&var-beamline=X12SA&var-slurm_partitions=csaxs&var-receiver_services=broker&var-writer_services=writer&refresh=15m" + wb = dock_area.new(widget=gui.available_widgets.WebsiteWidget) + wb.set_url( + "https://metrics.psi.ch/d/saf8mxv/x12sa?orgId=1&from=now-24h&to=now&timezone=browser&var-receiver_hosts=sls-jfjoch-001.psi.ch&var-writer_hosts=xbl-daq-34.psi.ch&var-beamline=X12SA&var-slurm_partitions=csaxs&var-receiver_services=broker&var-writer_services=writer&refresh=15m" + ) diff --git a/csaxs_bec/bec_ipython_client/startup/post_startup.py b/csaxs_bec/bec_ipython_client/startup/post_startup.py index a23d73b..5d696e6 100644 --- a/csaxs_bec/bec_ipython_client/startup/post_startup.py +++ b/csaxs_bec/bec_ipython_client/startup/post_startup.py @@ -48,6 +48,11 @@ elif _args.session.lower() == "csaxs": logger.success("cSAXS session loaded.") +from csaxs_bec.bec_ipython_client.plugins.tool_box.debug_tools import DebugTools + +debug = DebugTools() +logger.success("Debug tools loaded. Use 'debug' to access them.") + # SETUP BEAMLINE INFO from bec_ipython_client.plugins.SLS.sls_info import OperatorInfo, SLSInfo