Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 55 minutes and 25 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR introduces connection string parsing functionality to the database connection component. A new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Component as Connect DB<br/>Component
participant Validator as Connection String<br/>Validator
participant Parser as Parser<br/>Function
participant Form as Dynamic Form<br/>Component
User->>Component: Enter connection string
User->>Component: Click "Apply"
Component->>Validator: applyConnectionString()
Validator->>Parser: parseConnectionString()
Parser->>Parser: Extract scheme & validate
Parser->>Parser: Map scheme to DBtype
Parser->>Parser: Parse URL structure
Parser->>Parser: Apply defaults & decode
Parser-->>Validator: Return ParsedConnectionString
Validator->>Component: Populate db fields
Component->>Component: Clear connectionString input
Component->>Form: Update credentialsFormComponent
Form-->>User: Render form for parsed DB type
Component-->>User: Show success snackbar
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds a “connection string mode” to the Connect DB flow, letting users paste a DB connection URI to auto-fill credentials, and refactors the direct-connection credential forms to render via a single dynamic component.
Changes:
- Add a connection-string parser + Angular validator/directive to validate and parse DB URIs.
- Add a connection string input + “Apply” action to auto-populate connection fields on the Connect DB page.
- Replace per-DB
*ngIfcredential form rendering withng-dynamic-component-based dynamic rendering.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/package.json | Adds connection-string-parser dependency. |
| frontend/yarn.lock | Locks the new dependency and transitive requirements. |
| frontend/src/app/validators/connection-string.validator.ts | Implements parsing + validation for connection strings. |
| frontend/src/app/directives/connection-string-validator.directive.ts | Exposes the validator as an ngModel directive. |
| frontend/src/app/components/connect-db/connect-db.component.ts | Wires parsing into the connect flow and introduces dynamic form selection. |
| frontend/src/app/components/connect-db/connect-db.component.html | Adds the connection string UI and swaps to <ndc-dynamic> for credential forms. |
| frontend/src/app/components/connect-db/connect-db.component.css | Adjusts layout/styling for the new connection string section and dynamic form rendering. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }; | ||
|
|
||
| public credentialsFormComponent: Type<BaseCredentialsFormComponent> | null = null; | ||
| public credentialsFormInputs: Record<string, any> = {}; |
There was a problem hiding this comment.
credentialsFormInputs is declared but never used (inputs are inlined in the template). Remove this property or use it to avoid dead code and potential unused-member lint/TS warnings.
| public credentialsFormInputs: Record<string, any> = {}; |
| grid-row: 6 / span 4; | ||
| } | ||
|
|
||
| :host ::ng-deep .connectForm__typeSwitch + ndc-dynamic + .credentials-fieldset { |
There was a problem hiding this comment.
The selector .connectForm__typeSwitch + ndc-dynamic + .credentials-fieldset does not match the new template structure: the credentials form class is applied via ndcDynamicAttributes to the dynamically created component inside <ndc-dynamic>, not to a sibling following ndc-dynamic. As written, this rule will never apply and can break the intended grid positioning. Adjust the selector to target the element that actually has the class (e.g., ndc-dynamic .credentials-fieldset or apply the class on ndc-dynamic itself and update the selector accordingly).
| :host ::ng-deep .connectForm__typeSwitch + ndc-dynamic + .credentials-fieldset { | |
| :host ::ng-deep .connectForm__typeSwitch + ndc-dynamic .credentials-fieldset { |
| applyConnectionString() { | ||
| if (!this.connectionString.trim()) { | ||
| return; | ||
| } | ||
|
|
||
| try { | ||
| const parsed = parseConnectionString(this.connectionString); | ||
|
|
||
| this.db.type = parsed.dbType; | ||
| this.db.host = parsed.host; | ||
| this.db.port = parsed.port; | ||
| this.db.username = parsed.username; | ||
| this.db.password = parsed.password; | ||
| this.db.database = parsed.database; | ||
|
|
||
| if (parsed.authSource) { | ||
| this.db.authSource = parsed.authSource; | ||
| } | ||
| if (parsed.schema) { | ||
| this.db.schema = parsed.schema; | ||
| } | ||
| if (parsed.ssl) { | ||
| this.db.ssl = true; | ||
| } | ||
|
|
||
| this.connectionString = ''; | ||
| this._notifications.showSuccessSnackbar('Connection string parsed successfully'); | ||
| } catch (_e) { | ||
| // Validation directive handles error display | ||
| } | ||
| } |
There was a problem hiding this comment.
New connection-string behavior (applyConnectionString() / parseConnectionString() integration) isn’t covered by the existing ConnectDBComponent unit tests. Add tests to verify that a valid URI populates db fields and switches the credentials form to the parsed DB type, and that invalid/unsupported URIs don’t mutate state.
| this.db.host = parsed.host; | ||
| this.db.port = parsed.port; | ||
| this.db.username = parsed.username; | ||
| this.db.password = parsed.password; | ||
| this.db.database = parsed.database; | ||
|
|
||
| if (parsed.authSource) { | ||
| this.db.authSource = parsed.authSource; | ||
| } | ||
| if (parsed.schema) { | ||
| this.db.schema = parsed.schema; | ||
| } | ||
| if (parsed.ssl) { | ||
| this.db.ssl = true; | ||
| } | ||
|
|
There was a problem hiding this comment.
applyConnectionString() updates db.type but never updates credentialsFormComponent, so the dynamic credentials form can stay on the previously selected DB type after applying a connection string. Update credentialsFormComponent (or call dbTypeChange() / centralize the logic) after setting db.type so the UI matches the parsed scheme. Also consider explicitly clearing/overwriting optional fields (authSource, schema, ssl) when they are absent in the parsed string to avoid leaving stale values from prior manual edits.
| this.db.host = parsed.host; | |
| this.db.port = parsed.port; | |
| this.db.username = parsed.username; | |
| this.db.password = parsed.password; | |
| this.db.database = parsed.database; | |
| if (parsed.authSource) { | |
| this.db.authSource = parsed.authSource; | |
| } | |
| if (parsed.schema) { | |
| this.db.schema = parsed.schema; | |
| } | |
| if (parsed.ssl) { | |
| this.db.ssl = true; | |
| } | |
| this.dbTypeChange(); | |
| this.db.host = parsed.host; | |
| this.db.port = parsed.port; | |
| this.db.username = parsed.username; | |
| this.db.password = parsed.password; | |
| this.db.database = parsed.database; | |
| this.db.authSource = parsed.authSource ?? null; | |
| this.db.schema = parsed.schema ?? null; | |
| this.db.ssl = parsed.ssl ?? false; |
Summary by CodeRabbit
Release Notes
New Features
Style