@@ -18,6 +18,7 @@ import { DynamicModule } from 'ng-dynamic-component';
1818import { ForeignKeyDisplayComponent } from '../../ui-components/table-display-fields/foreign-key/foreign-key.component' ;
1919import JsonURL from "@jsonurl/jsonurl" ;
2020import { MatAutocompleteModule } from '@angular/material/autocomplete' ;
21+ import { MatSelectModule } from '@angular/material/select' ;
2122import { MatButtonModule } from '@angular/material/button' ;
2223import { MatCheckboxModule } from '@angular/material/checkbox' ;
2324import { MatChipsModule } from '@angular/material/chips' ;
@@ -51,6 +52,12 @@ interface Column {
5152 selected : boolean
5253}
5354
55+ export interface Folder {
56+ id : string ;
57+ name : string ;
58+ tableIds : string [ ] ;
59+ }
60+
5461@Component ( {
5562 selector : 'app-db-table-view' ,
5663 templateUrl : './db-table-view.component.html' ,
@@ -71,6 +78,7 @@ interface Column {
7178 ReactiveFormsModule ,
7279 MatInputModule ,
7380 MatAutocompleteModule ,
81+ MatSelectModule ,
7482 MatMenuModule ,
7583 MatTooltipModule ,
7684 ClipboardModule ,
@@ -95,6 +103,7 @@ export class DbTableViewComponent implements OnInit {
95103 @Input ( ) filterComparators : object ;
96104 @Input ( ) selection : SelectionModel < any > ;
97105 @Input ( ) tables : TableProperties [ ] ;
106+ @Input ( ) folders : Folder [ ] = [ ] ;
98107
99108 @Output ( ) openFilters = new EventEmitter ( ) ;
100109 @Output ( ) openPage = new EventEmitter ( ) ;
@@ -514,8 +523,24 @@ export class DbTableViewComponent implements OnInit {
514523 this . _notifications . showSuccessSnackbar ( message ) ;
515524 }
516525
517- switchTable ( _e ) {
526+ switchTable ( tableName : string ) {
527+ if ( tableName && tableName !== this . name ) {
528+ this . router . navigate ( [ `/dashboard/${ this . connectionID } /${ tableName } ` ] , {
529+ queryParams : { page_index : 0 , page_size : 30 }
530+ } ) ;
531+ }
532+ }
518533
534+ getFolderTables ( folder : Folder ) : TableProperties [ ] {
535+ return this . tables . filter ( table => folder . tableIds . includes ( table . table ) ) ;
536+ }
537+
538+ getUncategorizedTables ( ) : TableProperties [ ] {
539+ const categorizedTableIds = new Set < string > ( ) ;
540+ this . folders . forEach ( folder => {
541+ folder . tableIds . forEach ( id => categorizedTableIds . add ( id ) ) ;
542+ } ) ;
543+ return this . tables . filter ( table => ! categorizedTableIds . has ( table . table ) ) ;
519544 }
520545
521546 onFilterSelected ( $event ) {
0 commit comments