<h1 class="my-3">Process Data</h1>

<div class="my-3 p-3 border bg-light">
    <p>
        This will reprocess a set of crawl data on Node {{node.id}}.
    </p>
    <p>
        The reprocessing will extract keywords, titles, and other metadata from the raw crawl data
        and generate parquet files that can be loaded into the index.
    </p>
</div>

<form method="post" action="actions/process">
<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]</td>
        </tr>
    {{/each}}
</table>
    <div class="form-group mt-3 mb-5">
        <div class="form-check form-switch mb-3">
            <input class="form-check-input" type="checkbox" name="autoload" id="autoload" checked>
            <label for="autoload">Load Automatically</label>
        </div>
        <small class="text-muted mt-3">
            If <em>enabled</em>, the data will be loaded into the search engine automatically after it is created.  Depending on how the
            node is <a href="/nodes/{{node.id}}/configuration">configured</a>, the intermediate processed data may be deleted
            after loading.  If <em>disabled</em>, the data will be processed, but loading needs to be <a href="?view=load">triggered manually</a>.
            This is useful if multiple data sets are to be loaded, such as when intermingling crawled data with sideloaded data.
        </small>
    </div>

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