fix: construct db_icon from datasource_name when missing in API response#38
fix: construct db_icon from datasource_name when missing in API response#38wicky-zipstack merged 2 commits intomainfrom
Conversation
|
| Filename | Overview |
|---|---|
| backend/backend/application/context/connection.py | Adds db_icon to create/update connection API responses using the existing import_file pattern; consistent with all other endpoints in the codebase |
Sequence Diagram
sequenceDiagram
participant FE as Frontend
participant API as Connection API
participant CTX as ConnectionContext
participant DB as Database
participant ADP as Adapter Module
FE->>API: POST /connections (create)
API->>CTX: create_connection(connection_details)
CTX->>DB: test_connection_data(datasource, data)
CTX->>DB: connection_session.create_connection()
DB-->>CTX: connection_model
CTX->>ADP: import_file("visitran.adapters.{datasource_name}").ICON
ADP-->>CTX: db_icon URL
CTX-->>API: {id, name, datasource_name, db_icon, ...}
API-->>FE: 200 OK with db_icon included
FE->>API: PUT /connections/{id} (update)
API->>CTX: update_connection(id, connection_details)
CTX->>DB: connection_session.update_connection()
DB-->>CTX: connection_model
CTX->>ADP: import_file("visitran.adapters.{datasource_name}").ICON
ADP-->>CTX: db_icon URL
CTX-->>API: {id, name, datasource_name, db_icon, ...}
API-->>FE: 200 OK with db_icon included
Greploops — Automatically fix all review issues by running /greploops in Claude Code. It iterates: fix, push, re-review, repeat until 5/5 confidence.
Use the Greptile plugin for Claude Code to query reviews, search comments, and manage custom context directly from your terminal.
Reviews (3): Last reviewed commit: "fix: include db_icon in connection creat..." | Re-trigger Greptile
The create/update connection API response doesn't include db_icon, causing broken image icons in the connection dropdown after creating a new connection. Now constructs the icon URL from datasource_name when db_icon is missing.
0db7220 to
0fdfde7
Compare
Move db_icon resolution to the backend (connection.py) so create and update endpoints return db_icon consistently, matching the list endpoint. This removes the need for frontend icon-fallback logic.
What
db_iconURL fromdatasource_namewhen missing in the create/update connection API responseWhy
db_iconfield<img src={undefined}>resulting in a broken image placeholderHow
NewProject.jsxandNewEnv.jsx, when handling the optimistic update withupdatedConnectiondata, check ifdb_iconis missingdatasource_nameusing the static pattern:https://storage.googleapis.com/visitran-static/adapter/{datasource_name}.pngpostgres→postgresqlnaming mismatchCan this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
db_iconis missing. Ifdb_iconis already present in the response, the existing value is used unchanged. No impact on connections fetched from the list API (which already includedb_icon).Database Migrations
Env Config
Relevant Docs
Related Issues or PRs
Dependencies Versions
Notes on Testing
Screenshots
N/A
Checklist