fix: rename recover beamline to force maintenance
CI / lint (push) Skipped
CI / test (3.11) (push) Skipped
CI / test (3.12) (push) Skipped
CI / test (3.13) (push) Skipped
CI / test-with-beamline-plugins (pxi_bec) (push) Skipped
CI / test-with-beamline-plugins (pxii_bec) (push) Skipped
CI / test-with-beamline-plugins (pxiii_bec) (push) Skipped
CI / lint (pull_request) Successful in 1m21s
CI / test (3.13) (pull_request) Successful in 1m18s
CI / test (3.12) (pull_request) Successful in 1m28s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 2m11s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 2m20s
CI / test (3.11) (pull_request) Successful in 3m13s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 3m4s
CI / test-with-coverage (pull_request) Successful in 4m16s
CI / coverage-analysis (pull_request) Failing after 5s

This commit is contained in:
2026-08-12 15:36:01 +02:00
parent 362880ec82
commit 63ea060fb9
3 changed files with 15 additions and 15 deletions
+3 -3
View File
@@ -1508,8 +1508,8 @@ async def force_clear_busy(
return "OK"
@app.post("/recovery/recover_beamline")
async def recover_beamline(
@app.post("/recovery/force_maintenance_state")
async def force_maintenance_state(
payload: RecoveryActionRequest, token: str = Depends(oauth2_scheme)
) -> dict:
"""
@@ -1535,7 +1535,7 @@ async def recover_beamline(
cfg.state = BeamlineStateEnum.Maintenance
logger.warning(
"Beamline recovery action executed.",
"Beamline recovery action executed - forced maintenance state.",
extra={
"session": getattr(data, "session", None),
"previous_state": getattr(prev_state, "name", str(prev_state)),
@@ -119,8 +119,8 @@ class RecoveryPanel(QWidget):
self._force_clear_busy_btn.clicked.connect(self._force_clear_busy)
layout.addWidget(self._force_clear_busy_btn)
self._recover_beamline_btn = QPushButton("Recover beamline", self)
self._recover_beamline_btn.setStyleSheet(
self._force_maintenance_state_btn = QPushButton("Force to maintenance state", self)
self._force_maintenance_state_btn.setStyleSheet(
card_style(
CHIP_BAD_BG,
BAD_CARD_BORDER,
@@ -130,8 +130,8 @@ class RecoveryPanel(QWidget):
extra="padding: 10px; font-weight: 700;",
)
)
self._recover_beamline_btn.clicked.connect(self._recover_beamline)
layout.addWidget(self._recover_beamline_btn)
self._force_maintenance_state_btn.clicked.connect(self._force_maintenance_state)
layout.addWidget(self._force_maintenance_state_btn)
self._recovery_unmount_btn = QPushButton("Unmount sample (recovery)", self)
self._recovery_unmount_btn.setStyleSheet(
@@ -251,10 +251,10 @@ class RecoveryPanel(QWidget):
self._daq.force_clear_busy(code)
@Slot()
def _recover_beamline(self) -> None:
def _force_maintenance_state(self) -> None:
if self._sample_appears_mounted():
if not self._confirm(
"Recover beamline",
"Force maintenance mode",
"A sample appears to be mounted.\n\n"
"Recovering the beamline may damage the sample or leave hardware in an unsafe state.\n\n"
"Only continue if you are sure this is the correct recovery action.",
@@ -262,17 +262,17 @@ class RecoveryPanel(QWidget):
return
else:
if not self._confirm(
"Recover beamline",
"Force maintenance mode",
"This will take over the beamline, clear the busy flag, and set the state to Maintenance.\n\n"
"Do you want to continue?",
):
return
code = self._prompt_recovery_code("Recover beamline")
code = self._prompt_recovery_code("Force maintenance mode")
if not code:
return
self._last_action.setText("Last action: Recovering beamline to Maintenance...")
self._daq.recover_beamline(code)
self._daq.force_maintenance_state(code)
@Slot()
def _recovery_unmount_sample(self) -> None:
+3 -3
View File
@@ -902,12 +902,12 @@ class DAQWorker(QObject):
)
@Slot(str)
def recover_beamline(self, confirmation_code: str):
def force_maintenance_state(self, confirmation_code: str):
if self._base_url is None:
logger.info("POST /recovery/recover_beamline")
logger.info("POST /recovery/force_maintenance_state")
return
request = QNetworkRequest(QUrl(f"{self._base_url}/recovery/recover_beamline"))
request = QNetworkRequest(QUrl(f"{self._base_url}/recovery/force_maintenance_state"))
request.setRawHeader(b"Authorization", f"Bearer {self._token}".encode())
request.setRawHeader(b"Content-Type", b"application/json")
body = json.dumps({"confirmation_code": confirmation_code})