Skip to content

Add source DB option to Fill from DB (BRU-4473)#757

Merged
DjamilaBaroudi merged 8 commits into
mainfrom
improve/add-source-db-option-to-fill-from-db
May 26, 2026
Merged

Add source DB option to Fill from DB (BRU-4473)#757
DjamilaBaroudi merged 8 commits into
mainfrom
improve/add-source-db-option-to-fill-from-db

Conversation

@DjamilaBaroudi
Copy link
Copy Markdown
Collaborator

@DjamilaBaroudi DjamilaBaroudi commented May 22, 2026

Summary

  • Adds a connection picker dropdown next to the "Fill from DB" button on the Columns tab so users can pull column schemas from a non-destination connection.
  • For ingestr assets, the asset's source_connection is auto-suggested at the top of the menu with a source label.
  • Selecting any entry forwards --connection <name> to bruin patch fill-columns-from-db (added upstream in bruin#2079).
  • Default left-click on the button is unchanged — still fills from the destination connection.

Closes BRU-4473.

Motivation

Users cloning a source table to e.g. MSSQL want to copy the schema exactly (nullability, columns with nulls). Today "Fill from DB" always reads from the destination, so the workaround is editing pipeline.yml to swap destination → source, save, fill, swap back. This PR removes that workaround.

Files changed

  • webview-ui/src/components/asset/columns/AssetColumns.vue — split button + Headless UI menu listing connections; matches the Validate split-button styling.
  • webview-ui/src/App.vue — pass assetType and parameters props to AssetColumns.
  • src/panels/BruinPanel.ts — read connection from payload and append --connection <name> to fill-columns flags.
  • CHANGELOG.md, README.md, package.json — 0.80.2 bump.

Backwards compatibility

If a user is on a pre-#2079 bruin binary and clicks a connection from the menu, the CLI returns an unknown-flag error which is surfaced via the existing fill-columns-message error path. No version gate needed.

🤖 Generated with Claude Code

DjamilaBaroudi and others added 6 commits May 22, 2026 16:23
Adds a split button + dropdown to the Columns tab so users can fill
columns from a non-destination connection. For ingestr assets, the
source_connection is auto-suggested at the top of the menu. Selecting
an entry forwards --connection <name> to
'bruin patch fill-columns-from-db' (CLI #2079).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adopts the same split-button styling used by the Validate button on the
General tab: bg-editor-button-bg caret with -ml-px to abut the main
button, and dropdown items rendered with vscode-button.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Wraps the button content in flex items-center justify-center and gives
status icons (loading/success/error) explicit ml-1 mr-1.5 so they sit
inset from the button's left edge with consistent spacing before the
label, matching the Validate button.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The h-3 w-3 box was smaller than the 16px codicon glyph, so the icon
overflowed the span and appeared misaligned at the button's left edge.
Switch to text-sm mr-1 (same pattern as Materialization.vue:501) so the
glyph sits centered with the label.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replaces vscode-button menu items with plain <button> so flex layout
controls the inner truncation properly. Bumps menu width to w-64,
truncates connection names (with title tooltip) and caps the type
label at 40% width. Adds overflow-hidden + shadow-lg on the container
so items can't bleed past the rounded border.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 22, 2026

Comments Outside Diff (1)

  1. webview-ui/src/components/asset/columns/AssetColumns.vue, line 1163 (link)

    P2 Connection list not scoped to the current environment

    bruin.getConnectionsList is dispatched without any environment hint, so the underlying bruin connections list -o json command runs without -env. The response may include connections from all environments or only the default one. If the user has a non-default environment selected and picks a connection that only exists there, the fill command will receive --environment <selected> --connection <name>, which could silently target the wrong connection. Consider passing the currently selected environment when requesting the list, or showing a tooltip indicating which environment the listed connections belong to.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: webview-ui/src/components/asset/columns/AssetColumns.vue
    Line: 1163
    
    Comment:
    **Connection list not scoped to the current environment**
    
    `bruin.getConnectionsList` is dispatched without any environment hint, so the underlying `bruin connections list -o json` command runs without `-env`. The response may include connections from all environments or only the default one. If the user has a non-default environment selected and picks a connection that only exists there, the fill command will receive `--environment <selected> --connection <name>`, which could silently target the wrong connection. Consider passing the currently selected environment when requesting the list, or showing a tooltip indicating which environment the listed connections belong to.
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
webview-ui/src/components/asset/columns/AssetColumns.vue:1163
**Connection list not scoped to the current environment**

`bruin.getConnectionsList` is dispatched without any environment hint, so the underlying `bruin connections list -o json` command runs without `-env`. The response may include connections from all environments or only the default one. If the user has a non-default environment selected and picks a connection that only exists there, the fill command will receive `--environment <selected> --connection <name>`, which could silently target the wrong connection. Consider passing the currently selected environment when requesting the list, or showing a tooltip indicating which environment the listed connections belong to.

### Issue 2 of 2
webview-ui/src/components/asset/columns/AssetColumns.vue:95-97
**"No connections found" flashes before the first response arrives**

`availableConnections` starts as an empty array and the `connections-list-message` response is asynchronous. On the first render of the menu, if the request hasn't completed yet, a non-ingestr asset (or an ingestr asset whose `source_connection` is absent) will immediately show "No connections found" until the response arrives. Adding a loading flag that is set to `true` in `onMounted` and cleared in `handleConnectionsList` (success or error) would prevent this flash.

Reviews (1): Last reviewed commit: "fix: dropdown overflow and styling in Fi..." | Re-trigger Greptile

Comment thread webview-ui/src/components/asset/columns/AssetColumns.vue
DjamilaBaroudi and others added 2 commits May 22, 2026 17:37
Adopts the same MenuItems positioning (left-0 xs:right-0), responsive
width (w-56 xs:w-64), and item classes (text-2xs, bg-editorWidget-bg,
hover:bg-editor-button-hover-bg) used by the Validate menu in
AssetGeneral.vue. Items remain plain <button> instead of vscode-button
so the inner flex+truncate keeps working for the name/type layout.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Drops the flex justify-between layout that pushed the type to the
right edge. Name and dim type label now flow inline (name + space +
type), and the whole row truncates as a unit. Full string available
on hover via title.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@DjamilaBaroudi DjamilaBaroudi merged commit c4969ef into main May 26, 2026
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants