<commit_before>var csrftoken = $('meta[name=csrf-token]').attr('content');
var searchFilter = $('#search-filter').val();

$(document).ready(function () {
    $('#li-build').addClass('active');

    $('body').tooltip({
        'selector': '[rel=tooltip]',
        'placement': 'auto'
    });

    $('#table-div').hide();

    var table = $('#defconfstable').dataTable({
        'dom': '<"row"<"col-xs-6 col-sm-6 col-md-6 col-lg-6"<"length-menu"l>>' +
            '<"col-xs-4 col-sm-4 col-md-4 col-lg-4 col-lg-offset-2"f>r' +
            '<"col-xs-12 col-sm-12 col-md-12 col-lg-12"t>>' +
            '<"row"<"col-xs-6 col-sm-6 col-md-6 col-lg-6"i>' +
            '<"col-xs-6 col-sm-6 col-md-6 col-lg-6"p>>',
        'language': {
            'lengthMenu': '_MENU_&nbsp;<strong>builds per page</strong>',
            'zeroRecords': '<h4>No builds to display.</h4>',
            'search': '<div id="search-area" class="input-group"><span class="input-group-addon"><i class="fa fa-search"></i></span>_INPUT_</div>'
        },
        'initComplete': function (settings, data) {
            $("#table-loading").remove();
            $("#table-div").fadeIn("slow", "linear");

            if (searchFilter !== null && searchFilter.length > 0) {
                var api = this.api();
                api.search(searchFilter, true).draw();
            }
        },
        'lengthMenu': [25, 50, 75, 100],
        'deferRender': true,
        'ordering': true,
        'processing': true,
        'stateDuration': -1,
        'stateSave': true,
        'order': [4, 'desc'],
        'search': {
            'regex': true
        },
        'ajax': {
            'url': '/_ajax/defconf',
            'traditional': true,
            'cache': true,
            'dataType': 'json',
            'dataSrc': 'result',
            'dataFilter': function (data, type) {
                if (type === 'json') {
                    data.result = JSON.stringify(data.result);
                    return data;
                }
                return data;
            },
            'beforeSend': function (xhr) {
                xhr.setRequestHeader("X-CSRFToken", csrftoken);
            },
            'data': {
                'sort': 'created_on',
                'sort_order': -1,
                'date_range': $('#date-range').val(),
                'field': [
                    '_id', 'job', 'kernel', 'defconfig', 'status',
                    'metadata', 'arch', 'created_on', 'dirname'
                ]
            }
        },
        'columns': [
            {
                'data': 'job',
                'title': 'Tree &dash; Branch',
                'render': function (data, type, object) {
                    var display =  '<a class="table-link" href="/job/' +
                        data + '/">' + data;

                    if (!$.isEmptyObject(object.metadata) &&
                            object.metadata.hasOwnProperty('git_branch') &&
                            object.metadata.git_branch !== null) {
                        display += '&nbsp;&dash;&nbsp;<small>' +
                            object.metadata.git_branch + '</small>';
                    }
                    return display + '</a>';
                }
            },
            {
                'data': 'kernel',
                'title': 'Kernel'
            },
            {
                'data': 'defconfig',
                'title': 'Defconfig',
                'render': function (data, type, object) {
                    var display = data;

                    if (!$.isEmptyObject(object.metadata) &&
                            object.metadata.hasOwnProperty('kconfig_fragments') &&
                            object.metadata.kconfig_fragments !== null) {
                        if (object.metadata.kconfig_fragments.length > 45) {
                            display = data + '&nbsp<small>' +
                                object.metadata.kconfig_fragments.slice(0, 39) + '&nbsp;&hellip;</small>';
                        } else {
                            display = data + '&nbsp<small>' +
                                object.metadata.kconfig_fragments + '</small>';
                        }
                    }
                    return display;
                }
            },
            {
                'data': 'arch',
                'title': 'Arch.'
            },
            {
                'data': 'created_on',
                'title': 'Date',
                'type': 'date',
                'render': function (data) {
                    var created = new Date(data['$date']);
                    return created.getCustomISODate();
                }
            },
            {
                'data': 'status',
                'title': 'Status',
                'type': 'string',
                'render': function (data) {
                    var displ;
                    switch (data) {
                        case 'PASS':
                            displ = '<span rel="tooltip" ' +
                                'data-toggle="tooltip"' +
                                'title="Build completed">' +
                                '<span class="label label-success">' +
                                '<li class="fa fa-check"></li></span></span>';
                            break;
                        case 'FAIL':
                            displ = '<span rel="tooltip" ' +
                                'data-toggle="tooltip"' +
                                'title="Build failed">' +<commit_msg>builds: Center align some columns.<commit_after>var csrftoken = $('meta[name=csrf-token]').attr('content');
var searchFilter = $('#search-filter').val();

$(document).ready(function () {
    $('#li-build').addClass('active');

    $('body').tooltip({
        'selector': '[rel=tooltip]',
        'placement': 'auto'
    });

    $('#table-div').hide();

    var table = $('#defconfstable').dataTable({
        'dom': '<"row"<"col-xs-6 col-sm-6 col-md-6 col-lg-6"<"length-menu"l>>' +
            '<"col-xs-4 col-sm-4 col-md-4 col-lg-4 col-lg-offset-2"f>r' +
            '<"col-xs-12 col-sm-12 col-md-12 col-lg-12"t>>' +
            '<"row"<"col-xs-6 col-sm-6 col-md-6 col-lg-6"i>' +
            '<"col-xs-6 col-sm-6 col-md-6 col-lg-6"p>>',
        'language': {
            'lengthMenu': '_MENU_&nbsp;<strong>builds per page</strong>',
            'zeroRecords': '<h4>No builds to display.</h4>',
            'search': '<div id="search-area" class="input-group"><span class="input-group-addon"><i class="fa fa-search"></i></span>_INPUT_</div>'
        },
        'initComplete': function (settings, data) {
            $("#table-loading").remove();
            $("#table-div").fadeIn("slow", "linear");

            if (searchFilter !== null && searchFilter.length > 0) {
                var api = this.api();
                api.search(searchFilter, true).draw();
            }
        },
        'lengthMenu': [25, 50, 75, 100],
        'deferRender': true,
        'ordering': true,
        'processing': true,
        'stateDuration': -1,
        'stateSave': true,
        'order': [4, 'desc'],
        'search': {
            'regex': true
        },
        'ajax': {
            'url': '/_ajax/defconf',
            'traditional': true,
            'cache': true,
            'dataType': 'json',
            'dataSrc': 'result',
            'dataFilter': function (data, type) {
                if (type === 'json') {
                    data.result = JSON.stringify(data.result);
                    return data;
                }
                return data;
            },
            'beforeSend': function (xhr) {
                xhr.setRequestHeader("X-CSRFToken", csrftoken);
            },
            'data': {
                'sort': 'created_on',
                'sort_order': -1,
                'date_range': $('#date-range').val(),
                'field': [
                    '_id', 'job', 'kernel', 'defconfig', 'status',
                    'metadata', 'arch', 'created_on', 'dirname'
                ]
            }
        },
        'columns': [
            {
                'data': 'job',
                'title': 'Tree &dash; Branch',
                'render': function (data, type, object) {
                    var display =  '<a class="table-link" href="/job/' +
                        data + '/">' + data;

                    if (!$.isEmptyObject(object.metadata) &&
                            object.metadata.hasOwnProperty('git_branch') &&
                            object.metadata.git_branch !== null) {
                        display += '&nbsp;&dash;&nbsp;<small>' +
                            object.metadata.git_branch + '</small>';
                    }
                    return display + '</a>';
                }
            },
            {
                'data': 'kernel',
                'title': 'Kernel'
            },
            {
                'data': 'defconfig',
                'title': 'Defconfig',
                'render': function (data, type, object) {
                    var display = data;

                    if (!$.isEmptyObject(object.metadata) &&
                            object.metadata.hasOwnProperty('kconfig_fragments') &&
                            object.metadata.kconfig_fragments !== null) {
                        if (object.metadata.kconfig_fragments.length > 45) {
                            display = data + '&nbsp<small>' +
                                object.metadata.kconfig_fragments.slice(0, 39) + '&nbsp;&hellip;</small>';
                        } else {
                            display = data + '&nbsp<small>' +
                                object.metadata.kconfig_fragments + '</small>';
                        }
                    }
                    return display;
                }
            },
            {
                'data': 'arch',
                'title': 'Arch.'
            },
            {
                'data': 'created_on',
                'title': 'Date',
                'type': 'date',
                'className': 'pull-center',
                'render': function (data) {
                    var created = new Date(data['$date']);
                    return created.getCustomISODate();
                }
            },
            {
                'data': 'status',
                'title': 'Status',
                'type': 'string',
                'className': 'pull-center',
                'render': function (data) {
                    var displ;
                    switch (data) {
                        case 'PASS':
                            displ = '<span rel="tooltip" ' +
                                'data-toggle="tooltip"' +
                                'title="Build completed">' +
                                '<span class="label label-success">' +
                                '<li class="fa fa-check"></li></span></span>';
                            break;
                        case 'FAIL':
                            displ = '<span rel="tooltip" ' +
                                'data-toggle="tooltip"' +
                                'title="Build failed">' +
{'fraction_non_alphanumeric': 0.16067124877265018, 'fraction_numerical': 0.00803356243863251, 'mean_word_length': 1.1268033409263478, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 73, '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': '1210202', 'n_tokens_mistral': 3043, 'n_tokens_neox': 2902, 'n_words': 536}