ii-assistent/hunter/templates/sources.html

7 lines
2.4 KiB
HTML

{% extends 'base.html' %}{% from 'macros.html' import page_header,empty with context %}
{% block content %}{{ page_header(t('sources'),t('sources_hint')) }}
{% if user.role=='admin' %}<details class="panel"><summary>+ {{ t('add') }}</summary><form method="post" class="filter-panel"><input type="hidden" name="csrf" value="{{ csrf }}"><label>{{ t('name') }}<input name="name" required maxlength="100"></label><label class="search-label">{{ t('url') }}<input type="url" name="url" required></label><label>{{ t('category') }}<select name="category">{% for category in categories %}<option>{{ category }}</option>{% endfor %}</select></label><label>{{ t('country') }}<input name="country" required maxlength="60"></label><button class="button primary">{{ t('add') }}</button></form></details>{% endif %}
<div class="panel table-wrap"><table><thead><tr>{% for key in ['name','category','country','status','last_update','materials'] %}<th>{{ t(key) }}</th>{% endfor %}{% if user.role=='admin' %}<th>{{ t('settings') }}</th>{% endif %}</tr></thead><tbody>{% for source in sources %}<tr><td><a href="{{ source.url }}" target="_blank" rel="noopener noreferrer"><strong>{{ source.name }} ↗</strong></a></td><td>{{ source.category }}</td><td>{{ source.country }}</td><td><span class="status-dot {{ source.status }}"></span>{{ t(source.status if source.enabled else 'disabled') }}</td><td>{{ day(source.updated) }}</td><td>{{ source.count }}</td>{% if user.role=='admin' %}<td><form method="post" action="{{ url_for('web.toggle_source',item_id=source.id) }}"><input type="hidden" name="csrf" value="{{ csrf }}"><button class="button text-button">{{ t('disable' if source.enabled else 'enable') }}</button></form></td>{% endif %}</tr>{% endfor %}</tbody></table></div>
{% if user.role in ['admin','analyst'] %}<form class="action-row" method="post" action="{{ url_for('web.refresh') }}"><input type="hidden" name="csrf" value="{{ csrf }}"><button class="button primary">↻ {{ t('update') }}</button></form>{% endif %}
<h2>{{ t('logs') }}</h2><div class="panel table-wrap"><table><thead><tr><th>{{ t('published') }}</th><th>{{ t('name') }}</th><th>{{ t('status') }}</th><th>{{ t('materials') }}</th></tr></thead><tbody>{% for item in logs %}<tr><td>{{ item.created[:16]|replace('T',' ') }}</td><td>{{ t('connection') if item.name=='analysis' else item.name }}</td><td>{{ t(item.status) }}</td><td>{{ item.added }}</td></tr>{% endfor %}</tbody></table>{% if not logs %}{{ empty() }}{% endif %}</div>{% endblock %}