mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-08-03 06:17:29 +08:00
Feat: full optimization on connector dashboard (#14979)
### What problem does this PR solve? This PR improves the connector dashboard task management experience and adds better visibility into connector execution logs. ### Overview: #### Before <img width="700" alt="image" src="https://github.com/user-attachments/assets/e4a8ed6f-2e18-4f0f-8528-41a514550052" /> #### Now: <img width="700" alt="Screenshot from 2026-05-18 16-31-30" src="https://github.com/user-attachments/assets/d4ca193b-847a-49ae-9e4f-5fbca60ea627" /> ### 1. Add a new logging page to the connector dashboard A new logging page has been added so users can view connector task execution logs directly from the connector dashboard. ### 2. Merge the Resume button into Confirm The separate **Resume** button has been removed. The **Confirm** button now represents different actions depending on the current task state: - **Save**: Save form changes and reschedule tasks. - **Stop**: Cancel currently scheduled or running tasks. - **Resume**: Create new scheduled tasks after the previous tasks have been stopped. - **Start**: Start tasks when no task has been started yet. ### 3. Separate syncing and pruning tasks Connector tasks are now separated into **syncing** and **pruning**. Pruning is controlled by the **Sync deleted files** option: - When **Sync deleted files** is disabled, only syncing tasks are shown. - When **Sync deleted files** is enabled, both syncing and pruning tasks are shown. **Now: Sync deleted files disabled** <img width="700" alt="Sync deleted files disabled" src="https://github.com/user-attachments/assets/dbd9232e-614a-407f-a0b1-c109e5fa567d" /> **Now: Sync deleted files enabled** <img width="700" alt="Sync deleted files enabled" src="https://github.com/user-attachments/assets/1f527f48-ccb3-4ee8-97ca-086891489296" /> ### 4. Update logs in backend <img width="700" alt="image" src="https://github.com/user-attachments/assets/10a95a3f-98c1-4e67-8afa-ddf6cda5b0b2" /> ### 5. Remove connector resume API - Removed: `POST /v1/connectors/<connector_id>/resume` - Replaced by: `PATCH /v1/connectors/<connector_id>` ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -205,7 +205,7 @@ def _load_connector_app(monkeypatch):
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def resume(*_args, **_kwargs):
|
||||
def cancel_tasks(*_args, **_kwargs):
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
@@ -349,7 +349,7 @@ def test_connector_basic_routes_and_task_controls(monkeypatch):
|
||||
records = {"conn-1": _FakeConnectorRecord({"id": "conn-1", "source": "drive"})}
|
||||
update_calls = []
|
||||
save_calls = []
|
||||
resume_calls = []
|
||||
cancel_calls = []
|
||||
delete_calls = []
|
||||
|
||||
monkeypatch.setattr(module.ConnectorService, "update_by_id", lambda cid, payload: update_calls.append((cid, payload)))
|
||||
@@ -362,7 +362,7 @@ def test_connector_basic_routes_and_task_controls(monkeypatch):
|
||||
monkeypatch.setattr(module.ConnectorService, "get_by_id", lambda cid: (True, records[cid]))
|
||||
monkeypatch.setattr(module.ConnectorService, "list", lambda tenant_id: [{"id": "listed", "tenant": tenant_id}])
|
||||
monkeypatch.setattr(module.SyncLogsService, "list_sync_tasks", lambda cid, page, page_size: ([{"id": "log-1"}], 9))
|
||||
monkeypatch.setattr(module.ConnectorService, "resume", lambda cid, status: resume_calls.append((cid, status)))
|
||||
monkeypatch.setattr(module.ConnectorService, "cancel_tasks", lambda cid: cancel_calls.append(cid))
|
||||
monkeypatch.setattr(module.ConnectorService, "delete_by_id", lambda cid: delete_calls.append(cid))
|
||||
monkeypatch.setattr(module, "get_uuid", lambda: "generated-id")
|
||||
|
||||
@@ -401,14 +401,6 @@ def test_connector_basic_routes_and_task_controls(monkeypatch):
|
||||
logs_res = module.list_logs("conn-log")
|
||||
assert logs_res["data"] == {"total": 9, "logs": [{"id": "log-1"}]}
|
||||
|
||||
monkeypatch.setattr(module, "get_request_json", lambda: _AwaitableValue({"resume": True}))
|
||||
assert _run(module.resume("conn-r1"))["data"] is True
|
||||
|
||||
monkeypatch.setattr(module, "get_request_json", lambda: _AwaitableValue({"resume": False}))
|
||||
assert _run(module.resume("conn-r2"))["data"] is True
|
||||
assert ("conn-r1", module.TaskStatus.SCHEDULE) in resume_calls
|
||||
assert ("conn-r2", module.TaskStatus.CANCEL) in resume_calls
|
||||
|
||||
monkeypatch.setattr(module, "get_request_json", lambda: _AwaitableValue({"kb_id": "kb-1"}))
|
||||
monkeypatch.setattr(module.ConnectorService, "rebuild", lambda *_args: "rebuild-failed")
|
||||
failed_rebuild = _run(module.rebuild("conn-rb"))
|
||||
@@ -421,7 +413,7 @@ def test_connector_basic_routes_and_task_controls(monkeypatch):
|
||||
|
||||
rm_res = module.rm_connector("conn-rm")
|
||||
assert rm_res["data"] is True
|
||||
assert ("conn-rm", module.TaskStatus.CANCEL) in resume_calls
|
||||
assert cancel_calls == ["conn-rm"]
|
||||
assert delete_calls == ["conn-rm"]
|
||||
|
||||
|
||||
@@ -434,14 +426,14 @@ def test_connector_by_id_routes_reject_cross_tenant_access(monkeypatch):
|
||||
monkeypatch.setattr(module.ConnectorService, "accessible", lambda cid, uid: False)
|
||||
monkeypatch.setattr(module.ConnectorService, "get_by_id", lambda *_args: touched.append("get_by_id"))
|
||||
monkeypatch.setattr(module.SyncLogsService, "list_sync_tasks", lambda *_args: touched.append("list_sync_tasks"))
|
||||
monkeypatch.setattr(module.ConnectorService, "resume", lambda *_args: touched.append("resume"))
|
||||
monkeypatch.setattr(module.ConnectorService, "cancel_tasks", lambda *_args: touched.append("cancel_tasks"))
|
||||
monkeypatch.setattr(module.ConnectorService, "delete_by_id", lambda *_args: touched.append("delete_by_id"))
|
||||
monkeypatch.setattr(module.ConnectorService, "update_by_id", lambda *_args: touched.append("update_by_id"))
|
||||
monkeypatch.setattr(module.ConnectorService, "rebuild", lambda *_args: touched.append("rebuild"))
|
||||
|
||||
def _get_request_json():
|
||||
touched.append("get_request_json")
|
||||
return _AwaitableValue({"resume": True, "config": {"x": 1}})
|
||||
return _AwaitableValue({"config": {"x": 1}})
|
||||
|
||||
monkeypatch.setattr(module, "get_request_json", _get_request_json)
|
||||
|
||||
@@ -449,7 +441,6 @@ def test_connector_by_id_routes_reject_cross_tenant_access(monkeypatch):
|
||||
_run(module.update_connector("conn-victim")),
|
||||
module.get_connector("conn-victim"),
|
||||
module.list_logs("conn-victim"),
|
||||
_run(module.resume("conn-victim")),
|
||||
_run(module.rebuild("conn-victim")),
|
||||
module.rm_connector("conn-victim"),
|
||||
_run(module.test_connector("conn-victim")),
|
||||
|
||||
Reference in New Issue
Block a user