<commit_before>/*
 *  Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 *  WSO2 Inc. licenses this file to you 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.
 *
 */
$(function(){
    $('#btn-create-asset').removeAttr('disabled');
    var obtainFormMeta=function(formId){
		return $(formId).data();
	};
    var populateTags = function(arr){
        var entry;
        for(var index = 0 ; index < arr.length; index++){
            entry = arr [index];
            if(entry.name === '_tags'){
                entry.value = tagsAPI.selectedTags();
            }
        }
    };
    $('#form-asset-create').ajaxForm({
        beforeSubmit:function(arr){
            var createButton = $('#btn-create-asset');
            createButton.attr('disabled','disabled');
            createButton.next().attr('disabled','disabled');
            caramel.render('loading','Creating asset. Please wait..', function( info , content ){
                createButton.parent().append($(content));
            });
            populateTags(arr);
        },
        success:function(data){
            var options=obtainFormMeta('#form-asset-create');
            $('#btn-create-asset').removeAttr('disabled');
            $.cookie("new-asset-"+data.type , data.id + ":" + data.type + ":" + data.name );
            window.location = options.redirectUrl;
        },
        error:function(){
            messages.alertError('Unable to add the '+PublisherUtils.resolveCurrentPageAssetType()+' instance.');
            $('#btn-create-asset').removeAttr('disabled');

        }
    });
    var initDatePicker =  function(){
        if($(this).attr('data-render-options') == "date-time"){
            var dateField = this;
            $(this).DatePicker({
                mode: 'single',
                position: 'right',
                onBeforeShow: function(el){
                    if($(dateField).val().replace(/^\s+|\s+$/g,"")){
                        $(dateField).DatePickerSetDate($(dateField).val(), true);<commit_msg>REGISTRY-2814 Fix - Remove spinner and wait message when duplicate soap services are added<commit_after>/*
 *  Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 *  WSO2 Inc. licenses this file to you 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.
 *
 */
$(function(){
    $('#btn-create-asset').removeAttr('disabled');
    var obtainFormMeta=function(formId){
		return $(formId).data();
	};
    var populateTags = function(arr){
        var entry;
        for(var index = 0 ; index < arr.length; index++){
            entry = arr [index];
            if(entry.name === '_tags'){
                entry.value = tagsAPI.selectedTags();
            }
        }
    };
    $('#form-asset-create').ajaxForm({
        beforeSubmit:function(arr){
            var createButton = $('#btn-create-asset');
            createButton.attr('disabled','disabled');
            createButton.next().attr('disabled','disabled');
            caramel.render('loading','Creating asset. Please wait..', function( info , content ){
                createButton.parent().append($(content));
            });
            populateTags(arr);
        },
        success:function(data){
            var options=obtainFormMeta('#form-asset-create');
            $('#btn-create-asset').removeAttr('disabled');
            $.cookie("new-asset-"+data.type , data.id + ":" + data.type + ":" + data.name );
            window.location = options.redirectUrl;
        },
        error:function(){
            messages.alertError('Unable to add the '+PublisherUtils.resolveCurrentPageAssetType()+' instance.');
            $('#btn-create-asset').removeAttr('disabled');
            $('.fa-spinner').parent().remove();

        }
    });
    var initDatePicker =  function(){
        if($(this).attr('data-render-options') == "date-time"){
            var dateField = this;
            $(this).DatePicker({
                mode: 'single',
                position: 'right',
                onBeforeShow: function(el){
                    if($(dateField).val().replace(/^\s+|\s+$/g,"")){
                        $(dateField).DatePickerSetDate($(dateField).val(), true);
{'fraction_non_alphanumeric': 0.1505087348819351, 'fraction_numerical': 0.006911115377231714, 'mean_word_length': 2.3333333333333335, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '4145741', 'n_tokens_mistral': 1422, 'n_tokens_neox': 1380, 'n_words': 352}