@@ -38,6 +38,11 @@ export default {
3838 propDefinition : [
3939 app ,
4040 "table" ,
41+ ( c ) => ( {
42+ endpoint : c . endpoint ,
43+ database : c . database ,
44+ branch : c . branch ,
45+ } ) ,
4146 ] ,
4247 reloadProps : true ,
4348 } ,
@@ -53,24 +58,19 @@ export default {
5358 const description = "The keys and values of the data that will be recorded in the database." ;
5459
5560 if ( endpoint && database && branch && table ) {
56- try {
57- const { columns } = await this . app . listColumns ( {
58- endpoint,
59- database,
60- branch,
61- table,
62- } ) ;
63- if ( columns ?. length ) {
64- let descriptionWithColumns = `${ description } Available Columns:` ;
65- for ( const column of columns ) {
66- descriptionWithColumns += ` \`${ column . name } \`` ;
67- }
68- props . recordData . description = descriptionWithColumns ;
69- return { } ;
61+ const { columns } = await this . app . listColumns ( {
62+ endpoint,
63+ database,
64+ branch,
65+ table,
66+ } ) ;
67+ if ( columns ?. length ) {
68+ let descriptionWithColumns = `${ description } Available Columns:` ;
69+ for ( const column of columns ) {
70+ descriptionWithColumns += ` \`${ column . name } \`` ;
7071 }
71- } catch ( e ) {
72- props . recordData . description = description ;
73- // Columns not found. Occurs when the user hasn't finished entering the table name
72+ props . recordData . description = descriptionWithColumns ;
73+ return { } ;
7474 }
7575 }
7676 props . recordData . description = description ;
@@ -89,12 +89,18 @@ export default {
8989 return this . recordData ;
9090 }
9191 for ( const column of columns ) {
92- if ( recordData [ column . name ] && ( column . type === "int" || column . type === "float" ) ) {
92+ if ( ! recordData [ column . name ] || typeof recordData [ column . name ] !== "string" ) {
93+ continue ;
94+ }
95+ if ( ( column . type === "int" || column . type === "float" ) ) {
9396 recordData [ column . name ] = + recordData [ column . name ] ;
9497 }
95- if ( recordData [ column . name ] && column . type === "bool" ) {
98+ if ( column . type === "bool" ) {
9699 recordData [ column . name ] = ! ( recordData [ column . name ] === "false" || recordData [ column . name === "0" ] ) ;
97100 }
101+ if ( column . type === "multiple" || column . type === "vector" ) {
102+ recordData [ column . name ] = JSON . parse ( recordData [ column . name ] ) ;
103+ }
98104 }
99105 return recordData ;
100106 } ,
0 commit comments