<commit_before><commit_msg>Almost forgot to add decomposed data table.<commit_after>(function( $, undefined ) {
    $.KBWidget({
        name: 'kbaseNarrativeDataTable',
        parent: 'kbaseWidget',
        version: '1.0.0',
        options: {
            workspaceURL: "http://192.168.127.12:7058", // "http://kbase.us/services/ws",
            wsBrowserURL: "http://172.16.31.10/landing-pages/#/ws/",
            landingPageURL: "http://172.16.31.10/landing-pages/#/",
            data: null
        },

        init: function(options) {
            this._super(options);

            this.$dataTable = $('<table cellpadding="0" cellspacing="0" border="0" class="table kb-data-table">');
            this.$dataSelect = $('<select>')
                               .addClass('form-control')
                               .css({'width' : '95%'});
            this.$dataSearch = $('<input>')
                               .attr({
                                  'type' : 'text',
                                  'class' : 'form-control',
                                  'style' : 'width:95%',
                                  'placeholder' : 'Search',
                               });

            this.$elem.append($('<div>').append(this.$dataSelect))
                      .append($('<div>').append(this.$dataSearch))
                      .append(this.$dataTable);

            this.$dataSelect.change($.proxy(function(event) {
                var filterValue = '';
                this.$dataSelect.find('option:selected').each(function(){ filterValue = $( this ).val(); });
                this.$dataTable.fnFilter(filterValue, 2);
            }, this));

            this.$dataSearch.keyup($.proxy(function(event) {
                var value = this.$dataSearch.val();
                this.$dataTable.fnFilter(value, 1);
            }, this));

            this.$dataTable.dataTable({
                sScrollX: '100%',
                iDisplayLength: -1,
                bPaginate: false,
                oLanguage: {
                    sZeroRecords: '<div style="text-align: center">No data found. Click <a href="http://kbase.us" target="_new">Here</a> to upload or use the search bar above.</div>',
                },
                aoColumns: [
                    { "sTitle": "Workspace", bVisible: false},
                    { "sTitle": "ID" },
                    { "sTitle": "Type", bVisible: false },
                ],
                aoColumnDefs: [
                    { 'bSortable': false, 'aTargets': [ 0 ] },
                    {
                        mRender: function(data, type, row) {
                            return data + 
                                   "<span class='glyphicon glyphicon-question-sign kb-function-help' " + 
                                   "data-ws='" + row[7] + "' " +
                                   "data-id='" + row[1] + "' " + 
                                   "style='margin-top: -3px'></span>";
                        },
                        aTargets: [1]
                    },
                ],
                bInfo: false,
                bLengthChange: false,
                bPaginate: false,
                bAutoWidth: true,
                bScrollCollapse: true,
                sScrollY: '240px',
            });

            if (this.options.data)
                this.setData(this.options.data);

            return this;
        },

        setData: function(data) {
            this.$dataSelect.empty();
            this.$dataSelect.append('<option value="">All Types</option>');

            var dataList = [];
            $.each(Object.keys(data), $.proxy(function(idx, key) {
                this.$dataSelect.append($('<option>')
                                          .attr('value', key)
                                          .append(key + ' (' + data[key].length + ')'));
                dataList = dataList.concat(data[key]);
            }, this));

            this.$dataTable.fnClearTable();
            this.$dataTable.fnAddData(dataList);
            this.$dataTable.find('.kb-function-help').click(
                $.proxy(function(event) {
                    var ws = $(event.target).attr('data-ws');
                    var id = $(event.target).attr('data-id');
                    this.trigger('dataInfoClicked.Narrative', [ws, id]);
                }, 
                this)
            );
        },
    })

})(jQuery);
{'fraction_non_alphanumeric': 0.15128320576316975, 'fraction_numerical': 0.012832057631697433, 'mean_word_length': 1.1758080313418218, 'pattern_counts': {'":': 3, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2684912', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1109, 'n_words': 182}