mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-01-17 13:06:18 +00:00
add cache settings and processing time display to cluster view
This commit is contained in:
@@ -130,13 +130,9 @@ class ClusterSettingsForm(forms.ModelForm):
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super().clean()
|
||||
primary_enable_wireguard = cleaned_data.get('primary_enable_wireguard')
|
||||
cluster_enabled = cleaned_data.get('enabled')
|
||||
|
||||
if cluster_enabled and not settings.WIREGUARD_STATUS_CACHE_ENABLED:
|
||||
raise ValidationError(_("Cluster mode requires WireGuard status cache to be enabled."))
|
||||
|
||||
if not primary_enable_wireguard:
|
||||
raise ValidationError(_("Disabling WireGuard on the master server is currently not supported."))
|
||||
|
||||
return cleaned_data
|
||||
@@ -4,6 +4,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from api.models import WireguardStatusCache
|
||||
from dns.functions import compress_dnsmasq_config
|
||||
from user_manager.models import UserAcl
|
||||
from .forms import WorkerForm, ClusterSettingsForm
|
||||
@@ -19,11 +20,20 @@ def cluster_main(request):
|
||||
cluster_settings, created = ClusterSettings.objects.get_or_create(name='cluster_settings')
|
||||
page_title = _('Cluster')
|
||||
workers = Worker.objects.all().order_by('name')
|
||||
|
||||
master_cache_times = ", ".join([str(c.processing_time_ms) for c in WireguardStatusCache.objects.filter(cache_type='master').order_by('-created')])
|
||||
cluster_cache_times = ", ".join([str(c.processing_time_ms) for c in WireguardStatusCache.objects.filter(cache_type='cluster').order_by('-created')])
|
||||
|
||||
context = {
|
||||
'page_title': page_title,
|
||||
'workers': workers,
|
||||
'page_title': page_title,
|
||||
'workers': workers,
|
||||
'current_worker_version': settings.CLUSTER_WORKER_CURRENT_VERSION,
|
||||
'cluster_settings': cluster_settings
|
||||
'cluster_settings': cluster_settings,
|
||||
'cache_refresh_interval': settings.WIREGUARD_STATUS_CACHE_REFRESH_INTERVAL,
|
||||
'cache_enabled': settings.WIREGUARD_STATUS_CACHE_ENABLED,
|
||||
'cache_web_load_previous_count': settings.WIREGUARD_STATUS_CACHE_WEB_LOAD_PREVIOUS_COUNT,
|
||||
'master_cache_times': master_cache_times,
|
||||
'cluster_cache_times': cluster_cache_times,
|
||||
}
|
||||
return render(request, 'cluster/workers_list.html', context)
|
||||
|
||||
|
||||
@@ -116,12 +116,30 @@
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>{% trans 'Stats Sync Interval' %}</th>
|
||||
<td>{{ cluster_settings.stats_sync_interval }}s</td>
|
||||
<th>{% trans 'Stats Cache Refresh Interval' %}</th>
|
||||
<td>{{ cache_refresh_interval }}s</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans 'Stats Cache Interval' %}</th>
|
||||
<td>{{ cluster_settings.stats_cache_interval }}s</td>
|
||||
<th>{% trans 'Cache Enabled' %}</th>
|
||||
<td>
|
||||
{% if cache_enabled %}
|
||||
<i class="fas fa-check text-green"></i>
|
||||
{% else %}
|
||||
<i class="fas fa-times text-gray"></i>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans 'Cache Web Load Previous Count' %}</th>
|
||||
<td>{{ cache_web_load_previous_count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans 'Master Cache Processing Time' %}</th>
|
||||
<td>{{ master_cache_times }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans 'Cluster Cache Processing Time' %}</th>
|
||||
<td>{{ cluster_cache_times }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{% trans 'Restart Mode' %}</th>
|
||||
|
||||
Reference in New Issue
Block a user