-
-
Notifications
You must be signed in to change notification settings - Fork 18
Fix table drag n drop #1629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix table drag n drop #1629
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,6 +143,14 @@ export class DbTablesListComponent implements OnInit, OnChanges { | |
| }); | ||
| } | ||
|
|
||
| // If no custom folders exist, always keep "All tables" expanded | ||
| if (!this.hasCustomFolders()) { | ||
| const allTablesFolder = this.folders.find(folder => folder.id === 'all-tables-kitten'); | ||
| if (allTablesFolder) { | ||
| allTablesFolder.expanded = true; | ||
| } | ||
|
Comment on lines
+146
to
+151
|
||
| } | ||
|
|
||
| console.log('ngOnInit - showCollapsedTableList initialized to:', this.showCollapsedTableList); | ||
| } | ||
|
|
||
|
|
@@ -234,6 +242,10 @@ export class DbTablesListComponent implements OnInit, OnChanges { | |
| toggleFolder(folderId: string) { | ||
| const folder = this.folders.find (f => f.id === folderId); | ||
| if (folder) { | ||
| // Prevent collapsing "All tables" when no custom folders exist | ||
| if (folder.id === 'all-tables-kitten' && folder.expanded && !this.hasCustomFolders()) { | ||
| return; | ||
| } | ||
| folder.expanded = !folder.expanded; | ||
|
Comment on lines
+245
to
249
|
||
| const expandedFolders = this.folders.filter(f => f.expanded).map(f => f.id); | ||
| this._uiSettingsService.updateConnectionSetting(this.connectionID, 'tableFoldersExpanded', expandedFolders); | ||
|
|
@@ -443,8 +455,8 @@ export class DbTablesListComponent implements OnInit, OnChanges { | |
| } | ||
|
|
||
| hasCustomFolders(): boolean { | ||
| // Check if there are folders other than "All Tables" | ||
| return this.folders.some(folder => folder.name !== 'All Tables'); | ||
| // Check if there are folders other than "All tables" | ||
| return this.folders.some(folder => folder.id !== 'all-tables-kitten'); | ||
| } | ||
|
|
||
| private preserveFolderStates() { | ||
|
|
@@ -453,12 +465,9 @@ export class DbTablesListComponent implements OnInit, OnChanges { | |
| this.preservedFolderStates[folder.id] = folder.expanded; | ||
| }); | ||
|
|
||
| // Check if there are only "All Tables" folder (no custom folders) | ||
| const hasCustomFolders = this.folders.some(folder => folder.name !== 'All Tables'); | ||
|
|
||
| // If no custom folders exist, ensure "All Tables" is always expanded | ||
| if (!hasCustomFolders) { | ||
| const allTablesFolder = this.folders.find(folder => folder.name === 'All Tables'); | ||
| // If no custom folders exist, ensure "All tables" is always expanded | ||
| if (!this.hasCustomFolders()) { | ||
| const allTablesFolder = this.folders.find(folder => folder.id === 'all-tables-kitten'); | ||
| if (allTablesFolder) { | ||
| this.preservedFolderStates[allTablesFolder.id] = true; | ||
| this.preservedActiveFolder = allTablesFolder.id; | ||
|
|
@@ -471,12 +480,9 @@ export class DbTablesListComponent implements OnInit, OnChanges { | |
| } | ||
|
|
||
| private restoreFolderStates() { | ||
| // Check if there are only "All Tables" folder (no custom folders) | ||
| const hasCustomFolders = this.folders.some(folder => folder.name !== 'All Tables'); | ||
|
|
||
| // If no custom folders exist, always expand "All Tables" | ||
| if (!hasCustomFolders) { | ||
| const allTablesFolder = this.folders.find(folder => folder.name === 'All Tables'); | ||
| // If no custom folders exist, always expand "All tables" | ||
| if (!this.hasCustomFolders()) { | ||
| const allTablesFolder = this.folders.find(folder => folder.id === 'all-tables-kitten'); | ||
| if (allTablesFolder) { | ||
| allTablesFolder.expanded = true; | ||
| this.currentCollapsedFolder = allTablesFolder; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drag/drop is now gated in the template via
accessLevel === 'edit', but the underlying handlers (e.g., drop/dragover) still mutate folder state and callsaveFolders()without checking permissions. Add an early return in the component methods whenaccessLevel !== 'edit'so the permission rule is enforced even if these handlers are invoked from another template change, a test harness, or programmatically.