mwielgoszewski/doorman

View on GitHub
doorman/templates/manage/tables/results.html

Summary

Maintainability
Test Coverage
                {% set columns = results | first | attr('columns') | list | sort %}

                <div class="table-responsive">
                    <table class="table table-striped table-condensed">
                        <thead>
                            <th>node</th>
                            <th>activity</th>
                            <th>timestamp</th>
                            {% for column in columns %}
                            <th>{{ column }}</th>
                            {% endfor %}
                        </thead>

                        <tbody>
                            {% for result in results %}
                            <tr>
                                <td>
                                    {% if result.node is defined %}
                                    <a href="{{ url_for('.get_node', node_id=result.node.id) }}">{{ result.node.host_identifier }}</a>
                                    {% elif result.distributed_query is defined %}
                                    <a href="{{ url_for('.get_node', node_id=result.distributed_query.node.id) }}">{{ result.distributed_query.node.host_identifier }}</a>
                                    {% endif %}
                                </td>
                                <td>{{ result.action }}</td>
                                <td>{{ result.timestamp }}</td>
                                {% for column in columns %}
                                <td>
                                    <a href="{{ url_for('manage.search', **{'columns.' + column: result.columns[column]}) }}">
                                    {{ result.columns[column] }}
                                    </a>
                                </td>
                                {% endfor %}
                            </tr>
                            {% endfor %}
                        </tbody>

                    </table>
                </div>