<commit_before>function deleteCustomSP(applicationName) {
    var str = PROXY_CONTEXT_PATH + "/" + ADMIN_PORTAL_NAME + "/serviceproviders/custom/controllers/custom/delete_finish.jag";
    $.ajax({
            url: str,
            type: "POST",
            data: "applicationName=" + applicationName + "&profileConfiguration=default" + "&cookie=" + cookie + "&user=" + userName,
        })
        .done(function (data) {
            reloadGrid();
            //message({content:'Successfully saved changes to the profile',type:'info', cbk:function(){} });

        })
        .fail(function () {
            message({
                content: 'Error while updating Profile', type: 'error', cbk: function () {
                }
            });

        })
        .always(function () {
            console.log('completed');
        });
}
/**
 * This method will delete a given application without page refresh
 * @param applicationName
 */
function deleteCustomSPWithoutRefresh(applicationName) {
    var str = "/" + ADMIN_PORTAL_NAME + "/serviceproviders/custom/controllers/custom/delete_finish.jag";
    $.ajax({
            url: str,
            async: false,
            type: "POST",
            data: "applicationName=" + applicationName + "&profileConfiguration=default" + "&cookie=" + cookie + "&user=" + userName,
        })
        .done(function (data) {


        })
        .fail(function () {
            message({
                content: 'Error while updating Profile', type: 'error', cbk: function () {
                }
            });

        })
        .always(function () {
            console.log('completed');
        });
}

function reloadGrid() {
    spList = null;
    $.ajax({
        url: "/" + ADMIN_PORTAL_NAME + "/serviceproviders/getSPList",
        type: "GET",
        data: "&cookie=" + cookie + "&user=" + userName,
        success: function (data) {
            if (data) {
                var resp = $.parseJSON(data);

                if (resp.success == false) {
                    if (typeof resp.reLogin != 'undefined' && resp.reLogin == true) {
                        window.top.location.href = window.location.protocol + '//' + serverUrl + '/' + ADMIN_PORTAL_NAME + '/logout.jag';
                    } else {
                        if (resp.message != null && resp.message.length > 0) {
                            message({
                                content: resp.message, type: 'error', cbk: function () {
                                }
                            });
                        } else {
                            message({
                                content: 'Error occurred while loading values for the grid.',
                                type: 'error',
                                cbk: function () {
                                }
                            });
                        }
                    }
                } else {
                    spList = resp.return;
                    if (spList != null && spList.constructor !== Array) {
                        var arr = [];
                        arr[0] = spList;
                        spList = arr;
                    }
                    if (spList.length <= APP_LIMIT) {
                        $('#searchBox').hide();
                    }
                    drawList();
                }
            } else {
                $('#spList').addClass('hide');
                $('#emptyList').removeClass('hide');
                $('#searchBox').hide();
            }
        },
        error: function (e) {
            message({
                content: 'Error occurred while loading values for the grid.', type: 'error', cbk: function () {
                }
            });
        }
    });
}

function downloadIDPMetaData() {
    idpMetadata = null;
    $.ajax({
        url: "/" + "identity/metadata/saml2",
        type: "GET",
        data: "",
        success: function (data) {
            if(data) {
                var element = document.createElement('a');
                element.setAttribute('href', 'data:text/xml;charset=utf-8,' + (new XMLSerializer()).serializeToString(data));
                element.setAttribute('download', 'WSO2Metadata.xml');
                element.style.display = 'none';
                document.body.appendChild(element);
                element.click();
                document.body.removeChild(element);
            }
        },
        error: function (e) {
            message({
                content: 'Error occurred while downloading IDP SAML metadata.', type: 'error', cbk: function () {
                }
            });
        }
    });
}

