<commit_before>view = Backbone.View.extend();

view.prototype.events = {
    'click a[href=#back]': 'back',
    'click a.showall': 'showAll'
};

view.prototype.featureLimit = 100;

view.prototype.initialize = function(options) {
    this.render();
};

view.prototype.back = function() {
    $('.palette a[href=#layers]').click();
    return false;
};

view.prototype.render = function() {
    var features = this.model.get('features');
    this.$('.content').html(templates.Datasource({
        fields: this.model.get('fields'),
        features: _(features).first(this.featureLimit),
        more: _(features).size() > this.featureLimit
    }));
    return this;
};

view.prototype.showAll = function() {
    this.$('a.showall').hide();
    this.$('.content table tbody').append(templates.DatasourceRows({
        fields: this.model.get('fields'),
        features: _(this.model.get('features')).rest(this.featureLimit)
    }));
    return false;
}

<commit_msg>Limit feature inspection display to 50 columns. Refs #1120.<commit_after>view = Backbone.View.extend();

view.prototype.events = {
    'click a[href=#back]': 'back',
    'click a.showall': 'showAll'
};

view.prototype.featureLimit = 100;

view.prototype.initialize = function(options) {
    this.render();
};

view.prototype.back = function() {
    $('.palette a[href=#layers]').click();
    return false;
};

view.prototype.render = function() {
    var features = this.model.get('features');
    var fields = _(this.model.get('fields')).reduce(function(memo, v, k) {
        if (_(memo).keys().length < 50) memo[k] = v;
        return memo;
    }, {});
    this.$('.content').html(templates.Datasource({
        fields: fields,
        features: _(features).first(this.featureLimit),
        more: _(features).size() > this.featureLimit,
        moreFields: _(_(this.model.get('fields')).keys()).difference(_(fields).keys())
    }));
    return this;
};

view.prototype.showAll = function() {
    this.$('a.showall').hide();
    this.$('.content table tbody').append(templates.DatasourceRows({
        fields: this.model.get('fields'),
        features: _(this.model.get('features')).rest(this.featureLimit)
    }));
    return false;
}


{'fraction_non_alphanumeric': 0.19155696777122105, 'fraction_numerical': 0.006354970494779845, 'mean_word_length': 3.488798370672098, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, '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': '4084018', 'n_tokens_mistral': 699, 'n_tokens_neox': 687, 'n_words': 116}