Skip to content

Remove dashboardId from AI widget generation endpoint in frontend#1645

Merged
gugu merged 1 commit intomainfrom
frontend_remove_dashboard_id_from_ai_widget_generation
Feb 27, 2026
Merged

Remove dashboardId from AI widget generation endpoint in frontend#1645
gugu merged 1 commit intomainfrom
frontend_remove_dashboard_id_from_ai_widget_generation

Conversation

@gugu
Copy link
Contributor

@gugu gugu commented Feb 27, 2026

No description provided.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings February 27, 2026 11:46
Copy link
Contributor

Copilot AI left a comment

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 updates the frontend AI widget generation flow to stop depending on a dashboard context, aligning the client with an endpoint that no longer requires a dashboardId.

Changes:

  • Updated DashboardsService.generateWidgetWithAi to call /widget/generate/{connectionId} and removed the dashboardId argument.
  • Removed dashboard_id from the GeneratedPanelWithPosition.panel_position model.
  • Simplified ChartEditComponent AI generation logic/UI by removing aiDashboardId state and the template gating.

Reviewed changes

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

File Description
frontend/src/app/services/dashboards.service.ts Removes dashboardId from AI widget generation API call and updates the endpoint path.
frontend/src/app/models/saved-query.ts Updates AI response typing to drop dashboard_id from panel_position.
frontend/src/app/components/charts/chart-edit/chart-edit.component.ts Removes dashboard-derived AI state and updates AI generation call signature.
frontend/src/app/components/charts/chart-edit/chart-edit.component.html Makes the AI section no longer conditional on aiDashboardId().

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

Comment on lines 631 to +637
async generateWithAi(): Promise<void> {
const dashboardId = this.aiDashboardId();
if (!dashboardId || !this.aiDescription().trim()) return;
if (!this.aiDescription().trim()) return;

this.aiGenerating.set(true);

try {
const result = await this._dashboards.generateWidgetWithAi(dashboardId, this.connectionId(), {
const result = await this._dashboards.generateWidgetWithAi(this.connectionId(), {
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

Now that AI widget generation no longer depends on a dashboardId (and the aiDashboardId state/effect was removed), the component still calls _loadAiPrerequisites() on init which sets DashboardsService.setActiveConnection() and triggers an unnecessary /dashboards/{connectionId} fetch. Consider removing _loadAiPrerequisites() (and its ngOnInit call) or updating it to only run when the dashboards list is actually needed; also update the stale inline comment that references an effect that no longer exists.

Copilot uses AI. Check for mistakes.
@gugu gugu merged commit 7376a69 into main Feb 27, 2026
19 of 21 checks passed
@gugu gugu deleted the frontend_remove_dashboard_id_from_ai_widget_generation branch February 27, 2026 11:54
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