Skip to content

Fix table drag n drop#1629

Merged
lyubov-voloshko merged 3 commits intomainfrom
fix-table-drag-n-drop
Feb 24, 2026
Merged

Fix table drag n drop#1629
lyubov-voloshko merged 3 commits intomainfrom
fix-table-drag-n-drop

Conversation

@lyubov-voloshko
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings February 24, 2026 15:25
@lyubov-voloshko lyubov-voloshko merged commit 076c02c into main Feb 24, 2026
13 of 15 checks passed
@lyubov-voloshko lyubov-voloshko deleted the fix-table-drag-n-drop branch February 24, 2026 15:28
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

Updates the dashboard tables sidebar to improve drag-and-drop behavior and make the “All tables” folder behave consistently when it’s the only folder.

Changes:

  • Force the “All tables” folder to remain expanded when no custom folders exist, including during state preserve/restore.
  • Prevent collapsing “All tables” when it’s the only folder.
  • Disable table/folder drag-and-drop interactions for non-edit access levels and hide the expand icon when collapsing isn’t allowed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
frontend/src/app/components/dashboard/db-tables-list/db-tables-list.component.ts Adds logic to keep “All tables” expanded and prevents collapsing it when it’s the only folder; updates custom-folder detection to use the folder id.
frontend/src/app/components/dashboard/db-tables-list/db-tables-list.component.html Gates drag/drop handlers and draggable state by access level; conditionally hides the expand/collapse icon for “All tables”.

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

Comment on lines +146 to +151
// 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;
}
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

The special folder id 'all-tables-kitten' is now referenced in several places (ngOnInit, toggleFolder, hasCustomFolders, preserve/restore). Consider extracting it into a single constant (e.g., readonly field) to avoid accidental mismatches and make future refactors safer.

Copilot uses AI. Check for mistakes.
Comment on lines +98 to +101
[class.drag-over]="accessLevel === 'edit' && dragOverFolder !== 'all-tables-kitten' && dragOverFolder === folder.id"
(dragover)="accessLevel === 'edit' && onFolderDragOver($event, folder.id)"
(dragleave)="accessLevel === 'edit' && onFolderDragLeave($event, folder.id)"
(drop)="accessLevel === 'edit' && onFolderDrop($event, folder)">
Copy link

Copilot AI Feb 24, 2026

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 call saveFolders() without checking permissions. Add an early return in the component methods when accessLevel !== 'edit' so the permission rule is enforced even if these handlers are invoked from another template change, a test harness, or programmatically.

Copilot uses AI. Check for mistakes.
Comment on lines +245 to 249
// Prevent collapsing "All tables" when no custom folders exist
if (folder.id === 'all-tables-kitten' && folder.expanded && !this.hasCustomFolders()) {
return;
}
folder.expanded = !folder.expanded;
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

This change introduces new behavior around folder expansion (forcing “All tables” expanded when it’s the only folder, and preventing collapse in toggleFolder). Please add/update unit tests to cover these cases so regressions in sidebar state preservation and custom-folder detection are caught.

Copilot uses AI. Check for mistakes.
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