<commit_before>var listToArray = require('list-to-array');
var Store = require('store-prototype');
var utils = require('../utils');
var xhr = require('xhr');

var _list = Keystone.list;
var _ready = false;
var _loading = false;
var _items = {};

var available = {
	columns: _list.uiElements.map((col,i) => {
		if (col.type === 'heading') {
			return { type: 'heading', label: col.content };
		} else {
			var field = _list.fields[col.field];
			return field ? { type: 'field', field: field, title: field.label, path: field.path } : null;
		}
	}).map(i => i),
	filters: []
};

var active = {
	columns: expandColumns(_list.defaultColumns),
	filters: [],
	search: ''
};

function getFilters () {
	var filters = {};
	active.filters.forEach((filter) => {
		filters[filter.field.path] = filter.value;
	});
	return filters;
}

function buildQueryString () {
	var parts = [];
	parts.push(active.search ? 'search=' + active.search : '');
	parts.push(active.filters.length ? 'filters=' + JSON.stringify(getFilters()) : '');
	parts.push('select=' + active.columns.map(i => i.path).join(','));
	return '?' + parts.filter(i => i).join('&');
}

function expandColumns (input) {
	var nameIncluded = false;
	var cols = listToArray(input).map(i => {
		var split = i.split('|');
		var path = split[0];
		var width = split[1] || 'auto';
		if (path === '__name__') {
			path = _list.namePath;
		}
		if (path === _list.namePath) {
			nameIncluded = true;
		}
		var field = _list.fields[path];
		if (!field) {
			// TODO: Support arbitary document paths
			console.log('Invalid Column specified: ', i);
			return;
		}
		return {
			field: field,
			type: field.type,
			label: field.label,
			path: field.path<commit_msg>highlight "Invalid Column" warning in console<commit_after>var listToArray = require('list-to-array');
var Store = require('store-prototype');
var utils = require('../utils');
var xhr = require('xhr');

var _list = Keystone.list;
var _ready = false;
var _loading = false;
var _items = {};

var available = {
	columns: _list.uiElements.map((col,i) => {
		if (col.type === 'heading') {
			return { type: 'heading', label: col.content };
		} else {
			var field = _list.fields[col.field];
			return field ? { type: 'field', field: field, title: field.label, path: field.path } : null;
		}
	}).map(i => i),
	filters: []
};

var active = {
	columns: expandColumns(_list.defaultColumns),
	filters: [],
	search: ''
};

function getFilters () {
	var filters = {};
	active.filters.forEach((filter) => {
		filters[filter.field.path] = filter.value;
	});
	return filters;
}

function buildQueryString () {
	var parts = [];
	parts.push(active.search ? 'search=' + active.search : '');
	parts.push(active.filters.length ? 'filters=' + JSON.stringify(getFilters()) : '');
	parts.push('select=' + active.columns.map(i => i.path).join(','));
	return '?' + parts.filter(i => i).join('&');
}

function expandColumns (input) {
	var nameIncluded = false;
	var cols = listToArray(input).map(i => {
		var split = i.split('|');
		var path = split[0];
		var width = split[1] || 'auto';
		if (path === '__name__') {
			path = _list.namePath;
		}
		if (path === _list.namePath) {
			nameIncluded = true;
		}
		var field = _list.fields[path];
		if (!field) {
			// TODO: Support arbitary document paths
			console.warn('Invalid Column specified:', i);
			return;
		}
		return {
			field: field,
			type: field.type,
			label: field.label,
			path: field.path
{'fraction_non_alphanumeric': 0.18775510204081633, 'fraction_numerical': 0.0011661807580174927, 'mean_word_length': 3.7986013986013987, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '4721810', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1181, 'n_words': 278}