<commit_before>var sqlPortForPausedDB = {
    UseAdminPort: 'UseAdminPort',
    UseNormalPort: 'UseNormalPort'
};
var $tabs = null;
var tab_counter = 1;
var INT_MAX_VALUE = 2147483647;
$(document).ready(function () {
    function CheckBrowser() {
        if ('localStorage' in window && window['localStorage'] !== null) {
            return true;
        } else {
             return false;
        }
    }
    CheckBrowser();

    var sqlValidationRule = {
        numericRules: {
            min: 1,
            max: INT_MAX_VALUE,
            digits: true
        },
        numericMessages: {
            min: "Please enter a positive number. Its minimum value should be 1.",
            max: "Please enter a positive number between 1 and " + INT_MAX_VALUE + ".",
            digits: "Please enter a positive number without any decimal."
        }
    }

    var fixWidth= function(){
        var totalWidth = $(window).width()
        if(totalWidth > 981){
            var queryWidth = totalWidth - 290
            var percentWidth = (parseInt(queryWidth)/parseInt(totalWidth)) * 100 - 4
            $("#inputQuery").width(percentWidth + "%")
        } else {
            $("#inputQuery").width("100%")
        }

    }

    var addEvent = function(object, type, callback) {
        if (object == null || typeof(object) == 'undefined') return;
        if (object.addEventListener) {
            object.addEventListener(type, callback, false);
        } else if (object.attachEvent) {
            object.attachEvent("on" + type, callback);
        } else {
            object["on"+type] = callback;
        }
    };

    addEvent(window, "resize", function() {
        fixWidth()
    });

    fixWidth()
    
    $("#bntTimeoutSetting").popup({
        open: function (event, ui, ele) {
            $("#errorQueryTimeoutConfig").hide();
            $("#txtQueryTimeoutConfig").val(SQLQueryRender.getCookie("timeoutTime") == undefined ? "" : SQLQueryRender.getCookie("timeoutTime"))
        },
        afterOpen: function () {
            $("#formQueryTimeoutConfiguration").validate({
                rules: {
                    txtQueryTimeoutConfig: sqlValidationRule.numericRules
                },
                messages: {
                    txtQueryTimeoutConfig: sqlValidationRule.numericMessages
                }
            });
            var popup = $(this)[0];
            $("#btnQueryTimeoutConfigSave").unbind("click");
            $("#btnQueryTimeoutConfigSave").on("click", function(){
                if (!$("#formQueryTimeoutConfiguration").valid()) {
                    e.preventDefault();
                    e.stopPropagation();
                }
                var timeoutTime = $("#txtQueryTimeoutConfig").val();
                if(timeoutTime == ""){
                    SQLQueryRender.removeCookie("timeoutTime")
                }else{
                    SQLQueryRender.SaveQueryTimeout(timeoutTime);
                }
                displayQueryTimeout();
                popup.close();
            });
            $("#btnQueryTimeoutConfigCancel").on("click", function () {
                popup.close();
            });
            $("#btnQueryTimeoutConfigClear").on("click", function(){
                $("#txtQueryTimeoutConfig").val("");
                $("#errorQueryTimeoutConfig").hide();
            });
        }
    });

    $("#btnQuerySaveConfirmation").popup({
        afterOpen: function () {
            var popup = $(this)[0];
            $("#btnQuerySaveOk").unbind("click");
            $("#btnQuerySaveOk").on("click", function(){
                popup.close();
            });

            $("#btnQuerySaveCancel").unbind("click");
            $("#btnQuerySaveCancel").on("click", function () {
                popup.close();
            });
        }
    });

    $('#btnSaveQueryConfirmation').on('click', function(e){
        var element = $("#worktabs .ui-tabs-panel:visible").attr("id");
        var element_id = element.split('-')[1]
        if($('#qTab-' + element_id).data('isold')){
            saveQueryTab(false)
            e.preventDefault()
            e.stopPropagation()
            return;
        }
    });

    $('#btnSaveQueryConfirmation').popup({
        open: function (event, ui, ele) {
            var element = $("#worktabs .ui-tabs-panel:visible").attr("id");
            var element_id = element.split('-')[1]

            $('#txtQueryName').val(SQLQueryRender.orgQueryName)
            $('#errorQueryName').hide()
            var queryText = $('#querybox-' + element_id).val()
            if(queryText == ''){
                $('#btnSaveQueryOk').hide()
                $('#queryError').show()
            } else {
                $('#btnSaveQueryOk').show()
                $('#queryError').hide()
            }

            $.validator.addMethod(
                "checkDuplicate",
                function (value) {
                    var arr = []
                    if(localStorage.queries != undefined){
                        queries = $.parseJSON(localStorage.queries)
                        $.each(queries, function(key){
                            arr.push(key.split('_')[1])
                        })
                    }
                    if ($.inArray(value, SQLQueryRender.queryNameList) != -1 || $.inArray(value, arr) != -1) {
                        if(value ==  SQLQueryRender.orgQueryName)
                            return true;
                        else
                            return false;
                    } else {
                        return true;
                    }
                },<commit_msg>VMC-289 Modified code to change the pop-up title.<commit_after>var sqlPortForPausedDB = {
    UseAdminPort: 'UseAdminPort',
    UseNormalPort: 'UseNormalPort'
};
var $tabs = null;
var tab_counter = 1;
var INT_MAX_VALUE = 2147483647;
$(document).ready(function () {
    function CheckBrowser() {
        if ('localStorage' in window && window['localStorage'] !== null) {
            return true;
        } else {
             return false;
        }
    }
    CheckBrowser();

    var sqlValidationRule = {
        numericRules: {
            min: 1,
            max: INT_MAX_VALUE,
            digits: true
        },
        numericMessages: {
            min: "Please enter a positive number. Its minimum value should be 1.",
            max: "Please enter a positive number between 1 and " + INT_MAX_VALUE + ".",
            digits: "Please enter a positive number without any decimal."
        }
    }

    var fixWidth= function(){
        var totalWidth = $(window).width()
        if(totalWidth > 981){
            var queryWidth = totalWidth - 290
            var percentWidth = (parseInt(queryWidth)/parseInt(totalWidth)) * 100 - 4
            $("#inputQuery").width(percentWidth + "%")
        } else {
            $("#inputQuery").width("100%")
        }

    }

    var addEvent = function(object, type, callback) {
        if (object == null || typeof(object) == 'undefined') return;
        if (object.addEventListener) {
            object.addEventListener(type, callback, false);
        } else if (object.attachEvent) {
            object.attachEvent("on" + type, callback);
        } else {
            object["on"+type] = callback;
        }
    };

    addEvent(window, "resize", function() {
        fixWidth()
    });

    fixWidth()
    
    $("#bntTimeoutSetting").popup({
        open: function (event, ui, ele) {
            $("#errorQueryTimeoutConfig").hide();
            $("#txtQueryTimeoutConfig").val(SQLQueryRender.getCookie("timeoutTime") == undefined ? "" : SQLQueryRender.getCookie("timeoutTime"))
        },
        afterOpen: function () {
            $("#formQueryTimeoutConfiguration").validate({
                rules: {
                    txtQueryTimeoutConfig: sqlValidationRule.numericRules
                },
                messages: {
                    txtQueryTimeoutConfig: sqlValidationRule.numericMessages
                }
            });
            var popup = $(this)[0];
            $("#btnQueryTimeoutConfigSave").unbind("click");
            $("#btnQueryTimeoutConfigSave").on("click", function(){
                if (!$("#formQueryTimeoutConfiguration").valid()) {
                    e.preventDefault();
                    e.stopPropagation();
                }
                var timeoutTime = $("#txtQueryTimeoutConfig").val();
                if(timeoutTime == ""){
                    SQLQueryRender.removeCookie("timeoutTime")
                }else{
                    SQLQueryRender.SaveQueryTimeout(timeoutTime);
                }
                displayQueryTimeout();
                popup.close();
            });
            $("#btnQueryTimeoutConfigCancel").on("click", function () {
                popup.close();
            });
            $("#btnQueryTimeoutConfigClear").on("click", function(){
                $("#txtQueryTimeoutConfig").val("");
                $("#errorQueryTimeoutConfig").hide();
            });
        }
    });

    $("#btnQuerySaveConfirmation").popup({
        afterOpen: function () {
            var popup = $(this)[0];
            $("#btnQuerySaveOk").unbind("click");
            $("#btnQuerySaveOk").on("click", function(){
                popup.close();
            });

            $("#btnQuerySaveCancel").unbind("click");
            $("#btnQuerySaveCancel").on("click", function () {
                popup.close();
            });
        }
    });

    $('#btnSaveQueryConfirmation').on('click', function(e){
        var element = $("#worktabs .ui-tabs-panel:visible").attr("id");
        var element_id = element.split('-')[1]
        if($('#qTab-' + element_id).data('isold')){
            saveQueryTab(false)
            e.preventDefault()
            e.stopPropagation()
            return;
        }
    });

    $('#btnSaveQueryConfirmation').popup({
        open: function (event, ui, ele) {
            var element = $("#worktabs .ui-tabs-panel:visible").attr("id");
            var element_id = element.split('-')[1]

            $('#txtQueryName').val(SQLQueryRender.orgQueryName)
            $('#errorQueryName').hide()
            var queryText = $('#querybox-' + element_id).val()
            if(queryText == ''){
                $('#btnSaveQueryOk').hide()
                $('#queryError').show()
                $('#Tr1').hide()
                $('#saveQueryHeader').html('Error')
                $('#divSaveQueryConfirmation').addClass('errorIcon')
            } else {
                $('#btnSaveQueryOk').show()
                $('#queryError').hide()
                $('#Tr1').show()
                $('#saveQueryHeader').html('Save Query')
                $('#divSaveQueryConfirmation').removeClass('errorIcon')
            }

            $.validator.addMethod(
                "checkDuplicate",
                function (value) {
                    var arr = []
                    if(localStorage.queries != undefined){
                        queries = $.parseJSON(localStorage.queries)
                        $.each(queries, function(key){
                            arr.push(key.split('_')[1])
                        })
                    }
                    if ($.inArray(value, SQLQueryRender.queryNameList) != -1 || $.inArray(value, arr) != -1) {
                        if(value ==  SQLQueryRender.orgQueryName)
                            return true;
                        else
                            return false;
                    } else {
                        return true;
                    }
                },
{'fraction_non_alphanumeric': 0.14481156427465153, 'fraction_numerical': 0.006281190844949235, 'mean_word_length': 1.5714601769911505, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2979014', 'n_tokens_mistral': 2951, 'n_tokens_neox': 2846, 'n_words': 514}