## Summary What changed and why? ## Change Type - [ ] Cowork feature - [ ] Bug fix - [x] Core AI contribution - [ ] Test / hardening - [ ] Performance - [ ] Documentation ## Related Work Cowork Task: Core Repo: http://34.143.229.138/gitea-admin/fsg-ai-core-assets Core AI Issue: Core Task: Related PR: ## Scope What is intentionally included? What is intentionally NOT included? ## Validation - [ ] Unit tests - [ ] Integration tests - [ ] Manual verification - [ ] Regression check Commands / evidence: ## Security Impact Permission / credential / network / customer data impact: ## Compatibility - [ ] No breaking change - [ ] Breaking change documented ## Reviewer Notes Anything Cowork reviewers should pay attention to. --------- Co-authored-by: Hiep Ha Van <hiephv3@fpt.com> Co-authored-by: Nam Pham Dinh Thanh <nampdt@fpt.com> Co-authored-by: Lam Hoang Van <lamhv7@fpt.com> Co-authored-by: NamPDT <minhanhpkpro@gmail.com> Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
@@ -16,9 +16,14 @@ from PySide6.QtWidgets import (
|
||||
QLineEdit, QMessageBox, QPushButton, QStackedWidget, QVBoxLayout, QWidget,
|
||||
)
|
||||
|
||||
from ..core.ext_connectors import PRESETS
|
||||
from ..core.ext_connectors import CATEGORIES, PRESETS
|
||||
from ..i18n import tr
|
||||
|
||||
# ms365 has no user-created entries here (see ConnectorsPanel) — it auto-connects
|
||||
# via its own built-in OneDrive/SharePoint toggles, so it's left off this picker.
|
||||
_PICKABLE_CATEGORIES = tuple(c for c in CATEGORIES if c != "ms365")
|
||||
_CATEGORY_LABEL = {"cad": "CAD", "cae": "CAE", "other": "Other"}
|
||||
|
||||
|
||||
class ExtConnectorEditDialog(QDialog):
|
||||
def __init__(self, parent=None, category: str = "cad", connector: Optional[dict] = None):
|
||||
@@ -32,10 +37,20 @@ class ExtConnectorEditDialog(QDialog):
|
||||
lay = QVBoxLayout(self)
|
||||
|
||||
form = QFormLayout()
|
||||
# Category picker — the single "+ Thêm connector…" button (Monitoring ▸
|
||||
# Công cụ ▸ Connector) has no tree selection to infer this from anymore,
|
||||
# so the dialog itself asks. Fixed once created, same as the preset.
|
||||
self.category_combo = QComboBox()
|
||||
for cat in _PICKABLE_CATEGORIES:
|
||||
self.category_combo.addItem(_CATEGORY_LABEL.get(cat, cat), cat)
|
||||
idx = self.category_combo.findData(self.category)
|
||||
self.category_combo.setCurrentIndex(max(0, idx))
|
||||
self.category_combo.setEnabled(not editing)
|
||||
self.category_combo.currentIndexChanged.connect(self._on_category_changed)
|
||||
form.addRow(tr("ext.category_label"), self.category_combo)
|
||||
|
||||
self.preset_combo = QComboBox()
|
||||
self.preset_combo.addItem(tr("ext.preset_custom"), "")
|
||||
for p in PRESETS.get(self.category, []):
|
||||
self.preset_combo.addItem(p["name"], p["id"])
|
||||
self._reload_presets()
|
||||
if editing:
|
||||
self.preset_combo.setEnabled(False) # identity fixed once created
|
||||
form.addRow(tr("ext.preset_label"), self.preset_combo)
|
||||
@@ -105,6 +120,18 @@ class ExtConnectorEditDialog(QDialog):
|
||||
buttons.rejected.connect(self.reject)
|
||||
lay.addWidget(buttons)
|
||||
|
||||
def _reload_presets(self) -> None:
|
||||
self.preset_combo.blockSignals(True)
|
||||
self.preset_combo.clear()
|
||||
self.preset_combo.addItem(tr("ext.preset_custom"), "")
|
||||
for p in PRESETS.get(self.category, []):
|
||||
self.preset_combo.addItem(p["name"], p["id"])
|
||||
self.preset_combo.blockSignals(False)
|
||||
|
||||
def _on_category_changed(self) -> None:
|
||||
self.category = self.category_combo.currentData() or self.category
|
||||
self._reload_presets()
|
||||
|
||||
def _apply_preset(self) -> None:
|
||||
preset_id = self.preset_combo.currentData()
|
||||
if preset_id and not self.name_edit.text().strip():
|
||||
|
||||
Reference in New Issue
Block a user