<commit_before>import Ember from 'ember';

export default Ember.Component.extend({
    tagName: '',
    action: null,
    filterProperty: null,

    query: null,
    filter: null,

    actions: {
        clearFilter() {
            this.set('searchFilter', null);
        }
    },
    filterTable: Ember.observer('searchFilter', function() {
        Ember.run.debounce(this, 'filterName', 750);
    }),
    isClearable: Ember.computed('searchFilter', function() {
        if (this.get('searchFilter')) {
            return true;
        }
        return false;
    }),
    filterName() {
        // Reference parent component query obj
        var query = this.get('parentView.query'),
            property = this.get('filterProperty'),
            value = this.get('searchFilter'),
            filter;

        // Set the query on the filter object
        if (query.hasOwnProperty('filter') && query.filter !== null) {
            filter = query.filter;
        } else {
            filter = {};
        }
        filter[property] = value;

        // Remove filter if value is an empty string
        // to prevent empty request from being sent
        if (value === '' || value === null) {
            delete filter[property];
        }<commit_msg>Global filter will attempt to grab query from itself, if not it will reach up to the parent component<commit_after>import Ember from 'ember';

export default Ember.Component.extend({
    tagName: '',
    action: null,
    filterProperty: null,

    query: null,
    filter: null,

    actions: {
        clearFilter() {
            this.set('searchFilter', null);
        }
    },
    filterTable: Ember.observer('searchFilter', function() {
        Ember.run.debounce(this, 'filterName', 750);
    }),
    isClearable: Ember.computed('searchFilter', function() {
        if (this.get('searchFilter')) {
            return true;
        }
        return false;
    }),
    filterName() {
        // Reference parent component query obj
        var query = this.get('query') || this.get('parentView.query'),
            property = this.get('filterProperty'),
            value = this.get('searchFilter'),
            filter;

        // Set the query on the filter object
        if (query.hasOwnProperty('filter') && query.filter !== null) {
            filter = query.filter;
        } else {
            filter = {};
        }
        filter[property] = value;

        // Remove filter if value is an empty string
        // to prevent empty request from being sent
        if (value === '' || value === null) {
            delete filter[property];
        }
{'fraction_non_alphanumeric': 0.12552621507845388, 'fraction_numerical': 0.002296211251435132, 'mean_word_length': 1.9704545454545455, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2008888', 'n_tokens_mistral': 695, 'n_tokens_neox': 677, 'n_words': 193}