{% extends 'layout.html' %}

{% block content %}
    <div class="row mt-2">
        <div class="col-lg-12">
            <strong>Ruleset</strong> - {{ entries.name }} (v{{ entries.version }})
            <table class="table">
                <thead>
                    <th>Key</th>
                    <th>Name</th>
                    <th>Description</th>
                    <th>Severity</th>
                    <th>Matches</th>
                    <th>Actions</th>
                </thead>
                <tbody>
                    {% for entry in entries.matches %}
                        <tr>
                            <td>{{ entry.key }}</td>
                            <td>{{ entry.text }}</td>
                            <td>{{ entry.description[:100] }}...</td>
                            <td><div class="badge badge-{{ entry.severity }}">{{ entry.severity }}</div> </td>
                            <td>{{ entry.patterns | count }}</td>
                            <td>
                                <a href="{{ url_for('get_database_entry', entry=entry.key) }}" class="btn btn-info btn-sm">
                                    <i class="fas fa-pencil"></i> Edit
                                </a>
                            </td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
            <a href="{{ url_for('get_database_entry', entry='new') }}" class="btn btn-success"><i class="fas fa-plus"></i> </a>
        </div>
    </div>
{% endblock %}