<commit_before>var BASE_URL = "/" + window.location.href.split('/')[3];

$(document).ready(function() {
    $(document).foundation();

    $("#localConfigurationRadioInput").data("link", BASE_URL + "/configuration/local");
    $("#localConfigurationRadioInput").change(function(e) {
        displayFetchedConfiguration($(this).data("link"));
    });
    $("#localConfigurationRadioInput").trigger('change');

    // check if the service is initialised successfully.
    $.ajax({
        type: 'GET',
        url: BASE_URL + "/configuration/ifinitialised",
        error: function(jqXHR, textStatus, errorThrown) {
            console.log(jqXHR);
            console.log(textStatus);
            console.log(errorThrown);
            $('#configStatus').attr('class', 'right alert-color');
            $('#configStatus').text("initialisation error (" + errorThrown + ")");
        },
        success: function(idata) {
            console.log(idata);
            if (idata === false) {
                $('#configStatus').attr('class', 'right alert-color');
                $('#configStatus').text('not initialised');
            } else if (idata === true) {
                $('#configStatus').attr('class', 'right success-color');
                $('#configStatus').text('initialised');

                // check if configuration was set
                $.ajax({
                    type: 'GET',
                    url: BASE_URL + "/configuration/ifconfigured",
                    error: function(jqXHR, textStatus, errorThrown) {
                        console.log(jqXHR);
                        console.log(textStatus);
                        console.log(errorThrown);
                        $('#configStatus').attr('class', 'right alert-color');
                        $('#configStatus').text("configuration error (" + errorThrown + ")");
                    },
                    success: function(cdata) {
                        console.log(cdata);
                        if (cdata === false) {
                            $('#configStatus').attr('class', 'right alert-color');
                            $('#configStatus').text('not configured');

                            // display available configurations
                            $.getJSON(BASE_URL + "/configuration/projects", function(data) {
                                console.log(data);
                                if (data.size > 1) {
                                    console.log("No remote projects found");
                                } else {
                                    for (counter in data) {
                                        var remoteConfigurationRadioInput = $('<input type="radio" name="configurationSet" value="rp' +
                                                counter + '" id="rp' + counter + '"><label for="rp' + counter + '">' + data[counter] + '</label><br>').appendTo("#listofRemoteConfigurations");
                                        remoteConfigurationRadioInput.data("link", BASE_URL + "/configuration/projects/" + data[counter]);
                                        remoteConfigurationRadioInput.change(function(e) {
                                            displayFetchedConfiguration($(this).data("link"));
                                        });
                                    }
//                                    var customSearchRadioInput = $('<input type="radio" name="configurationSet" value="rp' +
//                                            counter + '" id="rp' + counter + '"><input type="text" name="searchForWebDavProjectName" id="searchForWebDavProjectName"><br>').appendTo("#listofRemoteConfigurations");
                                }

                            });

                        } else if (cdata === true) {
                            $('#configStatus').attr('class', 'right success-color');
                            $('#configStatus').text('configured');

                            // go to experiment


                        } else {
                            $('#configStatus').attr('class', 'right alert-color');
                            $('#configStatus').text('unknown configured status');
                        }
                    }});

            } else {
                $('#configStatus').attr('class', 'right alert-color');<commit_msg>Adds redirect to experiment page if everything is configured on index page<commit_after>var BASE_URL = "/" + window.location.href.split('/')[3];

$(document).ready(function() {
    $(document).foundation();

    $("#localConfigurationRadioInput").data("link", BASE_URL + "/configuration/local");
    $("#localConfigurationRadioInput").change(function(e) {
        displayFetchedConfiguration($(this).data("link"));
    });
    $("#localConfigurationRadioInput").trigger('change');

    // check if the service is initialised successfully.
    $.ajax({
        type: 'GET',
        url: BASE_URL + "/configuration/ifinitialised",
        error: function(jqXHR, textStatus, errorThrown) {
            console.log(jqXHR);
            console.log(textStatus);
            console.log(errorThrown);
            $('#configStatus').attr('class', 'right alert-color');
            $('#configStatus').text("initialisation error (" + errorThrown + ")");
        },
        success: function(idata) {
            console.log(idata);
            if (idata === false) {
                $('#configStatus').attr('class', 'right alert-color');
                $('#configStatus').text('not initialised');
            } else if (idata === true) {
                $('#configStatus').attr('class', 'right success-color');
                $('#configStatus').text('initialised');

                // check if configuration was set
                $.ajax({
                    type: 'GET',
                    url: BASE_URL + "/configuration/ifconfigured",
                    error: function(jqXHR, textStatus, errorThrown) {
                        console.log(jqXHR);
                        console.log(textStatus);
                        console.log(errorThrown);
                        $('#configStatus').attr('class', 'right alert-color');
                        $('#configStatus').text("configuration error (" + errorThrown + ")");
                    },
                    success: function(cdata) {
                        console.log(cdata);
                        if (cdata === false) {
                            $('#configStatus').attr('class', 'right alert-color');
                            $('#configStatus').text('not configured');

                            // display available configurations
                            $.getJSON(BASE_URL + "/configuration/projects", function(data) {
                                console.log(data);
                                if (data.size > 1) {
                                    console.log("No remote projects found");
                                } else {
                                    for (counter in data) {
                                        var remoteConfigurationRadioInput = $('<input type="radio" name="configurationSet" value="rp' +
                                                counter + '" id="rp' + counter + '"><label for="rp' + counter + '">' + data[counter] + '</label><br>').appendTo("#listofRemoteConfigurations");
                                        remoteConfigurationRadioInput.data("link", BASE_URL + "/configuration/projects/" + data[counter]);
                                        remoteConfigurationRadioInput.change(function(e) {
                                            displayFetchedConfiguration($(this).data("link"));
                                        });
                                    }
//                                    var customSearchRadioInput = $('<input type="radio" name="configurationSet" value="rp' +
//                                            counter + '" id="rp' + counter + '"><input type="text" name="searchForWebDavProjectName" id="searchForWebDavProjectName"><br>').appendTo("#listofRemoteConfigurations");
                                }

                            });

                        } else if (cdata === true) {
                            $('#configStatus').attr('class', 'right success-color');
                            $('#configStatus').text('configured');

                            // go to experiment if no flag
                            window.location.replace(BASE_URL + "/experiment.html");

                        } else {
                            $('#configStatus').attr('class', 'right alert-color');
                            $('#configStatus').text('unknown configured status');
                        }
                    }});

            } else {
                $('#configStatus').attr('class', 'right alert-color');
{'fraction_non_alphanumeric': 0.14142325476485845, 'fraction_numerical': 0.0004511108604939664, 'mean_word_length': 1.3896523848019402, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 34, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1772109', 'n_tokens_mistral': 1954, 'n_tokens_neox': 1894, 'n_words': 345}