hobo/hobo/templates/hobo/home.html

93 lines
3.0 KiB
HTML

{% extends "hobo/base.html" %}
{% load i18n %}
{% block appbar %}
<h2>{% trans 'System' %}</h2>
<span class="actions">
<a class="extra-actions-menu-opener"></a>
<ul class="extra-actions-menu">
{% if has_authentic %}
<li><a href="{% url 'profile-home' %}">{% trans 'User Profile' %}</a></li>
{% endif %}
<li><a href="{% url 'theme-home' %}">{% trans 'Theme' %}</a></li>
<li><a href="{% url 'emails-home' %}">{% trans 'Emails' %}</a></li>
{% if has_authentic %}
<li><a href="{% url 'franceconnect-home' %}">FranceConnect</a></li>
{% endif %}
<li><a href="{% url 'matomo-home' %}">{% trans 'User tracking' %}</a></li>
<li><a href="{% url 'environment-home' %}">{% trans 'Services' %}</a></li>
<li><a href="{% url 'environment-variables' %}">{% trans 'Variables' %}</a></li>
</ul>
</span>
{% endblock %}
{% block content %}
{% if services %}
<div id="services">
{% for service in services %}
<div class="service-{{ service.Extra.service_id }}"
data-service-slug="{{ service.slug }}">
<h3>{{ service.title }} <a href="{{ service.base_url }}">{{ service.base_url }}</a></h3>
<p>
<span class="checking">{% trans "checking..." %}</span>
<span style="display: none" class="dns">{% trans "DNS" %}</span>
<span style="display: none" class="certificate">{% trans "Certificate" %}</span>
<span style="display: none" class="web">{% trans "Web" %}</span>
</p>
</div>
{% endfor %}
</div>
{% else %}
<div class="big-msg-info">
{% blocktrans %}
This deployment doesn't have any service deployed yet. Click on the
"Services" menu entry in the top right of the page to add a first one.
{% endblocktrans %}
</div>
{% endif %}
<script>
$(function() {
$.ajax({
url: '/api/health/',
success: function(response, status) {
$('div[data-service-slug]').each(function(idx, service_block) {
var $service_block = $(service_block);
var service_slug = $service_block.data('service-slug');
var service = response.data[service_slug];
var ok = true;
if (service.is_resolvable) {
$service_block.find('.dns').addClass('op-ok');
} else {
$service_block.find('.dns').addClass('op-nok');
ok = false;
}
if (service.has_valid_certificate) {
$service_block.find('.certificate').addClass('op-ok');
} else {
$service_block.find('.certificate').addClass('op-nok');
ok = false;
}
if (service.is_running) {
$service_block.find('.web').addClass('op-ok');
} else {
$service_block.find('.web').addClass('op-nok');
ok = false;
}
var $service_p = $service_block.find('span.checking')
$service_block.find('span').show();
$service_p.hide();
if (ok) {
$service_block.addClass('op-ok');
} else {
$service_block.addClass('op-nok');
}
});
}
});
});
</script>
{% endblock %}