function    drawList() {
    var output = "";
    $("#listBody").empty();
    if (spList != null) {
        $('#spList').removeClass('hide');
        $('#emptyList').addClass('hide');
        for (var i in spList) {
            var sampleIcon ='';
            var appName = spList[i].applicationName;
            var spdesc = spList[i].description;
            var spimage = '<img src="images/is/custom.png " class="square-element">';
            var sampleIcon = '';

            if(appName == APP_NAME1 || appName == APP_NAME2) {<commit_msg>download Metdata in all browsers<commit_after>function deleteCustomSP(applicationName) {
    var str = PROXY_CONTEXT_PATH + "/" + ADMIN_PORTAL_NAME + "/serviceproviders/custom/controllers/custom/delete_finish.jag";
    $.ajax({
            url: str,
            type: "POST",
            data: "applicationName=" + applicationName + "&profileConfiguration=default" + "&cookie=" + cookie + "&user=" + userName,
        })
        .done(function (data) {
            reloadGrid();
            //message({content:'Successfully saved changes to the profile',type:'info', cbk:function(){} });

        })
        .fail(function () {
            message({
                content: 'Error while updating Profile', type: 'error', cbk: function () {
                }
            });

        })
        .always(function () {
            console.log('completed');
        });
}
/**
 * This method will delete a given application without page refresh
 * @param applicationName
 */
function deleteCustomSPWithoutRefresh(applicationName) {
    var str = "/" + ADMIN_PORTAL_NAME + "/serviceproviders/custom/controllers/custom/delete_finish.jag";
    $.ajax({
            url: str,
            async: false,
            type: "POST",
            data: "applicationName=" + applicationName + "&profileConfiguration=default" + "&cookie=" + cookie + "&user=" + userName,
        })
        .done(function (data) {


        })
        .fail(function () {
            message({
                content: 'Error while updating Profile', type: 'error', cbk: function () {
                }
            });

        })
        .always(function () {
            console.log('completed');
        });
}

function reloadGrid() {
    spList = null;
    $.ajax({
        url: "/" + ADMIN_PORTAL_NAME + "/serviceproviders/getSPList",
        type: "GET",
        data: "&cookie=" + cookie + "&user=" + userName,
        success: function (data) {
            if (data) {
                var resp = $.parseJSON(data);

                if (resp.success == false) {
                    if (typeof resp.reLogin != 'undefined' && resp.reLogin == true) {
                        window.top.location.href = window.location.protocol + '//' + serverUrl + '/' + ADMIN_PORTAL_NAME + '/logout.jag';
                    } else {
                        if (resp.message != null && resp.message.length > 0) {
                            message({
                                content: resp.message, type: 'error', cbk: function () {
                                }
                            });
                        } else {
                            message({
                                content: 'Error occurred while loading values for the grid.',
                                type: 'error',
                                cbk: function () {
                                }
                            });
                        }
                    }
                } else {
                    spList = resp.return;
                    if (spList != null && spList.constructor !== Array) {
                        var arr = [];
                        arr[0] = spList;
                        spList = arr;
                    }
                    if (spList.length <= APP_LIMIT) {
                        $('#searchBox').hide();
                    }
                    drawList();
                }
            } else {
                $('#spList').addClass('hide');
                $('#emptyList').removeClass('hide');
                $('#searchBox').hide();
            }
        },
        error: function (e) {
            message({
                content: 'Error occurred while loading values for the grid.', type: 'error', cbk: function () {
                }
            });
        }
    });
}

function downloadIDPMetaData() {
    idpMetadata = null;
    $.ajax({
        url: "/" + "identity/metadata/saml2",
        type: "GET",
        data: "",
        success: function (data) {
            if(data) {
                var metaDownload = window.document.createElement('a');
                metaDownload.href = window.URL.createObjectURL(new Blob([(new window.XMLSerializer()).serializeToString(data)], {type: 'text/xml'}));
                metaDownload.download = 'WSO2Metadata.xml';
                document.body.appendChild(metaDownload)
                metaDownload.click();
                document.body.removeChild(metaDownload)
            }
        },
        error: function (e) {
            message({
                content: 'Error occurred while downloading IDP SAML metadata.', type: 'error', cbk: function () {
                }
            });
        }
    });
}

function    drawList() {
    var output = "";
    $("#listBody").empty();
    if (spList != null) {
        $('#spList').removeClass('hide');
        $('#emptyList').addClass('hide');
        for (var i in spList) {
            var sampleIcon ='';
            var appName = spList[i].applicationName;
            var spdesc = spList[i].description;
            var spimage = '<img src="images/is/custom.png " class="square-element">';
            var sampleIcon = '';

            if(appName == APP_NAME1 || appName == APP_NAME2) {
{'fraction_non_alphanumeric': 0.13622409823484266, 'fraction_numerical': 0.0012471220260936301, 'mean_word_length': 1.344804318488529, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4935626', 'n_tokens_mistral': 2676, 'n_tokens_neox': 2568, 'n_words': 552}