<commit_before>/**
 * Copyright 2018 Centreon
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 *
 * @param uploadField
 */
function checkSize(uploadField) {
    var messageWrapper = jQuery(".msg-wrapper");
    messageWrapper.hide();
    if (uploadField.files[0].size > 500000) {
        messageWrapper
            .show()
            .html('<span class="error-msg">File is too large (more than 500ko)</span>');
        uploadField.value = "";
    } else if (uploadField.selectedIndex === 0) {
        messageWrapper
            .show()
            .html('<span class="error-msg">File is empty</span>');
        uploadField.value = "";
    } else if (uploadField.files[0].name.split('.').pop() !== 'zip') {
        messageWrapper
            .show()
            .html('<span class="error-msg">Please update a .zip archive</span>');
        uploadField.value = "";
    }
}

/**
 *
 */
function submitForm() {
    jQuery(".loadingWrapper").css('display', 'block');
    var formData = new FormData();
    var importFiles = jQuery('#file')[0].files;
    var messageWrapper = jQuery(".msg-wrapper");
    messageWrapper.hide();
    formData.append('clapiImport', importFiles[0])
    formData.append('action', 'ajax_file_import');
    jQuery.ajax({
        type: "POST",
        url: "./modules/centreon-awie/core/launchImport.php",
        data: formData,
        cache: false,
        dataType: 'json',
        processData: false,
        contentType: false,
        success: function (data) {
            jQuery(".loadingWrapper").hide();
            if (data.error) {
                messageWrapper
                    .show()
                    .html('<span class="error-msg">' + data.error + '</span>');
            } else {
                messageWrapper
                    .show()
                    .html('<span class="success-msg">' + data.response + '</span>');
            }
        },
    });
    event.preventDefault();
}
<commit_msg>fix(msg) change upload msg<commit_after>/**
 * Copyright 2018 Centreon
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 *
 * @param uploadField
 */
function checkSize(uploadField) {
    var messageWrapper = jQuery(".msg-wrapper");
    messageWrapper.hide();
    if (uploadField.files[0].size > 500000) {
        messageWrapper
            .show()
            .html('<span class="error-msg">File is too large (more than 500ko)</span>');
        uploadField.value = "";
    } else if (uploadField.selectedIndex === 0) {
        messageWrapper
            .show()
            .html('<span class="error-msg">File is empty</span>');
        uploadField.value = "";
    } else if (uploadField.files[0].name.split('.').pop() !== 'zip') {
        messageWrapper
            .show()
            .html('<span class="error-msg">Please upload a .zip archive</span>');
        uploadField.value = "";
    }
}

/**
 *
 */
function submitForm() {
    jQuery(".loadingWrapper").css('display', 'block');
    var formData = new FormData();
    var importFiles = jQuery('#file')[0].files;
    var messageWrapper = jQuery(".msg-wrapper");
    messageWrapper.hide();
    formData.append('clapiImport', importFiles[0])
    formData.append('action', 'ajax_file_import');
    jQuery.ajax({
        type: "POST",
        url: "./modules/centreon-awie/core/launchImport.php",
        data: formData,
        cache: false,
        dataType: 'json',
        processData: false,
        contentType: false,
        success: function (data) {
            jQuery(".loadingWrapper").hide();
            if (data.error) {
                messageWrapper
                    .show()
                    .html('<span class="error-msg">' + data.error + '</span>');
            } else {
                messageWrapper
                    .show()
                    .html('<span class="success-msg">' + data.response + '</span>');
            }
        },
    });
    event.preventDefault();
}

{'fraction_non_alphanumeric': 0.14323392168796917, 'fraction_numerical': 0.008926759991884763, 'mean_word_length': 2.282290279627164, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3105612', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1310, 'n_words': 367}