@@ -49,7 +49,7 @@ class ProjectAPI extends ProjectView {
4949 const actualFields = fields
5050 . filter ( ( field ) => ! projectsMetadataColumns . contains ( field . name ) ) ;
5151
52- if ( currentColumnsLength !== actualFields . length ) {
52+ if ( currentColumnsLength < actualFields . length ) {
5353 const newColumns : Record < string , DatabaseColumn > = { } ;
5454 actualFields . forEach ( ( field , index ) => {
5555 const { name, type } = field ;
@@ -59,7 +59,7 @@ class ProjectAPI extends ProjectView {
5959 *
6060 * Could we add the config to the data object? I can manage a map of views with that
6161 */
62- const inputType = this . mapperTypeToInputType ( type ) ;
62+ const inputType = this . projectsTypeToPluginTypeMapper ( type ) ;
6363 const key = dbTrim ( name ) ;
6464 const newColumn : DatabaseColumn = {
6565 input : inputType ,
@@ -114,10 +114,14 @@ class ProjectAPI extends ProjectView {
114114 async onClose ( ) {
115115 this . view . destroy ( ) ;
116116 this . view = null ;
117- this . enableAutoReload = false ;
118117 LOGGER . debug ( "Closing project view " , this . getDisplayName ( ) ) ;
119118 }
120119
120+ /**
121+ * Generate the local settings for the database
122+ * @param projectView
123+ * @returns
124+ */
121125 private generateLocalSettings ( projectView : ProjectViewProps ) : LocalSettings {
122126 const { project } = projectView ;
123127 const localSettings : LocalSettings = {
@@ -147,14 +151,14 @@ class ProjectAPI extends ProjectView {
147151 return localSettings ;
148152 }
149153
150- private mapperTypeToInputType ( type : string ) : string {
154+ /**
155+ * Maps the data type from the projects to the plugin data type
156+ * @param type
157+ * @returns
158+ */
159+ private projectsTypeToPluginTypeMapper ( type : string ) : string {
151160 let inputType = "" ;
152161 switch ( type ) {
153- case DataFieldType . String :
154- case DataFieldType . Link :
155- case DataFieldType . Unknown :
156- inputType = InputType . TEXT ;
157- break ;
158162 case DataFieldType . Number :
159163 inputType = InputType . NUMBER ;
160164 break ;
@@ -167,6 +171,10 @@ class ProjectAPI extends ProjectView {
167171 case DataFieldType . List :
168172 inputType = InputType . TAGS ;
169173 break ;
174+ // Default to text
175+ case DataFieldType . String :
176+ case DataFieldType . Link :
177+ case DataFieldType . Unknown :
170178 default :
171179 inputType = InputType . TEXT ;
172180 }
0 commit comments