<commit_before>/*******************************************
Adds new data source selection in settings
********************************************/
function addSource(){
    sources = document.getElementById("sources");
    var selector = document.createElement("select");
    selector.classList = ["source"];
    source_count = source_array.length;

    for (var i = 0; i < source_count; i += 1) {
        option = document.createElement('option');
        option.setAttribute('value', source_array[i].value);
        option.appendChild(document.createTextNode(source_array[i].text));
        selector.appendChild(option);
    }
    sources.appendChild(selector);
}
/*******************************************
Pops last data source selection from settings
*******************************************/
function popSource(){
    if (!document.getElementById("sources").lastElementChild) {
        return;
    }
    sources = document.getElementById("sources");
    toPop = sources.lastElementChild;
    sources.removeChild(toPop);
}

/*******************************************
Refreshes table to match changes to selection
*******************************************/
function refreshSources(){
    var myTable = document.getElementById("dash_table");
    while (myTable.firstChild) { 
        myTable.removeChild(myTable.firstChild);
    }
    loadTable();
}

/*******************************************
Loads table based on data source selections
*******************************************/
function loadTable(){
    table = document.getElementById("dash_table");
    sources = document.getElementById("sources");
    var data = sources.children;
    var numRows = Math.ceil(Math.sqrt(data.length));
    var k = 0;
    for(var i = 0; i<numRows; i++) {
        var row = table.insertRow(table.rows.length)
        for(var j = 0; j<numRows && data.item(k); j++) {
            row.insertCell(j).innerHTML = data.item(k).children[data.item(k).selectedIndex].text;
            row.cells[j].style.backgroundColor = colors[k%7];
            k++;
        }
    }
}

//Array for projects selection options
var project_array = [{value: 0, text: "Canary"}]

//Array for data source selection options
var source_array = [
    {value: "404", text: "404"},
    {value: "d404", text: "404 Rate"},
    {value: "lod", text: "Page Loads"},
    {value: "dlod", text: "Page Load Rate"},
    {value: "lat", text: "Latency"},
    {value: "usr0", text: "API 1"},
    {value: "usr1", text: "API 2"},
    {value: "usr2", text: "API 3"},
    {value: "usr3", text: "API 4"}
]

//Array for base colors of Cells
var colors = ["red","orange","yellow","green","blue","indigo","violet"]

projects = document.getElementById("projects");
var proj_selector = document.createElement("select")
proj_selector.classList = ["sources"];
for (var i = 0; i < project_array.length; i += 1) {
    option = document.createElement('option');
    option.setAttribute('value', project_array[i].value);
    option.appendChild(document.createTextNode(project_array[i].text));
    proj_selector.appendChild(option);
}
projects.appendChild(proj_selector);

//Click event listener for add data source selection button
document.getElementById("plus").addEventListener('click', function() {
    addSource();
}, false);

//Click event listener for remove data source selection button
document.getElementById("minus").addEventListener('click', function() {
    popSource();
}, false);

//Click event listener for refresh table button
document.getElementById("gear").addEventListener('click', function() {
    refreshSources();
}, false);<commit_msg>Disabled project selector JS;Not fully working<commit_after>/*******************************************
Adds new data source selection in settings
********************************************/
function addSource(){
    sources = document.getElementById("sources");
    var selector = document.createElement("select");
    selector.classList = ["source"];
    source_count = source_array.length;

    for (var i = 0; i < source_count; i += 1) {
        option = document.createElement('option');
        option.setAttribute('value', source_array[i].value);
        option.appendChild(document.createTextNode(source_array[i].text));
        selector.appendChild(option);
    }
    sources.appendChild(selector);
}
/*******************************************
Pops last data source selection from settings
*******************************************/
function popSource(){
    if (!document.getElementById("sources").lastElementChild) {
        return;
    }
    sources = document.getElementById("sources");
    toPop = sources.lastElementChild;
    sources.removeChild(toPop);
}

/*******************************************
Refreshes table to match changes to selection
*******************************************/
function refreshSources(){
    var myTable = document.getElementById("dash_table");
    while (myTable.firstChild) { 
        myTable.removeChild(myTable.firstChild);
    }
    loadTable();
}

/*******************************************
Loads table based on data source selections
*******************************************/
function loadTable(){
    table = document.getElementById("dash_table");
    sources = document.getElementById("sources");
    var data = sources.children;
    var numRows = Math.ceil(Math.sqrt(data.length));
    var k = 0;
    for(var i = 0; i<numRows; i++) {
        var row = table.insertRow(table.rows.length)
        for(var j = 0; j<numRows && data.item(k); j++) {
            row.insertCell(j).innerHTML = data.item(k).children[data.item(k).selectedIndex].text;
            row.cells[j].style.backgroundColor = colors[k%7];
            k++;
        }
    }
}

//Array for projects selection options
var project_array = [{value: 0, text: "Canary"}]

//Array for data source selection options
var source_array = [
    {value: "404", text: "404"},
    {value: "d404", text: "404 Rate"},
    {value: "lod", text: "Page Loads"},
    {value: "dlod", text: "Page Load Rate"},
    {value: "lat", text: "Latency"},
    {value: "usr0", text: "API 1"},
    {value: "usr1", text: "API 2"},
    {value: "usr2", text: "API 3"},
    {value: "usr3", text: "API 4"}
]

//Array for base colors of Cells
var colors = ["red","orange","yellow","green","blue","indigo","violet"]

/***************************************************
projects = document.getElementById("projects");
var proj_selector = document.createElement("select")
proj_selector.classList = ["sources"];
for (var i = 0; i < project_array.length; i += 1) {
    option = document.createElement('option');
    option.setAttribute('value', project_array[i].value);
    option.appendChild(document.createTextNode(project_array[i].text));
    proj_selector.appendChild(option);
}
projects.appendChild(proj_selector);
***************************************************/
//Click event listener for add data source selection button
document.getElementById("plus").addEventListener('click', function() {
    addSource();
}, false);

//Click event listener for remove data source selection button
document.getElementById("minus").addEventListener('click', function() {
    popSource();
}, false);

//Click event listener for refresh table button
document.getElementById("gear").addEventListener('click', function() {
    refreshSources();
}, false);
{'fraction_non_alphanumeric': 0.24311426233978728, 'fraction_numerical': 0.007908371966184892, 'mean_word_length': 4.561031084154663, 'pattern_counts': {'":': 0, '<': 11, '<?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': '2860866', 'n_tokens_mistral': 1981, 'n_tokens_neox': 1910, 'n_words': 482}