@@ -176,6 +176,52 @@ Ext4.define('JBrowse.window.ModifyJsonConfigWindow', {
176176 } ) ;
177177
178178 this . callParent ( arguments ) ;
179+
180+ if ( this . jsonFiles . length === 1 ) {
181+ Ext4 . Msg . wait ( 'Loading...' ) ;
182+ LABKEY . Query . selectRows ( {
183+ schemaName : 'jbrowse' ,
184+ queryName : 'jsonfiles' ,
185+ filterArray : [
186+ LABKEY . Filter . create ( 'objectid' , this . jsonFiles . join ( ';' ) , LABKEY . Filter . Types . EQUALS_ONE_OF )
187+ ] ,
188+ columns : 'objectid,trackjson' ,
189+ scope : this ,
190+ success : this . onSelectLoad ,
191+ failure : LDK . Utils . getErrorCallback ( )
192+ } ) ;
193+ }
194+ } ,
195+
196+ onSelectLoad : function ( results ) {
197+ Ext4 . Msg . hide ( ) ;
198+ if ( results . rows && results . rows . length ) {
199+ if ( ! results . rows [ 0 ] . trackJson ) {
200+ return ;
201+ }
202+
203+ var json = JSON . parse ( results . rows [ 0 ] . trackJson ) ;
204+ var store = this . down ( 'ldk-gridpanel' ) . store ;
205+ for ( var attribute in json ) {
206+ var val = json [ attribute ] ;
207+ var dataType = 'STRING' ;
208+ if ( typeof val === 'number' && ! isNaN ( val ) ) {
209+ dataType = Number . isInteger ( val ) ? 'INT' : 'FLOAT' ;
210+ }
211+ else if ( typeof val === 'string' ) {
212+ dataType = 'STRING' ;
213+ }
214+ else if ( typeof val === 'boolean' ) {
215+ dataType = 'BOOLEAN' ;
216+ }
217+
218+ store . add ( store . createModel ( {
219+ attribute : attribute ,
220+ value : val ,
221+ dataType : dataType
222+ } ) ) ;
223+ }
224+ }
179225 } ,
180226
181227 addAttribute : function ( attribute , value , dataType ) {
0 commit comments