<commit_before>define([
	"dijit/form/FilteringSelect","dojo/_base/declare",
	"dojo/store/JsonRest","dojo/dom-construct","dijit/TooltipDialog",
	"dojo/on","dijit/popup","dojo/_base/lang","dojo/dom-construct",
	"dijit/form/Checkbox","dojo/string","dojo/when","dijit/form/_AutoCompleterMixin"
], function(
	FilteringSelect, declare, 
	Store,domConstr,TooltipDialog,
	on,popup,lang,domConstr,Checkbox,
	string,when,AutoCompleterMixin
){
	
	return declare([FilteringSelect,AutoCompleterMixin], {
		apiServiceUrl: window.App.dataAPI,
		promptMessage:'Genome name.',
		missingMessage:'Specify genome name.',
		placeHolder:'e.g. Mycobacterium tuberculosis H37Rv',
		searchAttr: "genome_name",
		queryExpr: "*${0}*",
		queryFilter: "",
		includePrivate: true,
		includePublic: true,	
		pageSize: 25,
		highlightMatch: "all",
		autoComplete: false,
		store: null,
		labelType:'html',
		constructor: function(){
			var _self=this;
			if (!this.store){
				
				this.store = new Store({target: this.apiServiceUrl + "/genome/", idProperty: "genome_id", headers: {accept: "application/json","Authorization":(window.App.authorizationToken||"")}});

			}

			var orig = this.store.query;
			this.store.query = lang.hitch(this.store, function(query,options){
				console.log("query: ", query);
				console.log("Store Headers: ", _self.store.headers);
				var q = "?eq(" + _self.searchAttr + "," + query[_self.searchAttr] + ")";
				if (_self.queryFilter) {
					q+=_self.queryFilter
				}
				console.log("Q: ", q);
				return orig.apply(_self.store,[q,options]);
			});	
		},

		_setIncludePublicAttr: function(val){
			this.includePublic = val;
			if (this.includePublic && this.includePrivate){
				this.queryFilter = "";
			}else if (this.includePublic && !this.includePrivate){
				this.queryFilter="&eq(public,true)"	<commit_msg>allow only needed fields to return for GenomeNameSelector<commit_after>define([
	"dijit/form/FilteringSelect","dojo/_base/declare",
	"dojo/store/JsonRest","dojo/dom-construct","dijit/TooltipDialog",
	"dojo/on","dijit/popup","dojo/_base/lang","dojo/dom-construct",
	"dijit/form/Checkbox","dojo/string","dojo/when","dijit/form/_AutoCompleterMixin"
], function(
	FilteringSelect, declare, 
	Store,domConstr,TooltipDialog,
	on,popup,lang,domConstr,Checkbox,
	string,when,AutoCompleterMixin
){
	
	return declare([FilteringSelect,AutoCompleterMixin], {
		apiServiceUrl: window.App.dataAPI,
		promptMessage:'Genome name.',
		missingMessage:'Specify genome name.',
		placeHolder:'e.g. Mycobacterium tuberculosis H37Rv',
		searchAttr: "genome_name",
		queryExpr: "*${0}*",
		queryFilter: "",
		resultFields: ["genome_id","genome_name", "strain", "public", "owner"],
		includePrivate: true,
		includePublic: true,	
		pageSize: 25,
		highlightMatch: "all",
		autoComplete: false,
		store: null,
		labelType:'html',
		constructor: function(){
			var _self=this;
			if (!this.store){
				
				this.store = new Store({target: this.apiServiceUrl + "/genome/", idProperty: "genome_id", headers: {accept: "application/json","Authorization":(window.App.authorizationToken||"")}});

			}

			var orig = this.store.query;
			this.store.query = lang.hitch(this.store, function(query,options){
				console.log("query: ", query);
				console.log("Store Headers: ", _self.store.headers);
				var q = "?eq(" + _self.searchAttr + "," + query[_self.searchAttr] + ")";
				if (_self.queryFilter) {
					q+=_self.queryFilter
				}

				if (_self.resultFields && _self.resultFields.length>0) {
					q += "&select(" + _self.resultFields.join(",") + ")";
				}
				console.log("Q: ", q);
				return orig.apply(_self.store,[q,options]);
			});	
		},

		_setIncludePublicAttr: function(val){
			this.includePublic = val;
			if (this.includePublic && this.includePrivate){
				this.queryFilter = "";
			}else if (this.includePublic && !this.includePrivate){
				this.queryFilter="&eq(public,true)"	
{'fraction_non_alphanumeric': 0.1723782530275702, 'fraction_numerical': 0.0028343210512754443, 'mean_word_length': 4.837593984962406, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 4, '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': '5819157', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1311, 'n_words': 206}