function new_repo_prompt()

in htdocs/js/boxer.js [493:622]


function new_repo_prompt(canvas, login) {
    canvas.innerText = '';

    let title = document.createElement('h2');
    title.innerText = "Create a git repository:";
    canvas.appendChild(title);

    // Project dropdown
    let sel = document.createElement('select');
    sel.setAttribute('id', 'project');
    sel.setAttribute("onchange", "prep_new_repo(true);")
    let dl = document.createElement('option');
    dl.innerText = "--- Select a project ---";
    dl.disabled = false;
    dl.value = "";
    sel.appendChild(dl);
    for (let project of login.all_projects) {
        let disabled = true;
        if (login.credentials.admin || login.pmcs.includes(project)) {
            disabled = false;
        }
        let l = document.createElement('option');
        l.innerText = project;
        l.disabled = disabled;
        sel.appendChild(l);
    }
    let label = document.createElement('label');
    label.setAttribute("for", "project");
    label.innerText = "Project: ";
    canvas.appendChild(kvpair(label, sel));


    // Suffix?
    canvas.appendChild(br());
    let suffix = document.createElement('input');
    suffix.setAttribute("type" , "text");
    suffix.setAttribute("id" , "suffix");
    suffix.setAttribute("onkeyup", "prep_new_repo();")
    label = document.createElement('label');
    label.setAttribute("for", "suffix");
    label.innerText = "Optional repo sub-name: ";
    canvas.appendChild(kvpair(label, suffix));

    // Incubator Prefix?
    canvas.appendChild(br());
    let incubator = document.createElement('input');
    incubator.setAttribute("type" , "checkbox");
    incubator.setAttribute("id" , "incubator_prefix");
    incubator.setAttribute("onchange", "prep_new_repo();")
    incubator.setAttribute("checked", true);
    label = document.createElement('label');
    label.setAttribute("for", "iincubator_prefix");
    label.innerText = "Include incubator prefix: ";
    canvas.appendChild(kvpair(label, incubator));

    // Private?
    if (login_cached.credentials.admin) {
        canvas.appendChild(br());
        let priv = document.createElement('input');
        priv.setAttribute("type" , "checkbox");
        priv.setAttribute("id" , "private");
        priv.setAttribute("onchange", "prep_new_repo();")
        label = document.createElement('label');
        label.style.color = 'maroon';
        label.setAttribute("for", "private");
        label.innerText = "Make repository private*: ";
        canvas.appendChild(kvpair(label, priv));
    }

    // Commit mail target
    canvas.appendChild(br());
    let commit = document.createElement('input');
    commit.setAttribute("type" , "text");
    commit.style.width = "200px";
    commit.setAttribute("id" , "commit");
    commit.setAttribute("onkeyup", "prep_new_repo();")
    label = document.createElement('label');
    label.setAttribute("for", "commit");
    label.innerText = "Commit mailing list target: ";
    canvas.appendChild(kvpair(label, commit));

    // Dev mail target
    canvas.appendChild(br());
    let dev = document.createElement('input');
    dev.setAttribute("type" , "text");
    dev.setAttribute("id" , "dev");
    dev.style.width = "200px";
    dev.setAttribute("onkeyup", "prep_new_repo();")
    label = document.createElement('label');
    label.setAttribute("for", "dev");
    label.innerText = "Issue/PR mailing list target: ";
    canvas.appendChild(kvpair(label, dev));


    // Repo result
    canvas.appendChild(br());
    let final_repo_name = document.createElement('div');
    final_repo_name.style.padding = '10px'
    final_repo_name.style.color = 'blue'
    final_repo_name.setAttribute("id", "final_repo_name");
    canvas.appendChild(final_repo_name);

    // Submit button
    let sbmt = document.createElement('input');
    sbmt.setAttribute("type" ,"submit");
    sbmt.setAttribute("id" ,"sbmt");
    sbmt.setAttribute("onclick" ,"prep_new_repo(false, true);");
    sbmt.disabled = true;
    sbmt.value = "Create repository";
    let txt = document.createTextNode('');
    canvas.appendChild(kvpair(txt, sbmt));

    if (login_cached.credentials.admin) {
        canvas.appendChild(br());
        let privwarn = document.createElement('p');
        privwarn.style.fontSize = "0.75rem"
        privwarn.innerText = "*Private repositories are only visible to the (P)PMC of a project. This applies to both gitbox and github";
        canvas.appendChild(privwarn)
        canvas.appendChild(br());
    }

    canvas.appendChild(br());
    let a = document.createElement('a');
    a.setAttribute("href" , "https://s.apache.org/asfyaml");
    a.setAttribute("target" , "_blank");
    a.innerText = ".asf.yaml";
    canvas.appendChild(document.createTextNode("You may fine tune these settings later using "));
    canvas.appendChild(a);
    canvas.appendChild(document.createTextNode(" in the main branch of your repository."));
}