Add disconnect command and fix GUI connection status refresh

- Add `cmdforge config disconnect` command to clear registry token
- Fix GUI connection status label not updating after connect
  - Store status as instance variable instead of local
  - Add _update_connection_status() method
  - Call update after connect dialog completes

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
rob
2026-01-16 06:55:30 -04:00
co-authored by Claude Opus 4.5
parent 5e01a335c0
commit 0216d1d77a
3 changed files with 36 additions and 8 deletions
+14 -8
View File
@@ -83,14 +83,9 @@ class ToolsPage(QWidget):
header_layout.addStretch()
# Connection status
config = load_config()
if config.registry.token:
status = QLabel("Connected to Registry")
status.setStyleSheet("color: #38a169; font-weight: 500;")
else:
status = QLabel("Not connected")
status.setStyleSheet("color: #718096;")
header_layout.addWidget(status)
self.connection_status = QLabel()
self._update_connection_status()
header_layout.addWidget(self.connection_status)
layout.addWidget(header)
@@ -174,6 +169,16 @@ class ToolsPage(QWidget):
layout.addWidget(buttons)
def _update_connection_status(self):
"""Update the connection status label."""
config = load_config()
if config.registry.token:
self.connection_status.setText("Connected to Registry")
self.connection_status.setStyleSheet("color: #38a169; font-weight: 500;")
else:
self.connection_status.setText("Not connected")
self.connection_status.setStyleSheet("color: #718096;")
def refresh(self):
"""Refresh the tool list."""
self.tool_tree.clear()
@@ -392,6 +397,7 @@ class ToolsPage(QWidget):
dialog = ConnectDialog(self)
if dialog.exec():
self.refresh()
self._update_connection_status()
self.main_window.show_status("Connected to registry")
# Recreate publish button
self.btn_publish.setText("Publish")