{% extends "base.html" %}

{% block body_content %}
{{ super() }}

<style>
button
{
float:right;
}
</style>

<div class="container">
    <h1>Displaying a session list for {{ current_user.full_name }} !</h1>

    {% for (role, sessions) in all_sessions %}
    <h2> {{ role.name }}</h2>
    <table class="table table-bordered table-hover" >
        {% for session in sessions %}
        {% if session.type == 'stack' %}
        <tr>
            <td>
                <a href="/webgl-viewer/stack?db={{ role.db|string }}&sess={{ session.id|string }}" class="lead">{{ session.label }}</a>
            </td>
        </tr>
        {% else %}
        <tr>
            <td>
                <a href="{{ url_for('.view_a_session', database_obj=session.database, session_obj=session) }}" class="lead">{{ session.label }}</a>
            </td>
            {% if role.db_admin %}
            <td>
                <a href="{{ url_for('.sessionedit', sessdb=role.db.id, sessid=session.id) }}" class="lead">
                    <button type="button" class="btn btn-danger">Admin</button>
                </a>
            </td>
            {% endif %}
        </tr>
        {% endif %}
        {% endfor %}
    </table>
    <br>
    {% endfor %}
</div>
{% endblock %}

{% extends "base.html" %}

{% block body_content %}
{{ super() }}

<style>
button
{
float:right;
}
</style>

<div class="container">
    <h1>Displaying a session list for {{ current_user.full_name }} !</h1>

    {% for (role, sessions) in all_sessions %}
    <h2> {{ role.name }}</h2>
    <table class="table table-bordered table-hover" >
        {% for session in sessions %}
        {% if session.type == 'stack' %}
        <tr>
            <td>
                <a href="/webgl-viewer/stack?db={{ role.db|string }}&sess={{ session.id|string }}" class="lead">{{ session.label }}</a>
            </td>
        </tr>
        {% else %}
        <tr>
            <td>
                <a href="{{ url_for('.view_a_session', database_obj=role.db, session_obj=session) }}" class="lead">{{ session.label }}</a>
            </td>
            {% if role.db_admin %}
            <td>
                <a href="{{ url_for('.sessionedit', sessdb=role.db.id, sessid=session.id) }}" class="lead">
                    <button type="button" class="btn btn-danger">Admin</button>
                </a>
            </td>
            {% endif %}
        </tr>
        {% endif %}
        {% endfor %}
    </table>
    <br>
    {% endfor %}
</div>
{% endblock %}

Fix a performance regression when displaying the session list
Fix a performance regression when displaying the session list

Referencing 'session.database' inside the innermost loop caused additional
Mongo queries. Using 'role.db', which is already cached, improves the
performance of large page loads.
