All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ui.static.acls-js.editPrincipal.js Maven / Gradle / Ivy

There is a newer version: 0.8.0
Show newest version
$(document).ready(function () {
    $("#save-btn").click(editPrincipalAcls);
});

function editPrincipalAcls() {
    let principalAcls = extractPrincipalAcls();
    doEditPrincipalAcls(principalAcls);
}

function doEditPrincipalAcls(principalAcls) {
    let validateErr = validatePrincipalAcls(principalAcls);
    if (validateErr) {
        showOpError(validateErr);
        return;
    }
    let updateMsg = extractUpdateMessage();
    if (updateMsg.trim() === "") {
        showOpError("Please specify update reason");
        return;
    }
    updateMsg = appendJiraIssuesIfAny(updateMsg, principalAcls.description);
    showOpProgress("Saving principal ACLs...");
    $
        .ajax("api/acls?message=" + encodeURI(updateMsg) + "&" + targetBranchUriParam(), {
            method: "PUT",
            contentType: "application/json; charset=utf-8",
            data: JSON.stringify(principalAcls)
        })
        .done(function () {
            location.href = urlFor("acls.showAllPrincipalAcls", {principal: principalAcls.principal});
        })
        .fail(function (error) {
            let errorMsg = extractErrMsg(error);
            showOpError("Creation failed: " + errorMsg);
        });
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy