IdentityPython/pyFF

View on GitHub
src/pyff/templates/about.html

Summary

Maintainability
Test Coverage
{% extends "ui.html" %}
{% block headline %}{{ gettext('About this server') }}{% endblock %}
{% block content %}
    <div class="row">
        <div class="col-xs-3 col-md-3">
            <ul class="nav nav-pills flex-column">
                <li class="active nav-item"><a href="#info" class="nav-link" data-toggle="tab">{{ gettext('Server Info') }}</a>
                <li class="nav-item"><a href="#repo" class="nav-link" data-toggle="tab">{{ gettext('Resources') }}</a></li>
                <li class="nav-item"><a href="#pipeline" class="nav-link" data-toggle="tab">{{ gettext('Pipeline') }}</a></li>
            </ul>
        </div>
        <div class="col-xs-9 col-md-9">
            <div class="tab-content">
                <div class="tab-pane active" id="info">
                    <dl class="row">
                        <dt class="col-sm-3">pyFF {{ gettext('version') }}</dt>
                        <dd class="col-sm-9">{{ version }}</dd>
                        <dt class="col-sm-3">Cherrypy {{ gettext('version') }}</dt>
                        <dd class="col-sm-9">{{ cversion }}</dd>
                        <dt class="col-sm-3">{{ gettext('Startup arguments') }}</dt>
                        <dd class="col-sm-9">{{ cmdline }}</dd>
                        <dt class="col-sm-3">{{ gettext('System information') }}</dt>
                        <dd class="col-sm-9">{{ sysinfo }}</dd>
                    </dl>
                </div>
                <div class="tab-pane" id="pipeline">
                    {% for p in plumbings %}
                    <pre class="pre-scrollable prettyprint">{{ p | to_yaml }}</pre>
                    {% endfor %}
                </div>
                <div class="tab-pane" id="repo">
                    {% for resource in repo.rm.walk() %}
                    {% set info = resource.info %}
                    <div class="card">
                        <div class="card-header {% if info.Expired %}bg-danger{% elif info['Validation Errors'] %}bg-warning{% else %}bg-success{% endif %}">
                            <h4 class="card-title text-truncate">{{ resource.url }}</h4>
                        </div>
                        <div class="card-body small">
                            {% if info['Description'] %}
                            <p class="card-text">{{ info['Description'] }}</p>
                            {% endif %}
                            <table class="table table-bordered table-striped" id="{{resource.url|sha1}}">
                                {% if resource.children %}
                                <tr>
                                    <th class="align-middle" scope="row">Children</th>
                                    <td>
                                        <ul class="list-unstyled">
                                            {% for c in resource.children %}
                                            <li>
                                                <b><a href="#{{c.url|sha1}}">{{c.url|truncate(60)}}</a></b>
                                                <dl class="row container">
                                                    {% for k,v in c.opts.items() %}
                                                    <dt class="col-md-4">{{k}}</dt>
                                                    <dd class="col-md-8">{{v}}</dd>
                                                    {% endfor %}
                                                </dl>
                                            </li>
                                            {% endfor %}
                                        </ul>
                                    </td>
                                {% endif %}
                                </tr>
                                {% for k,v in info.items() %}
                                {% if k and v and not k in ('URL','Description','Validation Errors','Status', 'Expired') %}
                                <tr>
                                    <th class="align-middle" scope="row">{{ k|trim }}</th>
                                    <td>
                                        {% if v is string %}
                                        {{ v|trim|truncate(60) }}
                                        {% elif v is mapping %}
                                            <dl class="row">
                                                {% for h,hv in v.items() %}
                                                {% if h and hv %}
                                                <dt class="col-sm-3">{{h|trim}}</dt>
                                                <dd class="col-sm-9">{{hv|trim|truncate(40)}}</dd>
                                                {% endif %}
                                                {% endfor %}
                                            </dl>
                                        {% elif v is iterable %}
                                            <ul class="list-unstyled">
                                            {% for vv in v %}
                                                <li>{{ vv }}</li>
                                            {% endfor %}
                                            </ul>
                                        {% endif %}
                                    </td>
                                </tr>
                                {% endif %}
                                {% endfor %}
                            </table>
                            {% if info['Validation Errors'] %}
                            <table class="table table-bordered table-striped">
                                {% for ei,ee in info['Validation Errors'].items() %}
                                <tr>
                                    <th class="align-middle" scope="row">{{ei|trim|truncate(30)}}</th>
                                    <td>{{ee|trim}}</td>
                                </tr>
                                {% endfor %}
                            </table>
                            {% endif %}
                        </div>
                    </div>
                    {% endfor %}
                </div>
            </div>
        </div>
    </div>
{% endblock %}