<commit_before>var solvers = [
        
        {"abbr":"SPECFEM3D_CARTESIAN_21447","name":"SPECFEM3D_CARTESIAN_21447"},
    ];

Ext.define("SolversCombo", {
	extend: "Ext.data.Model",
    fields: [
             {type: 'string', name: 'abbr'},
             {type: 'string', name: 'name'}
         ]});

Ext.define("MeshesModel", {
	extend: "Ext.data.Model",
	fields: [
	         {type: 'string', name: 'name'},
	         {type: 'long', name: 'geo_minLat'},
	         {type: 'long', name: 'geo_maxLat'},
	         {type: 'long', name: 'geo_minLon'},
	         {type: 'long', name: 'geo_maxLon'},
	         {type: 'string', name: 'geo_proj'},
	         {type: 'array', name: 'velmod'},
	         {type: 'array', name: 'values'}
	     ]});

var solverstore = Ext.create('Ext.data.Store', {
    model: 'SolversCombo',
    data: solvers
});

var meshesstore = Ext.create('Ext.data.Store', {
    model: 'MeshesModel',
});

var velocitystore = Ext.create('Ext.data.Store', {
	 fields: ['name']
});

// ComboBox with multiple selection enabled
var solvercombo = Ext.create('Ext.form.field.ComboBox', {
    fieldLabel: 'Solvers',
    name: 'solvertype',
    id: 'solvertype',
    displayField: 'abbr',
    store: solverstore,
    queryMode: 'local',
    getInnerTpl: function() {
        return '<div data-qtip="{abbr}">{abbr} {name}</div>';
    },
    listeners:{
         scope: this,
         'beforeselect': function(combo, record, index)
         {   
        	if(gl_mesh!=null){        	
	     		Ext.Msg.confirm('Alert!', 'You will lose the introduced data for '+combo.getValue()+', do you want to continue?', 
	                  function(btn) {
	                  	if(btn === 'no')
	                  	{	
                        return false;
	                  	}
	            });
        	}
        	else
        	{
            	selectSolver(record.get('abbr'));
            	return true;
        	}
     	 },
       'change': function(combo, newValue, oldValue, eOpts) {
            // inconsistent use of name and abbr
            var record = combo.store.findRecord('abbr', newValue);

            clearMap();
            meshescombo.clearValue();
            meshescombo.store.removeAll();

            if (record == null) {
              return;
            }
            //Load meshescombo, load conf form
            selectSolver(record.get('abbr'));
        },
    }
});

var meshescombo = Ext.create('Ext.form.field.ComboBox', {
    fieldLabel: 'Meshes',
    name: 'meshes',
    id: 'meshes',
    displayField: 'name',
    store: meshesstore,
    queryMode: 'local',
    listeners:{
         scope: this,
         'load' : function(combo){},
         'change': function(combo)
         {   
        	 gl_mesh = combo.getValue();
        	 if(gl_mesh == null)
        	 {
             return;
           }
           
      		 clearMap();
        	 var meshModel = combo.store.findRecord('name', gl_mesh);
        	 	        	 
        	 //Populate the VelocityModel Combo
           velocitycombo.store.removeAll();
        	 velocitycombo.store.add(meshModel.get('velmod'));	

        	 //Update the solver values
        	 updateSolverValues(meshModel.get('values'));
        	 
        	 //Render the bounding box in the map and center it
        	 gl_minLat = meshModel.get('geo_minLat');<commit_msg>Fix clearing of velocity model select upon change in mesh select<commit_after>var solvers = [
        
        {"abbr":"SPECFEM3D_CARTESIAN_21447","name":"SPECFEM3D_CARTESIAN_21447"},
    ];

Ext.define("SolversCombo", {
	extend: "Ext.data.Model",
    fields: [
             {type: 'string', name: 'abbr'},
             {type: 'string', name: 'name'}
         ]});

Ext.define("MeshesModel", {
	extend: "Ext.data.Model",
	fields: [
	         {type: 'string', name: 'name'},
	         {type: 'long', name: 'geo_minLat'},
	         {type: 'long', name: 'geo_maxLat'},
	         {type: 'long', name: 'geo_minLon'},
	         {type: 'long', name: 'geo_maxLon'},
	         {type: 'string', name: 'geo_proj'},
	         {type: 'array', name: 'velmod'},
	         {type: 'array', name: 'values'}
	     ]});

var solverstore = Ext.create('Ext.data.Store', {
    model: 'SolversCombo',
    data: solvers
});

var meshesstore = Ext.create('Ext.data.Store', {
    model: 'MeshesModel',
});

var velocitystore = Ext.create('Ext.data.Store', {
	 fields: ['name']
});

// ComboBox with multiple selection enabled
var solvercombo = Ext.create('Ext.form.field.ComboBox', {
    fieldLabel: 'Solvers',
    name: 'solvertype',
    id: 'solvertype',
    displayField: 'abbr',
    store: solverstore,
    queryMode: 'local',
    getInnerTpl: function() {
        return '<div data-qtip="{abbr}">{abbr} {name}</div>';
    },
    listeners:{
         scope: this,
         'beforeselect': function(combo, record, index)
         {   
        	if(gl_mesh!=null){        	
	     		Ext.Msg.confirm('Alert!', 'You will lose the introduced data for '+combo.getValue()+', do you want to continue?', 
	                  function(btn) {
	                  	if(btn === 'no')
	                  	{	
                        return false;
	                  	}
	            });
        	}
        	else
        	{
            	selectSolver(record.get('abbr'));
            	return true;
        	}
     	 },
       'change': function(combo, newValue, oldValue, eOpts) {
            // inconsistent use of name and abbr
            var record = combo.store.findRecord('abbr', newValue);

            clearMap();
            meshescombo.clearValue();
            meshescombo.store.removeAll();

            if (record == null) {
              return;
            }
            //Load meshescombo, load conf form
            selectSolver(record.get('abbr'));
        },
    }
});

var meshescombo = Ext.create('Ext.form.field.ComboBox', {
    fieldLabel: 'Meshes',
    name: 'meshes',
    id: 'meshes',
    displayField: 'name',
    store: meshesstore,
    queryMode: 'local',
    listeners:{
         scope: this,
         'load' : function(combo){},
         'change': function(combo)
         {   
        	 gl_mesh = combo.getValue();
        	 if(gl_mesh == null)
        	 {
             return;
           }
           
      		 clearMap();
        	 var meshModel = combo.store.findRecord('name', gl_mesh);
        	 	        	 
        	 //Populate the VelocityModel Combo
           velocitycombo.clearValue();
           velocitycombo.store.removeAll();
        	 velocitycombo.store.add(meshModel.get('velmod'));	

        	 //Update the solver values
        	 updateSolverValues(meshModel.get('values'));
        	 
        	 //Render the bounding box in the map and center it
        	 gl_minLat = meshModel.get('geo_minLat');
{'fraction_non_alphanumeric': 0.1480047647409172, 'fraction_numerical': 0.00357355568790947, 'mean_word_length': 1.831787521079258, 'pattern_counts': {'":': 4, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5665070', 'n_tokens_mistral': 2174, 'n_tokens_neox': 2073, 'n_words': 426}