<commit_before><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?python import raa.templates.master ?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
    py:extends="raa.templates.master">
    <!--
         Copyright (c) 2005-2007 rPath, Inc.
         All rights reserved
    -->
    <head>
        <title>Mirror Pre-load</title>
        <script type="text/javascript" src="${tg.url('/static/javascript/raa.js?v=14')}"></script>

        <script type="text/javascript">
            var schedId = ${schedId};

            function onWritePreloads(req) {
                if(req.done) {
                    projList = UL();
                    var candidates = req.projects.length;

                    for(var i in req.projects) {
                        project = req.projects[i][0];
                        hostname = req.projects[i][1];

                        if(req.preloadErrors[hostname]) {
                            error = req.preloadErrors[hostname];
                            appendChildNodes(projList, LI({}, project, SPAN({'style': 'color: red;'}, error)));
                            candidates--;
                        } else {
                            appendChildNodes(projList, LI({}, project, " - ", SPAN({'style': 'color: green;'}, "OK")));
                        }
                    }
                    swapDOM($('preloadProjects'), projList);
                    replaceChildNodes($('preloadCount'), "Projects eligible for mirror pre-loading: " + candidates);

                    if(candidates > 0)
                        showElement($('startButton'));
                } else {
                    setTimeout(function () {getPreloads();}, 500);
                }
            }

            addLoadEvent(function() {
                refreshLog();
                getPreloads();
            });

            function getPreloads() {
                d = postRequest("callGetPreloads", ['schedId'], [schedId]);
                d = d.addCallback(callbackCheckError);
                d = d.addCallback(onWritePreloads);
                d = d.addErrback(callbackErrorGeneric);
            }

            function onRefreshLog(req) {
                logText = req.log;

                ta = TEXTAREA({'id': 'preloadLog', 'rows': '15', 'cols': '90'}, logText);
                swapDOM($('preloadLog'), ta);
                scrollToBottom('preloadLog');
                setTimeout("refreshLog()", 10000);
            }

            function refreshLog() {
                d = postRequest("callGetLog");
                d = d.addCallback(callbackCheckError);
                d = d.addCallback(onRefreshLog);
                d = d.addErrback(callbackErrorGeneric);
            }

            function startPreload() {
                d = postRequest("callStartPreload");
                hideElement($('startButton'));
            }

            // scroll to the bottom of a textarea
            function scrollToBottom(elName) {
                el = $(elName);
                el.scrollTop = el.scrollHeight;
            }
        </script>
    </head>

    <body id="middleWide">
        <div>
            <h3>Mirror Pre-Load:</h3>
            <p id="preloadPrompt">The mirror pre-load process will convert the following external projects into mirrored repositories:</p>
            <p id="preloadProjects">
                Please wait while the list of projects available to pre-load is retrieved...
            </p>
            <p id="preloadCount"></p>
            <button onclick="javascript:startPreload();" style="display: none;" id="startButton">Start Preloading</button>
            <hr />
            <div id="logArea">
                <h4>Pre-load activity log:</h4><commit_msg>display 'in progress' message when backend is running<commit_after><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?python import raa.templates.master ?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
    py:extends="raa.templates.master">
    <!--
         Copyright (c) 2005-2007 rPath, Inc.
         All rights reserved
    -->
    <head>
        <title>Mirror Pre-load</title>
        <script type="text/javascript" src="${tg.url('/static/javascript/raa.js?v=14')}"></script>

        <script type="text/javascript">
            var schedId = ${schedId};

            function onWritePreloads(req) {
                if(req.done) {
                    projList = UL();
                    var candidates = req.projects.length;

                    for(var i in req.projects) {
                        project = req.projects[i][0];
                        hostname = req.projects[i][1];

                        if(req.preloadErrors[hostname]) {
                            error = req.preloadErrors[hostname];
                            appendChildNodes(projList, LI({}, project, SPAN({'style': 'color: red;'}, error)));
                            candidates--;
                        } else {
                            appendChildNodes(projList, LI({}, project, " - ", SPAN({'style': 'color: green;'}, "OK")));
                        }
                    }
                    swapDOM($('preloadProjects'), projList);
                    replaceChildNodes($('preloadCount'), "Projects eligible for mirror pre-loading: " + candidates);
                    getElement('preloadPrompt').style.display = ''; 

                    if(candidates > 0)
                        showElement($('startButton'));
                } else {
                    setTimeout(function () {getPreloads();}, 500);
                }
            }

            addLoadEvent(function() {
                refreshLog();
                getPreloads();
            });

            function getPreloads() {
                d = postRequest("callGetPreloads", ['schedId'], [schedId]);
                d = d.addCallback(callbackCheckError);
                d = d.addCallback(onWritePreloads);
                d = d.addErrback(callbackErrorGeneric);
            }

            function onRefreshLog(req) {
                logText = req.log;

                ta = TEXTAREA({'id': 'preloadLog', 'rows': '15', 'cols': '90'}, logText);
                swapDOM($('preloadLog'), ta);
                scrollToBottom('preloadLog');
                setTimeout("refreshLog()", 10000);
            }

            function refreshLog() {
                d = postRequest("callGetLog");
                d = d.addCallback(callbackCheckError);
                d = d.addCallback(onRefreshLog);
                d = d.addErrback(callbackErrorGeneric);
            }

            function startPreload() {
                d = postRequest("callStartPreload");
                hideElement($('startButton'));
            }

            // scroll to the bottom of a textarea
            function scrollToBottom(elName) {
                el = $(elName);
                el.scrollTop = el.scrollHeight;
            }
        </script>
    </head>

    <body id="middleWide">
        <div>
            <h3>Mirror Pre-Load:</h3>
            <p id="preloadPrompt" style="display: ${inProgress and 'none' or ''}">The mirror pre-load process will convert the following external projects into mirrored repositories:</p>
            <p id="preloadProjects">
                <div py:strip="True" py:if="inProgress">
                    A pre-loading operation is in progress.  Please see the activity log for details.
                </div>
                <div py:strip="True" py:if="not inProgress">
                    Please wait while the list of projects available to pre-load is retrieved...
                </div>
            </p>
            <p id="preloadCount"></p>
            <button onclick="javascript:startPreload();" style="display: none;" id="startButton">Start Preloading</button>
            <hr />
            <div id="logArea">
                <h4>Pre-load activity log:</h4>
{'fraction_non_alphanumeric': 0.13366398016119033, 'fraction_numerical': 0.009919404835709857, 'mean_word_length': 1.5237797246558198, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 4}, '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': '3731340', 'n_tokens_mistral': 2229, 'n_tokens_neox': 2046, 'n_words': 425}