@@ -34,54 +34,76 @@ import { MatSort } from '@angular/material/sort';
3434import { MatSortModule } from '@angular/material/sort' ;
3535import { MatTableModule } from '@angular/material/table' ;
3636import { MatTooltipModule } from '@angular/material/tooltip' ;
37+ import { ActivatedRoute , Router , RouterModule } from '@angular/router' ;
38+ import JsonURL from '@jsonurl/jsonurl' ;
39+ import { Angulartics2OnModule } from 'angulartics2' ;
40+ import * as JSON5 from 'json5' ;
41+ import { DynamicModule } from 'ng-dynamic-component' ;
42+ import { merge } from 'rxjs' ;
43+ import { tap } from 'rxjs/operators' ;
44+ import { formatFieldValue } from 'src/app/lib/format-field-value' ;
45+ import { getTableTypes } from 'src/app/lib/setup-table-row-structure' ;
46+ import {
47+ CustomAction ,
48+ TableForeignKey ,
49+ TablePermissions ,
50+ TableProperties ,
51+ TableRow ,
52+ Widget ,
53+ } from 'src/app/models/table' ;
54+ import { AccessLevel } from 'src/app/models/user' ;
55+ import { ConnectionsService } from 'src/app/services/connections.service' ;
3756import { NotificationsService } from 'src/app/services/notifications.service' ;
3857import { PlaceholderTableDataComponent } from '../../skeletons/placeholder-table-data/placeholder-table-data.component' ;
3958import { RouterModule } from '@angular/router' ;
4059import { SavedFiltersPanelComponent } from './saved-filters-panel/saved-filters-panel.component' ;
4160import { SelectionModel } from '@angular/cdk/collections' ;
4261import { TableRowService } from 'src/app/services/table-row.service' ;
4362import { TableStateService } from 'src/app/services/table-state.service' ;
44- import { formatFieldValue } from 'src/app/lib/format-field-value' ;
45- import { getTableTypes } from 'src/app/lib/setup-table-row-structure' ;
46- import { merge } from 'rxjs' ;
47- import { normalizeTableName } from '../../../lib/normalize'
48- import { tap } from 'rxjs/operators' ;
63+ import { tableDisplayTypes , UIwidgets } from '../../../consts/table-display-types' ;
64+ import { normalizeTableName } from '../../../lib/normalize' ;
65+ import { PlaceholderTableDataComponent } from '../../skeletons/placeholder-table-data/placeholder-table-data.component' ;
66+ import { ForeignKeyDisplayComponent } from '../../ui-components/table-display-fields/foreign-key/foreign-key.component' ;
67+ import { DbTableExportDialogComponent } from './db-table-export-dialog/db-table-export-dialog.component' ;
68+ import { DbTableImportDialogComponent } from './db-table-import-dialog/db-table-import-dialog.component' ;
69+ import { SavedFiltersPanelComponent } from './saved-filters-panel/saved-filters-panel.component' ;
4970
5071interface Column {
5172 title : string ,
5273 selected : boolean
5374}
5475
5576@Component ( {
56- selector : 'app-db-table-view' ,
57- templateUrl : './db-table-view.component.html' ,
58- styleUrls : [ './db-table-view.component.css' ] ,
59- imports : [
60- CommonModule ,
61- FormsModule ,
62- RouterModule ,
63- MatTableModule ,
64- MatPaginatorModule ,
65- MatSortModule ,
66- MatButtonModule ,
67- MatIconModule ,
68- MatCheckboxModule ,
69- MatChipsModule ,
70- MatDialogModule ,
71- MatFormFieldModule ,
72- ReactiveFormsModule ,
73- MatInputModule ,
74- MatAutocompleteModule ,
75- MatMenuModule ,
76- MatTooltipModule ,
77- ClipboardModule ,
78- DragDropModule ,
79- Angulartics2OnModule ,
80- PlaceholderTableDataComponent ,
81- DynamicModule ,
82- ForeignKeyDisplayComponent ,
83- SavedFiltersPanelComponent
84- ]
77+ selector : 'app-db-table-view' ,
78+ templateUrl : './db-table-view.component.html' ,
79+ styleUrls : [ './db-table-view.component.css' ] ,
80+ imports : [
81+ CommonModule ,
82+ FormsModule ,
83+ RouterModule ,
84+ MatTableModule ,
85+ MatPaginatorModule ,
86+ MatSortModule ,
87+ MatButtonModule ,
88+ MatIconModule ,
89+ MatCheckboxModule ,
90+ MatChipsModule ,
91+ MatDialogModule ,
92+ MatFormFieldModule ,
93+ ReactiveFormsModule ,
94+ MatInputModule ,
95+ MatAutocompleteModule ,
96+ MatSelectModule ,
97+ MatMenuModule ,
98+ MatTooltipModule ,
99+ ClipboardModule ,
100+ DragDropModule ,
101+ Angulartics2OnModule ,
102+ PlaceholderTableDataComponent ,
103+ DynamicModule ,
104+ ForeignKeyDisplayComponent ,
105+ SavedFiltersPanelComponent ,
106+ ] ,
85107} )
86108
87109export class DbTableViewComponent implements OnInit {
@@ -110,31 +132,31 @@ export class DbTableViewComponent implements OnInit {
110132
111133 @Output ( ) applyFilter = new EventEmitter ( ) ;
112134
113- // public tablesSwitchControl = new FormControl('');
114- public tableData : any ;
115- public filteredTables : TableProperties [ ] ;
116- // public selection: any;
117- public columns : Column [ ] ;
118- public displayedColumns : string [ ] = [ ] ;
119- public columnsToDisplay : string [ ] = [ ] ;
120- public searchString : string ;
121- public staticSearchString : string ;
122- public actionsColumnWidth : string ;
123- public bulkActions : CustomAction [ ] ;
124- public bulkRows : string [ ] ;
125- public displayedComparators = {
126- eq : "=" ,
127- gt : ">" ,
128- lt : "<" ,
129- gte : ">=" ,
130- lte : "<="
131- }
132- public selectedRow : TableRow = null ;
133- public selectedRowType : 'record' | 'foreignKey' = 'record' ;
134- public tableRelatedRecords : any = null ;
135- public displayCellComponents ;
136- public UIwidgets = UIwidgets ;
137- // public tableTypes: object;
135+ // public tablesSwitchControl = new FormControl('');
136+ public tableData : any ;
137+ public filteredTables : TableProperties [ ] ;
138+ // public selection: any;
139+ public columns : Column [ ] ;
140+ public displayedColumns : string [ ] = [ ] ;
141+ public columnsToDisplay : string [ ] = [ ] ;
142+ public searchString : string ;
143+ public staticSearchString : string ;
144+ public actionsColumnWidth : string ;
145+ public bulkActions : CustomAction [ ] ;
146+ public bulkRows : string [ ] ;
147+ public displayedComparators = {
148+ eq : '=' ,
149+ gt : '>' ,
150+ lt : '<' ,
151+ gte : '>=' ,
152+ lte : '<=' ,
153+ } ;
154+ public selectedRow : TableRow = null ;
155+ public selectedRowType : 'record' | 'foreignKey' = 'record' ;
156+ public tableRelatedRecords : any = null ;
157+ public displayCellComponents ;
158+ public UIwidgets = UIwidgets ;
159+ // public tableTypes: object;
138160
139161 @Input ( ) set table ( value ) {
140162 if ( value ) this . tableData = value ;
@@ -628,10 +650,10 @@ export class DbTableViewComponent implements OnInit {
628650 const blob = new Blob ( [ csvArray ] , { type : 'text/csv' } ) ;
629651 const url = window . URL . createObjectURL ( blob ) ;
630652
631- a . href = url ;
632- a . download = 'myFile.csv' ;
633- a . click ( ) ;
634- window . URL . revokeObjectURL ( url ) ;
635- a . remove ( ) ;
636- }
653+ a . href = url ;
654+ a . download = 'myFile.csv' ;
655+ a . click ( ) ;
656+ window . URL . revokeObjectURL ( url ) ;
657+ a . remove ( ) ;
658+ }
637659}
0 commit comments