Skip to content

Add AI auto-configure route for new connections#1632

Merged
lyubov-voloshko merged 4 commits into
mainfrom
frontend-ai-auto-configure-route
Feb 25, 2026
Merged

Add AI auto-configure route for new connections#1632
lyubov-voloshko merged 4 commits into
mainfrom
frontend-ai-auto-configure-route

Conversation

@gugu

@gugu gugu commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Redirect users to /auto-configure/:connection-id after adding a connection, where the frontend calls GET /api/ai/v2/setup/:connection-id to trigger AI-based dashboard configuration. Remove the backend fire-and-forget AI scan from connection creation so configuration is driven by the frontend route.

Redirect users to /auto-configure/:connection-id after adding a connection,
where the frontend calls GET /api/ai/v2/setup/:connection-id to trigger
AI-based dashboard configuration. Remove the backend fire-and-forget AI scan
from connection creation so configuration is driven by the frontend route.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the AI-based dashboard auto-configuration workflow to be frontend-driven rather than backend fire-and-forget. After a user creates a new database connection, they are now redirected to a dedicated /auto-configure/:connection-id route where the frontend explicitly calls the AI setup endpoint. This provides better user experience through visible loading states and error handling, replacing the previous approach where AI configuration happened silently in the background after connection creation.

Changes:

  • Redirects users to a new auto-configure route after successful connection creation
  • Adds a new AutoConfigureComponent that displays loading state while AI configures the database and handles errors gracefully
  • Removes the backend fire-and-forget AI scan from the connection creation flow, simplifying the backend logic

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
frontend/src/app/components/connect-db/connect-db.component.ts Updated navigation to redirect to /auto-configure/:connection-id instead of /dashboard/:connection-id for non-agent connections
frontend/src/app/components/auto-configure/auto-configure.component.ts New standalone component that triggers AI setup via API call and handles success/error states
frontend/src/app/components/auto-configure/auto-configure.component.html Template displaying loading spinner during configuration and error message with fallback navigation
frontend/src/app/components/auto-configure/auto-configure.component.css Styling for centered loading and error states using flexbox layout
frontend/src/app/app-routing.module.ts Added route configuration for auto-configure component with auth guard protection
backend/src/entities/connection/use-cases/create-connection.use.case.ts Removed fire-and-forget AI scan logic, unused imports (Sentry, Encryptor, SharedJobsService), and simplified connection creation flow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +34 to +42
private async _configure(connectionId: string): Promise<void> {
const result = await this._api.get<string>(`/ai/v2/setup/${connectionId}`, { responseType: 'text' });

if (result !== null) {
this._router.navigate([`/dashboard/${connectionId}`]);
} else {
this.loading.set(false);
this.errorMessage.set('Auto-configuration could not be completed. You can still configure your tables manually.');
}

Copilot AI Feb 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error handling logic assumes that a null result always indicates an error, but the API service returns null for any error (including network errors, 401 unauthorized, 404 not found, etc.). This makes it impossible to distinguish between different types of failures or provide more specific error messages to users. Consider checking the specific error type or HTTP status code to provide more contextual error messages, especially for cases like permission denied or connection not found.

Copilot uses AI. Check for mistakes.
@lyubov-voloshko lyubov-voloshko merged commit 394656d into main Feb 25, 2026
17 of 19 checks passed
@lyubov-voloshko lyubov-voloshko deleted the frontend-ai-auto-configure-route branch February 25, 2026 15:46
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.

4 participants