fix: construct db_icon from datasource_name when missing in API response#38
Open
wicky-zipstack wants to merge 1 commit intomainfrom
Open
fix: construct db_icon from datasource_name when missing in API response#38wicky-zipstack wants to merge 1 commit intomainfrom
wicky-zipstack wants to merge 1 commit intomainfrom
Conversation
|
| Filename | Overview |
|---|---|
| frontend/src/base/new-project/NewProject.jsx | Adds db_icon fallback construction from datasource_name when missing in optimistic connection update; logic is correct and well-guarded. |
| frontend/src/base/components/environment/NewEnv.jsx | Mirrors the same db_icon fallback as NewProject.jsx; handles postgres→postgresql mapping and guards against missing datasource_name. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["getAllConnections(updatedConnection)"] --> B{updatedConnection\nhas id?}
B -- No --> C[Fetch full connection\nlist from API]
B -- Yes --> D["const conn = { ...updatedConnection }"]
D --> E{conn.db_icon\nmissing AND\nconn.datasource_name\npresent?}
E -- No --> H[Use conn as-is]
E -- Yes --> F{datasource_name\n=== 'postgres'?}
F -- Yes --> G["iconName = 'postgresql'"]
F -- No --> G2["iconName = datasource_name"]
G --> I["conn.db_icon = GCS_URL/iconName.png"]
G2 --> I
I --> H
H --> J{Connection id\nalready in list?}
J -- Yes --> K[Replace existing\nentry with conn]
J -- No --> L[Append conn\nto list]
K --> M[setConnectionList]
L --> M
C --> N[setConnectionList with\nAPI response]
Reviews (2): Last reviewed commit: "fix: construct db_icon from datasource_n..." | 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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