File tree Expand file tree Collapse file tree
frontend/src/app/components/dashboard/db-table-view/db-table-widgets Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -306,8 +306,8 @@ export class DbTableWidgetsComponent implements OnInit {
306306 addNewWidget ( ) {
307307 this . widgets . push ( {
308308 field_name : '' ,
309- widget_type : '' ,
310- widget_params : '' ,
309+ widget_type : 'Default ' ,
310+ widget_params : '// No settings required ' ,
311311 name : '' ,
312312 description : ''
313313 } ) ;
@@ -319,8 +319,6 @@ export class DbTableWidgetsComponent implements OnInit {
319319
320320 widgetTypeChange ( fieldName ) {
321321 let currentWidget = this . widgets . find ( widget => widget . field_name === fieldName ) ;
322-
323- if ( currentWidget . widget_type === 'Default' ) currentWidget . widget_type = '' ;
324322 currentWidget . widget_params = this . defaultParams [ currentWidget . widget_type || 'Default' ] ;
325323
326324 this . widgetParamsChange ( { fieldName : currentWidget . field_name , value : currentWidget . widget_params } ) ;
@@ -373,12 +371,20 @@ export class DbTableWidgetsComponent implements OnInit {
373371 . subscribe ( res => {
374372 const currentWidgetTypes = res . map ( ( widget : Widget ) => widget . field_name ) ;
375373 this . fields = difference ( this . fields , currentWidgetTypes ) ;
374+ res . forEach ( ( widget : Widget ) => {
375+ if ( widget . widget_type === '' ) widget . widget_type = 'Default' ;
376+ } )
376377 this . widgets = res ;
377378 } ) ;
378379 }
379380
380381 updateWidgets ( afterDeleteAll ?: boolean ) {
381382 this . submitting = true ;
383+
384+ this . widgets . forEach ( widget => {
385+ if ( widget . widget_type === 'Default' ) widget . widget_type = '' ;
386+ } ) ;
387+
382388 this . _tables . updateTableWidgets ( this . connectionID , this . tableName , this . widgets )
383389 . subscribe ( ( ) => {
384390 this . submitting = false ;
You can’t perform that action at this time.
0 commit comments