<h1 class="my-3">New Crawl</h1>

<div class="my-3 p-3 border bg-light">
    <p>
    This will crawl on node {{node.id}}.
    </p><p>
    If existing crawl data is provided, the crawler may perform a smart crawl that uses the existing data
    as a starting point.  It will use the existing crawl data to perform conditional GETs on the domains in the
    crawl spec.  If the document has changed, it will be re-crawled.  If it has not changed, it will be skipped,
    and the previous data will be retained.  This is both faster and easier on the target server.
    </p>
    <p><span class="text-danger">Warning</span> Ensure <a href="?view=download-sample-data">downloaded sample data</a>
        has not been loaded onto this instance before performing this action, otherwise those domains will also be crawled!</p>
    <p>Use the <a href="/domain">Domains</a> view to inspect and manage known domains. </p>
</div>

<form method="post" action="actions/new-crawl">
<p>Select the crawl data to use:</p>
<table class="table">
    <tr>
        <th>Use</th>
        <th>Path</th>
        <th>Description</th>
        <th>Details</th>
    </tr>
{{#each allCrawlData}}
    <tr>
        <td><input {{#if active}}checked{{/if}}  {{#if new}}disabled{{/if}} {{#if delete}}disabled{{/if}}  class="form-check-input" type="radio" name="source" id="{{id}}" value="{{id}}"></td>
        <td><label for="{{id}}" class="form-check-label" >{{path}}</label></td>
        <td>{{description}}
            <span class="text-danger">{{#if new}}[CREATING]{{/if}}</span>
            <span class="text-danger">{{#if delete}}[DELETING]{{/if}}</span>
        </td>
        <td><a href="/nodes/{{node}}/storage/details?fid={{id}}">[Details]</a></td>
    </tr>
{{/each}}
    <tr>
        <td>
            <input class="form-check-input" type="radio" name="source" id="-1" value="-1">
        </td>
        <td colspan="3">
            <label for="-1" class="form-check-label"><em>Crawl without referencing existing crawl data, using the <a href="/domain">domains in the database</a>.</em></label>
        </td>
    </tr>
</table>

    <button
            class="btn btn-primary me-md-2"
            onclick="return confirm('Confirm recrawl of  the selected data on node {{node.id}}');"
            type="submit">
        Trigger Recrawl</button>
</form>