mirrormanager-rocky/templates/rocky/host.html

270 lines
11 KiB
HTML
Raw Permalink Normal View History

2024-08-29 23:13:29 +00:00
{% extends "master.html" %}
{% from "_macros.html" import host_form, export_compliance %}
{% block title %}Host{% endblock %}
{%block tag %}home{% endblock %}
{% block content %}
<div class="mt-3 mb-4 d-flex justify-content-between align-items-center">
<div>
<h2 class="mb-0"><span class="fa fa-server"></span> {{ host.name }}</h2>
</div>
<form method="POST"
action="{{ url_for('base.host_drop', host_id=host.id) }}">
{{ form.csrf_token }}
<button
class="btn btn-danger"
onclick="return confirm('You sure you want to delete this host?');"
title="Delete host">
<span class="fa fa-trash"></span>
Delete Host
</button>
</form>
</div>
<div class="row">
<div class="col-lg-3">
<div>
<strong>Site:</strong>
<span class="fa fa-globe"></span> <a href="{{ url_for('base.site_view', site_id=host.site_id) }}">{{ host.site.name }}</a>
</div>
{% if host.private %}
<div> <strong>Last Checked In:</strong> {{ host.last_checked_in or '-' }} </div>
{% endif %}
{% if not host.private %}
<div><strong>Last Crawled:</strong> {% if host.last_crawled %} {{ host.last_crawled
}} <a href="{{url_for('base.crawler_log', host_id=host.id)}}">[Log]</a> {% else %} never {% endif %} </div>
<div><strong>Last Crawl Duration:</strong> {{ host.last_crawl_duration }} seconds</div>
{% if host.crawl_failures > 0 %}
<div><strong>Number of consecutive crawl failures:</strong> {{ host.crawl_failures }} </div>
{% endif %}
{% endif %}
</div>
<div class="col-lg-9">
<div class="card">
<div class="card-header">
<h4 class="mb-0">Host Configuration</h4>
</div>
<div class="card-body">
{{host_form(form, is_admin, action="Update")}}
</div>
</div>
{%- if config['MASTER_RSYNC_ACL'] -%}
<div class="card my-3">
<div class="card-header d-flex justify-content-between align-items-center">
<h4 class="mb-0">Master rsync server Access Control List IPs</h4>
<a class="btn btn-sm btn-outline-primary" href="{{ url_for('base.host_acl_ip_new', host_id=host.id) }}">Add rsync ACL</a>
</div>
{% if host.acl_ips %}
<ul class="list-group list-group-flush">
{% for acl in host.acl_ips %}
<li class="list-group-item">
<form class="icon" method="POST"
action="{{ url_for('base.host_acl_ip_delete', host_id=host.id, host_acl_ip_id=acl.id) }}">
{{ acl.ip }}
{{ form.csrf_token }}
<button
onclick="return confirm('You sure you want to delete this ACL?');"
title="Delete ACL IP">
<span class="icon icon-trash blue"></span>
</button>
</form>
</li>
{% endfor %}
</ul>
{% else %}
<div class="card-body bg-light">
<h5 class="text-center text-secondary">No Master rsync ACLs Defined</h5>
</div>
{% endif %}
</div>
{% endif %}
<div class="card my-3">
<div class="card-header d-flex justify-content-between align-items-center">
<h4 class="mb-0">Site-local Netblocks</h4>
<a class="btn btn-sm btn-outline-primary" href="{{ url_for('base.host_netblock_new', host_id=host.id) }}">Add Netblock</a>
</div>
{% if host.netblocks %}
<ul class="list-group list-group-flush">
{% for netblock in host.netblocks %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<span><code>{{ netblock.netblock }}</code> {{ netblock.name }}</span>
<form method="POST"
action="{{ url_for('base.host_netblock_delete', host_id=host.id,
host_netblock_id=netblock.id) }}">
{{ form.csrf_token }}
<button
class="btn btn-sm btn-outline-danger"
onclick="return confirm('You sure you want to delete this netblock?');"
title="Delete netblock"><span class="fa fa-trash fa-lg"></span> Delete Netblock
</button>
</form>
</li>
{% endfor %}
</ul>
{% else %}
<div class="card-body bg-light">
<h5 class="text-center text-secondary">No Site-local Netblocks Defined</h5>
</div>
{% endif %}
</div>
<div class="card my-3">
<div class="card-header d-flex justify-content-between align-items-center">
<h4 class="mb-0">Peer ASNs</h4>
{% if is_admin %}
<a class="btn btn-sm btn-outline-primary" href="{{ url_for('base.host_asn_new', host_id=host.id) }}">Add Peer ASN</a>
{% else %}
<span class="text-subtle">Only Admins can change Peer ASNs</span>
{% endif %}
</div>
{% if host.peer_asns %}
<ul class="list-group list-group-flush">
{% for asn in host.peer_asns %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>{{ asn.asn }}</span>
{% if is_admin %}
<form method="POST"
action="{{ url_for('base.host_asn_delete', host_id=host.id,
host_asn_id=asn.id) }}">
{{ form.csrf_token }}
<button
class="btn btn-sm btn-outline-danger"
onclick="return confirm('You sure you want to delete this peer ASN?');"
title="Delete Peer ASN"><span class="fa fa-trash fa-lg"></span> Delete Peer ASN
</button>
</form>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<div class="card-body bg-light">
<h5 class="text-center text-secondary">No Peer ASNs Defined</h5>
</div>
{% endif %}
</div>
<div class="card my-3">
<div class="card-header d-flex justify-content-between align-items-center">
<h4 class="mb-0">Countries Allowed</h4>
<a class="btn btn-sm btn-outline-primary" href="{{ url_for('base.host_country_new', host_id=host.id) }}">Add Country</a>
</div>
{% if host.countries %}
<ul class="list-group list-group-flush">
{% for country in host.countries %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<span>{{country.country.code}}</span>
<form method="POST"
action="{{ url_for('base.host_country_delete', host_id=host.id,
host_country_id=country.id) }}">
{{ form.csrf_token }}
<button
class="btn btn-sm btn-outline-danger"
onclick="return confirm('You sure you want to delete this country?');"
title="Delete country"><span class="fa fa-trash fa-lg"></span> Delete Country
</button>
</form>
</li>
{% endfor %}
</ul>
{% else %}
<div class="card-body bg-light">
<h5 class="text-center text-secondary">No Countries Allowed defined</h5>
</div>
{% endif %}
</div>
<div class="card my-3">
<div class="card-header d-flex justify-content-between align-items-center">
<h4 class="mb-0">Categories Carried</h4>
<div>
<a class="btn btn-sm btn-outline-primary" href="{{ url_for('base.host_category_new', host_id=host.id) }}">Add Category</a>
</div>
</div>
{% if host.categories %}
<ul class="list-group list-group-flush">
{% for category in host.categories %}
<li class="list-group-item">
<div class="d-flex justify-content-between align-items-center mb-1">
<strong>{{ category.category.name }}</strong>
<div class="d-flex">
<a class="btn btn-sm btn-outline-primary me-1" href="{{ url_for('base.host_category_url_new', host_id=host.id,
hc_id=category.id) }}">Add URL</a>
<form method="POST"
action="{{ url_for('base.host_category_delete', host_id=host.id,
hc_id=category.id) }}">
{{ form.csrf_token }}
<button
class="btn btn-sm btn-outline-danger"
onclick="return confirm('You sure you want to delete this category?');"
title="Delete Category"><span class="fa fa-trash fa-lg"></span> Delete Category
</button>
</form>
</div>
</div>
<div class="card">
{% if category.urls %}
<ul class="list-group list-group-flush">
{% for url in category.urls %}
<li class="list-group-item">
<form method="POST" class="d-flex align-items-center justify-content-between"
action="{{ url_for('base.host_category_url_delete', host_id=host.id,
hc_id=category.id, host_category_url_id=url.id) }}">
{{ url.url }}
{{ form.csrf_token }}
<button
class="btn btn-sm btn-outline-danger"
onclick="return confirm('You sure you want to delete this URL?');"
title="Delete URL"><span class="fa fa-trash fa-lg"></span>
</button>
</form>
</li>
{% endfor %}
</ul>
{% else %}
<div class="card-body bg-light">
<h5 class="text-center text-secondary">No URLS</h5>
</div>
{% endif %}
{% if category.directories %}
<div class="accordion accordion-flush" id="accordion-category-{{category.id}}">
<div class="accordion-item">
<h2 class="accordion-header fw-bold" id="heading-category-{{category.id}}">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapse-category-{{category.id}}" aria-expanded="false" aria-controls="flush-collapseOne">
<strong>Up-to-Date Directories this host carries <span class="badge bg-primary"> {{category.directories|length}}</span></strong>
</button>
</h2>
<div id="collapse-category-{{category.id}}" class="accordion-collapse collapse" aria-labelledby="#heading-category-{{category.id}}" data-bs-parent="#accordion-category-{{category.id}}">
<div class="accordion-body">
<ul>
{% for dir in category.directories %}
{% if dir.up2date %}
<li>{{ dir.path }}</li>
{% endif %}
{% endfor %}
</ul>
</div>
</div>
</div>
</div>
2024-08-29 23:13:29 +00:00
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% else %}
<div class="card-body bg-light">
<h5 class="text-center text-secondary">No Categories Carried defined</h5>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}