<commit_before>/*
 * Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
 */

define([
    'underscore',
    'contrail-view',
    'knockback',
    'config/infra/bgp/ui/js/bgpConfigTemplates'
], function (_, ContrailView, Knockback, BGPConfigTemplates) {
    var gridElId = '#' + ctwl.BGP_GRID_ID;
    var prefixId = ctwl.BGP_PREFIX_ID;
    var modalId = 'configure-' + prefixId;
    var bgpConfigTemplates =  new BGPConfigTemplates();
    var self;
    var bgpEditView = ContrailView.extend({
        renderAddEditBGP: function (options) {
            var editTemplate =
                contrail.getTemplate4Id(cowc.TMPL_EDIT_FORM);
            var editLayout = editTemplate({prefixId: prefixId});
            self = this;

            cowu.createModal({'modalId': modalId, 'className': 'modal-980',
                             'title': options['title'], 'body': editLayout,
                             'onSave': function () {
                if((!self.model.isAutoMeshEnabled() ||
                    self.model.user_created_router_type() !== ctwl.CONTROL_NODE_TYPE) &&
                    self.model.getPeers(self.model.model().attributes).length === 0) {
                    var confTemplate = contrail.getTemplate4Id("controller-bgp-peer-conf-form-template");
                    var confTempLayout = confTemplate();
                    cowu.createModal({"modalId": modalId + "_conf", "className": "modal-280",
                        "title": "Information",
                        "btnName": "Continue",
                        "body": confTempLayout,
                        "onSave": function() {
                           $("#" + modalId + "_conf").modal("hide");
                           self.configEditBGPRouter(options)
                        },
                        "onCancel": function(){$("#" + modalId + "_conf").modal("hide")}
                    });
                    $("#" + modalId + "_conf").css("z-index",1052);
                    $(".modal-backdrop:last-child").css("z-index",1051);
                } else{<commit_msg>Closes-bug: #1606336  - BGP Router page throws "Maximum call stack size exceeded" while creating a new BGP<commit_after>/*
 * Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
 */

define([
    'underscore',
    'contrail-view',
    'knockback',
    'config/infra/bgp/ui/js/bgpConfigTemplates'
], function (_, ContrailView, Knockback, BGPConfigTemplates) {
    var gridElId = '#' + ctwl.BGP_GRID_ID;
    var prefixId = ctwl.BGP_PREFIX_ID;
    var modalId = 'configure-' + prefixId;
    var bgpConfigTemplates =  new BGPConfigTemplates();
    var self;
    var bgpEditView = ContrailView.extend({
        renderAddEditBGP: function (options) {
            var editTemplate =
                contrail.getTemplate4Id(cowc.TMPL_EDIT_FORM);
            var editLayout = editTemplate({prefixId: prefixId});
            self = this;

            cowu.createModal({'modalId': modalId, 'className': 'modal-980',
                             'title': options['title'], 'body': editLayout,
                             'onSave': function () {
                if((!self.model.isAutoMeshEnabled() ||
                    self.model.user_created_router_type() !== ctwl.CONTROL_NODE_TYPE) &&
                    self.model.getPeers(self.model.model().attributes).length === 0) {
                    /* the below line is required to solve Maximum
                        call stack size exceeded issue  */
                    $.fn.modal.Constructor.prototype.enforceFocus =
                        function() {};
                    var confTemplate = contrail.getTemplate4Id("controller-bgp-peer-conf-form-template");
                    var confTempLayout = confTemplate();
                    cowu.createModal({"modalId": modalId + "_conf", "className": "modal-280",
                        "title": "Information",
                        "btnName": "Continue",
                        "body": confTempLayout,
                        "onSave": function() {
                           $("#" + modalId + "_conf").modal("hide");
                           self.configEditBGPRouter(options)
                        },
                        "onCancel": function(){$("#" + modalId + "_conf").modal("hide")}
                    });
                    $("#" + modalId + "_conf").css("z-index",1052);
                    $(".modal-backdrop:last-child").css("z-index",1051);
                } else{
{'fraction_non_alphanumeric': 0.1347103726986978, 'fraction_numerical': 0.011001347103726987, 'mean_word_length': 1.7415384615384615, 'pattern_counts': {'":': 14, '<': 3, '<?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': '7244157', 'n_tokens_mistral': 1270, 'n_tokens_neox': 1189, 'n_words': 219}