{% extends 'main_header.html' %}
{% block body %}
<table style="width: 90%" class="one-column-emphasis context-menu">
    <thead>
    <tr class="oce-first">
        <th scope="col"><input type="checkbox" name="select_all" onclick="toggle_all_checkboxes(this)"/> </th>
        <th scope="col">Trigger On/Alive</th>
        <th scope="col">Process Name</th>
        <th scope="col">Trigger Frequency</th>
        <th scope="col">Trigger Now</th>
        <th scope="col">Next Run In</th>
        <th scope="col">Next Timeperiod</th>
    </tr>
    </thead>
    <tbody>

    {%- for row in details.managed_entries -%}
    {%- if row[0] and not row[1] or not row[0] and row[1] -%}
    <tr class="state_inconsistent">
    {%- elif not row[1] -%}
    <tr class="state_inactive">
    {%- else -%}
    <tr>
    {%- endif -%}
        <td>
            {% set value = "{ process_name: '" + row[2] + "', timeperiod: 'NA' }" %}
            <input type="checkbox" name="batch_processing" value="{{ value }}"/>
        </td>
        <td>{{ row[0] }} / {{ row[1] }}</td>
        <td>{{ row[2] }}</td>
        <td>
            <form method="GET" action="/action_change_interval/">
                <input type="hidden" name="process_name" value="{{ row[2] }}" />
                <input type="hidden" name="timeperiod" value="NA" />
                <input type="text" size="8" maxlength="32" name="interval" value="{{ row[3] }}" />
                <input type="submit" value="Apply" />
            </form>
        </td>
        <td>
            <form method="GET" action="/action_trigger_now/">
                <input type="hidden" name="process_name" value="{{ row[2] }}" />
                <input type="hidden" name="timeperiod" value="NA" />
                <input type="submit" value="Trigger" />
            </form>
        </td>
        <td>{{ row[4] }}</td>
        <td>{{ row[5] }}</td>
    </tr>
    {%- endfor -%}

    </tbody>
</table>

<table style="width: 90%" class="one-column-emphasis">
    <thead>
    <tr class="oce-first">
        <th scope="col">Resident Memory</th>
        <th scope="col">Virtual Memory</th>
        <th scope="col">% CPU Core Load</th>
        <th scope="col">Available Physical Memory</th>
        <th scope="col">Available Virtual Memory</th>
    </tr>
    </thead>
    <tbody>

    <tr>
        <td>{{ details.footprint[0] }}</td>
        <td>{{ details.footprint[1] }}</td>
        <td>{{ details.footprint[2] }}</td>
        <td>{{ details.footprint[3] }}</td>
        <td>{{ details.footprint[4] }}</td>
    </tr>

    </tbody>
</table>

<div class="context_menu_hide" id="rmenu">
    <ul>
        <li>
            <a onclick="process_batch('action_activate_trigger', false)">Activate</a>
        </li>
        <li>
            <a onclick="process_batch('action_deactivate_trigger', false)">Deactivate</a>
        </li>
    </ul>
</div>

{% endblock %}
