Save registry_hash after publish for state tracking
- Add config_hash to publish API response - Save registry_hash to local tool config after successful publish - Show appropriate message based on moderation status (approved vs pending) This enables the GUI to show publish state indicators (✓ published, ● modified) for tools that have been published to the registry. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
96f7c05744
commit
4b1f3cee52
|
|
@ -177,15 +177,31 @@ class PublishDialog(QDialog):
|
|||
|
||||
def _on_success(self, result: dict):
|
||||
"""Handle publish success."""
|
||||
import yaml
|
||||
|
||||
self.progress.hide()
|
||||
self.status_label.setText("Published successfully!")
|
||||
self.status_label.setStyleSheet("color: #38a169; font-weight: 600;")
|
||||
|
||||
QMessageBox.information(
|
||||
self, "Success",
|
||||
f"Tool '{self._tool.name}' has been published.\n\n"
|
||||
f"It will be available after review."
|
||||
)
|
||||
# Save registry_hash to local config for publish state tracking
|
||||
config_hash = result.get("config_hash")
|
||||
if config_hash and hasattr(self._tool, 'path') and self._tool.path:
|
||||
try:
|
||||
config_path = self._tool.path
|
||||
if config_path.exists():
|
||||
config_data = yaml.safe_load(config_path.read_text()) or {}
|
||||
config_data["registry_hash"] = config_hash
|
||||
config_path.write_text(yaml.dump(config_data, default_flow_style=False, sort_keys=False))
|
||||
except Exception:
|
||||
pass # Non-critical - just won't show publish state
|
||||
|
||||
status = result.get("status", "pending")
|
||||
if status == "approved":
|
||||
msg = f"Tool '{self._tool.name}' has been published and is now live!"
|
||||
else:
|
||||
msg = f"Tool '{self._tool.name}' has been published.\n\nIt will be available after review."
|
||||
|
||||
QMessageBox.information(self, "Success", msg)
|
||||
self.accept()
|
||||
|
||||
def _on_error(self, error: str):
|
||||
|
|
|
|||
|
|
@ -1862,6 +1862,7 @@ def create_app() -> Flask:
|
|||
"owner": owner,
|
||||
"name": name,
|
||||
"version": version,
|
||||
"config_hash": config_hash,
|
||||
"pr_url": "",
|
||||
"status": moderation_status,
|
||||
"visibility": visibility,
|
||||
|
|
|
|||
Loading…
Reference in New Issue