From 13b74d94c32b5149200ab0e3a59dd83f8a752019 Mon Sep 17 00:00:00 2001 From: Lyubov Voloshko Date: Fri, 15 May 2026 08:27:37 +0000 Subject: [PATCH 1/2] fix: keep AI query input visible after applying schema changes and fix approve/reject button lifecycle - Remove outer `!applied()` guard so input is always shown after approval - Reset `applied` signal when new AI batch arrives to re-enable approve/reject buttons - Clear batchId on successful approval so pendingBatch() returns null and input reappears - Disable textarea while AI request is in flight Co-Authored-By: Claude Sonnet 4.6 --- .../edit-database-schema.component.html | 79 +++++++++---------- .../edit-database-schema.component.ts | 7 +- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/frontend/src/app/components/edit-database-schema/edit-database-schema.component.html b/frontend/src/app/components/edit-database-schema/edit-database-schema.component.html index 61e30196a..a93733d90 100644 --- a/frontend/src/app/components/edit-database-schema/edit-database-schema.component.html +++ b/frontend/src/app/components/edit-database-schema/edit-database-schema.component.html @@ -164,45 +164,44 @@

{{ message.text }}

} - @if (!applied()) { -
- @if (pendingBatch()) { -
- - + +
+ } @else { +
+ + {{showClose || isRoutedPage() ? 'Describe the changes you need...' : 'Describe the database you need...'}} + + -
- } @else { - - - {{showClose || isRoutedPage() ? 'Describe the changes you need...' : 'Describe the database you need...'}} - - - - - } - - } + + + } + diff --git a/frontend/src/app/components/edit-database-schema/edit-database-schema.component.ts b/frontend/src/app/components/edit-database-schema/edit-database-schema.component.ts index e81c684c4..befb1310c 100644 --- a/frontend/src/app/components/edit-database-schema/edit-database-schema.component.ts +++ b/frontend/src/app/components/edit-database-schema/edit-database-schema.component.ts @@ -105,6 +105,7 @@ export class EditDatabaseSchemaComponent implements OnInit, AfterViewInit { } if (result && result.changes.length > 0) { const summary = result.changes.map(c => `**${c.changeType}** \`${c.targetTableName}\`${c.aiSummary ? ' — ' + c.aiSummary : ''}`).join('\n'); + this.applied.set(false); this.messages.update(msgs => [...msgs, { role: 'ai', text: `I've generated ${result.changes.length} change(s) for your database:\n\n${summary}\n\nReview the SQL below and approve or reject.`, @@ -145,10 +146,12 @@ export class EditDatabaseSchemaComponent implements OnInit, AfterViewInit { }]); } else { this.applied.set(true); - this.messages.update(msgs => [...msgs, { + this.messages.update(msgs => msgs.map(m => + m === batch ? { ...m, batchId: undefined } : m + ).concat({ role: 'ai', text: 'All changes applied successfully! Your tables have been created.', - }]); + })); this._loadDiagram('Updated Database Structure'); } } From 91e324c56b49d6cd91b929d23855042aa4655b8c Mon Sep 17 00:00:00 2001 From: Lyubov Voloshko Date: Fri, 15 May 2026 08:53:38 +0000 Subject: [PATCH 2/2] ai ddl changes: fix ai chat interactions, request uncached rows --- .../src/app/components/dashboard/dashboard.component.ts | 8 +++++--- .../src/app/components/dashboard/db-tables-data-source.ts | 3 +++ .../edit-database-schema.component.html | 1 + frontend/src/app/services/tables.service.ts | 3 +++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/components/dashboard/dashboard.component.ts b/frontend/src/app/components/dashboard/dashboard.component.ts index 0523da15a..80010533f 100644 --- a/frontend/src/app/components/dashboard/dashboard.component.ts +++ b/frontend/src/app/components/dashboard/dashboard.component.ts @@ -200,7 +200,7 @@ export class DashboardComponent implements OnInit, OnDestroy { } else { tableName = this.allTables[0]?.table; } - this.router.navigate([`/dashboard/${this.connectionID}/${tableName}`], { replaceUrl: true }); + this.router.navigate([`/dashboard/${this.connectionID}/${tableName}`], { replaceUrl: true, queryParamsHandling: 'preserve' }); this.selectedTableName = tableName; } }), @@ -271,7 +271,8 @@ export class DashboardComponent implements OnInit, OnDestroy { this.sortOrder = queryParams.sort_direction; const search = queryParams.search; - this.getRows(search); + const uncached = queryParams.uncached === 'true'; + this.getRows(search, uncached); console.log('getRows from setTable'); const selectedTableProperties = this.allTables.find((table: any) => table.table === this.selectedTableName); @@ -389,7 +390,7 @@ export class DashboardComponent implements OnInit, OnDestroy { }); } - getRows(search?: string) { + getRows(search?: string, uncached?: boolean) { console.log('getRows, filters:', this.filters); this._uiSettings.getUiSettings().subscribe((settings: UiSettings) => { this.uiSettings = settings?.connections[this.connectionID]; @@ -404,6 +405,7 @@ export class DashboardComponent implements OnInit, OnDestroy { sortOrder: this.sortOrder, filters: this.filters, search, + uncached, }); }); } diff --git a/frontend/src/app/components/dashboard/db-tables-data-source.ts b/frontend/src/app/components/dashboard/db-tables-data-source.ts index 59422650c..fad0e2476 100644 --- a/frontend/src/app/components/dashboard/db-tables-data-source.ts +++ b/frontend/src/app/components/dashboard/db-tables-data-source.ts @@ -31,6 +31,7 @@ interface RowsParams { comparators?: object; search?: string; isTablePageSwitched?: boolean; + uncached?: boolean; } export class TablesDataSource implements DataSource { @@ -118,6 +119,7 @@ export class TablesDataSource implements DataSource { comparators, search, isTablePageSwitched, + uncached, }: RowsParams) { this.loadingSubject.next(true); this.alert_primaryKeysInfo = null; @@ -135,6 +137,7 @@ export class TablesDataSource implements DataSource { filters, comparators, search, + uncached, }); if (fetchedTable) { diff --git a/frontend/src/app/components/edit-database-schema/edit-database-schema.component.html b/frontend/src/app/components/edit-database-schema/edit-database-schema.component.html index a93733d90..0f57b441f 100644 --- a/frontend/src/app/components/edit-database-schema/edit-database-schema.component.html +++ b/frontend/src/app/components/edit-database-schema/edit-database-schema.component.html @@ -156,6 +156,7 @@

{{ message.text }}