Refine sidebar navigation and service visibility

This commit is contained in:
parkel committed 2026-11-24 01:14:23 +01:00
1 parent 7ff51aa20e
commit e56cb9dcd9
11 files changed
+188 -217

No files matched your search

@@ -0,0 +1,75 @@
<!-- SPDX-License-Identifier: Apache-2.0 -->
<svg xmlns="http://www.w3.org/2000/svg">
<symbol id="accounts" viewBox="0 0 24 24">
<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 10h18m-14 5h4"/>
</symbol>
<symbol id="customers" viewBox="0 0 24 24">
<circle cx="12" cy="7" r="3"/><path d="M5 21v-2a7 7 0 0 1 14 0v2z"/>
</symbol>
<symbol id="resellers" viewBox="0 0 24 24">
<rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="8" cy="9" r="2"/><path d="M5 16a3 3 0 0 1 6 0m3-7h4m-4 5h4"/>
</symbol>
<symbol id="plans" viewBox="0 0 24 24">
<path d="M6 3h8l4 4v14H6zM14 3v5h4M9 12h6m-6 4h6"/>
</symbol>
<symbol id="packages" viewBox="0 0 24 24">
<path d="m3 7 9-4 9 4v10l-9 4-9-4zM3 7l9 4 9-4m-9 4v10M8 5l9 4v4"/>
</symbol>
<symbol id="network" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="9"/><ellipse cx="12" cy="12" rx="4" ry="9"/><path d="M3 12h18"/>
</symbol>
<symbol id="nodes" viewBox="0 0 24 24">
<rect x="9" y="3" width="6" height="5" rx="1"/><rect x="3" y="16" width="6" height="5" rx="1"/><rect x="15" y="16" width="6" height="5" rx="1"/><path d="M12 8v4m-6 4v-4h12v4"/>
</symbol>
<symbol id="lock" viewBox="0 0 24 24">
<rect x="5" y="10" width="14" height="11" rx="2"/><path d="M8 10V7a4 4 0 0 1 8 0v3m-4 4v3"/>
</symbol>
<symbol id="database" viewBox="0 0 24 24">
<ellipse cx="12" cy="6" rx="8" ry="3"/><path d="M4 6v12a8 3 0 0 0 16 0V6M4 12a8 3 0 0 0 16 0"/>
</symbol>
<symbol id="folder" viewBox="0 0 24 24">
<path d="M3 19V5h7l2 3h9v11z"/>
</symbol>
<symbol id="settings" viewBox="0 0 24 24">
<path d="M4 6h9m4 0h3M4 12h3m4 0h9M4 18h11m4 0h1"/><circle cx="15" cy="6" r="2"/><circle cx="9" cy="12" r="2"/><circle cx="17" cy="18" r="2"/>
</symbol>
<symbol id="appearance" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="9"/><path d="M12 3v18m0-13h5m-5 4h8m-8 4h5"/>
</symbol>
<symbol id="mail" viewBox="0 0 24 24">
<rect x="3" y="5" width="18" height="14" rx="2"/><path d="m4 7 8 6 8-6"/>
</symbol>
<symbol id="message" viewBox="0 0 24 24">
<path d="M3 5h18v12H9l-6 4zM7 9h10m-10 4h7"/>
</symbol>
<symbol id="shield" viewBox="0 0 24 24">
<path d="M12 3 4 6v6c0 4 3 7 8 9 5-2 8-5 8-9V6zM9 12l2 2 4-4"/>
</symbol>
<symbol id="queue" viewBox="0 0 24 24">
<path d="M4 5h16M4 9h16M4 13h16v6H4zM8 16h3"/>
</symbol>
<symbol id="archive" viewBox="0 0 24 24">
<path d="M3 4h18v5H3zm2 5v11h14V9m-10 4h6"/>
</symbol>
<symbol id="health" viewBox="0 0 24 24">
<rect x="3" y="4" width="18" height="16" rx="2"/><path d="M5 12h3l2-4 3 8 2-4h4"/>
</symbol>
<symbol id="chart" viewBox="0 0 24 24">
<path d="M4 4v16h16M8 16v-4m4 4V8m4 8v-6m4 6V6"/>
</symbol>
<symbol id="information" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="9"/><path d="M12 11v6m0-10v.1"/>
</symbol>
<symbol id="clock" viewBox="0 0 24 24">
<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>
</symbol>
<symbol id="transfer" viewBox="0 0 24 24">
<path d="M4 8h15m-4-4 4 4-4 4m5 4H5m4-4-4 4 4 4"/>
</symbol>
<symbol id="download" viewBox="0 0 24 24">
<path d="M12 3v12m-4-4 4 4 4-4M4 16v4h16v-4"/>
</symbol>
<symbol id="sign-out" viewBox="0 0 24 24">
<path d="M11 4H4v16h7m-1-8h10m-4-4 4 4-4 4"/>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

@@ -31,6 +31,23 @@ navigation.addEventListener("keydown", (event) => {
compactLayout.addEventListener("change", updateMenuLayout); compactLayout.addEventListener("change", updateMenuLayout);
updateMenuLayout(); updateMenuLayout();
const roleSwitch = document.querySelector("[data-role-switch]");
if (roleSwitch) {
const picker = roleSwitch.querySelector("select");
const currentRole = picker.value;
roleSwitch.classList.add("role-switch-on-change");
roleSwitch.querySelector("button").hidden = true;
picker.setAttribute("aria-label", "Panel role (switches when selected)");
picker.addEventListener("change", () => {
if (picker.value !== currentRole) {
roleSwitch.requestSubmit();
}
});
window.addEventListener("pageshow", () => {
picker.value = currentRole;
});
}
const accountTabs = document.querySelector("[data-account-tabs]"); const accountTabs = document.querySelector("[data-account-tabs]");
if (accountTabs) { if (accountTabs) {
const panels = [...document.querySelectorAll("[data-account-section]")]; const panels = [...document.querySelectorAll("[data-account-section]")];
+46 -160
View File
@@ -142,7 +142,6 @@ button, input, select, textarea {
display: flex; display: flex;
height: 100dvh; height: 100dvh;
flex-direction: column; flex-direction: column;
overflow-y: auto;
padding: 1.65rem 1.1rem 1.1rem; padding: 1.65rem 1.1rem 1.1rem;
background: linear-gradient(160deg, var(--sidebar-gradient), var(--sidebar) 55%); background: linear-gradient(160deg, var(--sidebar-gradient), var(--sidebar) 55%);
color: var(--sidebar-text); color: var(--sidebar-text);
@@ -196,6 +195,17 @@ button, input, select, textarea {
margin-top: 1.4rem; margin-top: 1.4rem;
} }
@media (min-width: 781px) {
.navigation {
min-height: 0;
align-content: start;
overflow-y: auto;
overscroll-behavior: contain;
padding: 0.15rem;
scrollbar-width: thin;
}
}
.navigation a { .navigation a {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -245,175 +255,35 @@ button, input, select, textarea {
display: none; display: none;
} }
.nav-icon { .nav-icon,
display: inline-block; .sidebar-icon-action svg {
display: block;
width: 1rem; width: 1rem;
height: 0.85rem; height: 1rem;
flex: 0 0 auto; flex: 0 0 1rem;
border: 1px solid currentColor; fill: none;
border-radius: 2px; stroke: currentColor;
stroke-width: 1.6px;
stroke-linecap: round;
stroke-linejoin: round;
}
.nav-icon {
color: var(--sidebar-icon); color: var(--sidebar-icon);
} }
.nav-icon-accounts { .navigation a:hover .nav-icon,
background: linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat; .navigation a[aria-current] .nav-icon {
} color: currentColor;
.nav-icon-plans {
width: 0.8rem;
height: 1rem;
margin-inline: 0.1rem;
background:
linear-gradient(currentColor, currentColor) center 35% / 55% 1px no-repeat,
linear-gradient(currentColor, currentColor) center 65% / 55% 1px no-repeat;
}
.nav-icon-packages {
background: linear-gradient(currentColor, currentColor) center 35% / 40% 1px no-repeat;
}
.nav-icon-resellers {
background:
linear-gradient(currentColor, currentColor) center 35% / 55% 1px no-repeat,
linear-gradient(currentColor, currentColor) center 65% / 75% 1px no-repeat;
}
.nav-icon-health {
background:
linear-gradient(currentColor, currentColor) 25% bottom / 1px 40% no-repeat,
linear-gradient(currentColor, currentColor) center bottom / 1px 70% no-repeat,
linear-gradient(currentColor, currentColor) 75% bottom / 1px 55% no-repeat;
}
.nav-icon-information {
display: grid;
place-content: center;
border-radius: 50%;
font-size: 0.7rem;
font-weight: 700;
}
.nav-icon-customers {
position: relative;
height: 0.46rem;
margin-top: 0.47rem;
border-radius: 0.4rem 0.4rem 2px 2px;
}
.nav-icon-customers::before {
position: absolute;
left: 50%;
bottom: calc(100% + 2px);
width: 0.39rem;
height: 0.39rem;
transform: translateX(-50%);
border: 1px solid currentColor;
border-radius: 50%;
content: "";
}
.nav-icon-mail {
background:
linear-gradient(35deg, transparent 47%, currentColor 50%, transparent 54%) left top / 50% 68% no-repeat,
linear-gradient(-35deg, transparent 47%, currentColor 50%, transparent 54%) right top / 50% 68% no-repeat;
}
.nav-icon-network {
height: 1rem;
border-radius: 50%;
background:
linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat,
linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat;
}
.nav-icon-lock {
position: relative;
height: 0.66rem;
margin-top: 0.35rem;
}
.nav-icon-lock::before {
position: absolute;
inset: auto 19% 100%;
height: 0.36rem;
border: 1px solid currentColor;
border-radius: 0.6rem 0.6rem 0 0;
content: "";
}
.nav-icon-database {
height: 1rem;
border-radius: 50% / 22%;
background:
linear-gradient(currentColor, currentColor) center 35% / 100% 1px no-repeat,
linear-gradient(currentColor, currentColor) center 70% / 100% 1px no-repeat;
}
.nav-icon-folder {
position: relative;
height: 0.68rem;
margin-top: 0.2rem;
}
.nav-icon-folder::before {
position: absolute;
inset: auto auto 100% -1px;
width: 0.45rem;
height: 0.24rem;
border: 1px solid currentColor;
border-radius: 2px 2px 0 0;
content: "";
}
.nav-icon-settings {
border: 1px dashed currentColor;
border-radius: 50%;
background: radial-gradient(circle, transparent 21%, currentColor 23% 34%, transparent 36%);
}
.nav-icon-appearance {
border-radius: 50%;
background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}
.nav-icon-archive {
background:
linear-gradient(currentColor, currentColor) center 28% / 100% 1px no-repeat,
linear-gradient(currentColor, currentColor) center 63% / 38% 1px no-repeat;
}
.nav-icon-clock {
height: 1rem;
border-radius: 50%;
background:
linear-gradient(currentColor, currentColor) center 27% / 1px 30% no-repeat,
linear-gradient(currentColor, currentColor) 71% center / 30% 1px no-repeat;
}
.nav-icon-transfer {
border-width: 0 0 1px;
border-radius: 0;
background: linear-gradient(currentColor, currentColor) left 35% / 88% 1px no-repeat;
position: relative;
}
.nav-icon-transfer::before {
position: absolute;
right: 0.1rem;
top: 0.04rem;
width: 0.4rem;
height: 0.4rem;
transform: rotate(45deg);
border-top: 1px solid currentColor;
border-right: 1px solid currentColor;
content: "";
} }
.sidebar-account { .sidebar-account {
display: grid; display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 0.55rem; gap: 0.55rem;
flex: 0 0 auto;
margin-top: auto; margin-top: auto;
padding-top: 0.85rem; padding-top: 0.7rem;
border-top: 1px solid var(--sidebar-divider); border-top: 1px solid var(--sidebar-divider);
font-size: 0.88rem; font-size: 0.88rem;
} }
@@ -465,6 +335,10 @@ a.sidebar-identity:hover {
font-size: 0.82rem; font-size: 0.82rem;
} }
.panel-role-switch.role-switch-on-change {
display: block;
}
.panel-role-switch select { .panel-role-switch select {
width: 100%; width: 100%;
min-width: 0; min-width: 0;
@@ -494,6 +368,13 @@ a.sidebar-identity:hover {
color: var(--sidebar-text); color: var(--sidebar-text);
} }
.sidebar-icon-action {
display: grid;
width: 2.2rem;
padding: 0;
place-items: center;
}
.appearance-control { .appearance-control {
min-width: 2.2rem; min-width: 2.2rem;
font-size: 1rem; font-size: 1rem;
@@ -616,6 +497,11 @@ h2 {
overflow-wrap: anywhere; overflow-wrap: anywhere;
} }
.package-controls {
display: grid;
gap: 0.75rem;
}
.update-release { .update-release {
padding: 0.75rem 0.9rem; padding: 0.75rem 0.9rem;
border: 1px solid var(--line); border: 1px solid var(--line);
@@ -27,12 +27,7 @@
</div> </div>
{% endblock %} {% endblock %}
{% block page_content %} {% block page_content %}
{% if health_summary %} {% if is_reseller %}
<section class="surface section-heading" aria-label="Server status">
<p>{% if not health_summary.configured %}Service checks need setup.{% elif health_summary.needs_attention %}{{ health_summary.needs_attention }} of {{ health_summary.configured }} service checks need attention.{% else %}All {{ health_summary.configured }} service checks are healthy.{% endif %}</p>
<a class="button secondary" href="{% url 'panel:service_health' %}">Service health</a>
</section>
{% elif is_reseller %}
<section class="surface section-heading" aria-label="Customer access"> <section class="surface section-heading" aria-label="Customer access">
<p>Manage the logins for your assigned customers.</p> <p>Manage the logins for your assigned customers.</p>
<a class="button secondary" href="{% url 'panel:customers' %}">My customers</a> <a class="button secondary" href="{% url 'panel:customers' %}">My customers</a>
@@ -1,15 +1,15 @@
{% load static %}<!doctype html> {% load static panel_assets %}<!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}Coulobre Panel{% endblock %}</title> <title>{% block title %}Coulobre Panel{% endblock %}</title>
<link rel="icon" type="image/svg+xml" href="{% static 'hosting/coulobre-mark.svg' %}"> <link rel="icon" type="image/svg+xml" href="{% static 'hosting/coulobre-mark.svg' %}">
<link rel="stylesheet" href="{% static 'hosting/panel.css' %}"> <link rel="stylesheet" href="{% panel_asset 'hosting/panel.css' %}">
{% if custom_panel_theme %}<link rel="stylesheet" href="{% url 'panel:theme_stylesheet' %}">{% endif %} {% if custom_panel_theme %}<link rel="stylesheet" href="{% url 'panel:theme_stylesheet' %}">{% endif %}
{% if has_user_theme %}<link rel="stylesheet" href="{% url 'panel:user_stylesheet' %}">{% endif %} {% if has_user_theme %}<link rel="stylesheet" href="{% url 'panel:user_stylesheet' %}">{% endif %}
{% block extra_styles %}{% endblock %} {% block extra_styles %}{% endblock %}
<script src="{% static 'hosting/panel-appearance.js' %}"></script> <script src="{% panel_asset 'hosting/panel-appearance.js' %}"></script>
</head> </head>
<body> <body>
{% if request.user.is_authenticated and not auth_screen %} {% if request.user.is_authenticated and not auth_screen %}
@@ -27,6 +27,7 @@
{% include "hosting/workspace_navigation.html" %} {% include "hosting/workspace_navigation.html" %}
</nav> </nav>
<div class="sidebar-account"> <div class="sidebar-account">
{% panel_asset 'hosting/panel-icons.svg' as panel_icons %}
<div class="sidebar-account-controls"> <div class="sidebar-account-controls">
{% if request.impersonation %} {% if request.impersonation %}
<span class="sidebar-identity"> <span class="sidebar-identity">
@@ -44,11 +45,13 @@
{% endif %} {% endif %}
<form class="sidebar-sign-out" method="post" action="{% url 'panel:logout' %}"> <form class="sidebar-sign-out" method="post" action="{% url 'panel:logout' %}">
{% csrf_token %} {% csrf_token %}
<button class="sidebar-action" type="submit">Sign out</button> <button class="sidebar-action sidebar-icon-action" type="submit" aria-label="Sign out" title="Sign out">
<svg aria-hidden="true" focusable="false"><use href="{{ panel_icons }}#sign-out"></use></svg>
</button>
</form> </form>
</div> </div>
{% if not request.impersonation and request.panel_role_options|length > 1 %} {% if not request.impersonation and request.panel_role_options|length > 1 %}
<form method="post" class="panel-role-switch" action="{% url 'panel:switch_panel_role' %}"> <form method="post" class="panel-role-switch" action="{% url 'panel:switch_panel_role' %}" data-role-switch>
{% csrf_token %} {% csrf_token %}
<label class="visually-hidden" for="panel-role">Panel role</label> <label class="visually-hidden" for="panel-role">Panel role</label>
<select name="role" id="panel-role"> <select name="role" id="panel-role">
@@ -56,7 +59,7 @@
<option value="{{ value }}"{% if request.active_panel_role == value %} selected{% endif %}>{{ label }}</option> <option value="{{ value }}"{% if request.active_panel_role == value %} selected{% endif %}>{{ label }}</option>
{% endfor %} {% endfor %}
</select> </select>
<button class="sidebar-action" type="submit" aria-label="Switch role">Switch</button> <button class="sidebar-action" type="submit">Switch role</button>
</form> </form>
{% endif %} {% endif %}
</div> </div>
@@ -83,7 +86,7 @@
{% block content %}{% endblock %} {% block content %}{% endblock %}
</main> </main>
</div> </div>
<script src="{% static 'hosting/panel-navigation.js' %}" defer></script> <script src="{% panel_asset 'hosting/panel-navigation.js' %}" defer></script>
{% block extra_scripts %}{% endblock %} {% block extra_scripts %}{% endblock %}
{% else %} {% else %}
{% block public_content %}{% endblock %} {% block public_content %}{% endblock %}
@@ -11,7 +11,7 @@
<section class="surface" aria-labelledby="health-{{ node.node }}"> <section class="surface" aria-labelledby="health-{{ node.node }}">
<header class="section-heading"> <header class="section-heading">
<h2 id="health-{{ node.node }}">{{ node.node }}</h2> <h2 id="health-{{ node.node }}">{{ node.node }}</h2>
<span class="muted">{% if node.transport == 'local' %}Local{% else %}Remote{% endif %}</span> <span class="muted">{% if node.transport == 'local' %}Local{% else %}Remote · monitoring only{% endif %}</span>
</header> </header>
<div class="table-scroll"> <div class="table-scroll">
<table> <table>
@@ -40,7 +40,7 @@
<button type="submit" class="button secondary" name="action" value="reload" aria-label="Reload {{ service.name }}">Reload</button> <button type="submit" class="button secondary" name="action" value="reload" aria-label="Reload {{ service.name }}">Reload</button>
<button type="submit" class="button secondary" name="action" value="restart" aria-label="Restart {{ service.name }}">Restart</button> <button type="submit" class="button secondary" name="action" value="restart" aria-label="Restart {{ service.name }}">Restart</button>
</form> </form>
{% else %}—{% endif %} {% else %}<span class="muted">Manage on host</span>{% endif %}
</td> </td>
{% endif %} {% endif %}
</tr> </tr>
@@ -1,9 +1,11 @@
{% load panel_assets %}
{% panel_asset 'hosting/panel-icons.svg' as panel_icons %}
{% for title, entries in navigation_groups %} {% for title, entries in navigation_groups %}
<details class="sidebar-group"{% if title == open_workspace_group or not open_workspace_group and forloop.first %} open{% endif %}> <details class="sidebar-group"{% if title == open_workspace_group or not open_workspace_group and forloop.first %} open{% endif %}>
<summary>{{ title }}</summary> <summary>{{ title }}</summary>
{% for href, label, icon in entries %} {% for href, label, icon in entries %}
<a href="{{ href }}"{% if active_navigation_link == href %} aria-current="page"{% endif %}> <a href="{{ href }}"{% if active_navigation_link == href %} aria-current="page"{% endif %}>
<span class="nav-icon nav-icon-{{ icon }}" aria-hidden="true">{% if icon == 'information' %}i{% endif %}</span> <svg class="nav-icon" aria-hidden="true" focusable="false"><use href="{{ panel_icons }}#{{ icon }}"></use></svg>
<span>{{ label }}</span> <span>{{ label }}</span>
</a> </a>
{% endfor %} {% endfor %}
@@ -1,7 +1,7 @@
{% extends "hosting/base.html" %} {% extends "hosting/base.html" %}
{% load static %} {% load panel_assets %}
{% block extra_scripts %} {% block extra_scripts %}
<script src="{% static 'hosting/panel-live-status.js' %}" defer></script> <script src="{% panel_asset 'hosting/panel-live-status.js' %}" defer></script>
{% endblock %} {% endblock %}
{% block account_selector %}{% endblock %} {% block account_selector %}{% endblock %}
{% block content %} {% block content %}
@@ -0,0 +1,17 @@
from functools import cache
from hashlib import sha256
from importlib.resources import files
from django import template
from django.templatetags.static import static
register = template.Library()
@register.simple_tag
@cache
def panel_asset(name):
"""Keep cached shell assets in step with the installed templates."""
asset = files("coulobre.hosting").joinpath("static", name)
revision = sha256(asset.read_bytes()).hexdigest()[:16]
return f"{static(name)}?v={revision}"
-26
View File
@@ -15,7 +15,6 @@ from django.http import (
) )
from django.shortcuts import get_object_or_404, redirect from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.utils import timezone
from django.utils.functional import cached_property from django.utils.functional import cached_property
from django.views import View from django.views import View
from django.views.generic import ( from django.views.generic import (
@@ -31,7 +30,6 @@ from coulobre.dns_node import MAX_SOA_SERIAL
from coulobre.mail_dns import MANAGED_DKIM_SELECTOR, matches_version from coulobre.mail_dns import MANAGED_DKIM_SELECTOR, matches_version
from coulobre.mail_node import INVALID_LOCAL_PART from coulobre.mail_node import INVALID_LOCAL_PART
from coulobre.php_runtime import available_php_versions from coulobre.php_runtime import available_php_versions
from coulobre.service_health import HealthResult
from coulobre.sftp_keys import public_key_fingerprint from coulobre.sftp_keys import public_key_fingerprint
from .access import ( from .access import (
@@ -81,7 +79,6 @@ from .dns_forms import (
) )
from .dns_publication import queue_dns_publication from .dns_publication import queue_dns_publication
from .domain_policies import require_managed from .domain_policies import require_managed
from .health_views import STALE_AFTER
from .impersonation import ( from .impersonation import (
CUSTOMER_WRITE_PERMISSIONS, CUSTOMER_WRITE_PERMISSIONS,
EndReason, EndReason,
@@ -116,7 +113,6 @@ from .models import (
HostingMailbox, HostingMailbox,
HostingPlan, HostingPlan,
Reseller, Reseller,
ServiceHealth,
WebProvisioningPlan, WebProvisioningPlan,
WebsiteAlias, WebsiteAlias,
WebsiteDomain, WebsiteDomain,
@@ -401,28 +397,6 @@ class AccountList(TenantScopeMixin, PermissionRequiredMixin, ListView):
"limit": reseller.account_limit, "limit": reseller.account_limit,
"may_create": reseller.may_create_accounts(), "may_create": reseller.may_create_accounts(),
} }
elif (
not self.request.GET
and not is_tenant(self.request.user)
and self.request.user.has_perm("hosting.view_servicehealth")
):
targets = settings.SERVICE_HEALTH_TARGETS
checks = {
(node.node, service)
for node in targets
for service in node.services
}
healthy = set(
ServiceHealth.objects.filter(
node__in={node.node for node in targets},
result=HealthResult.ACTIVE,
observed_at__gt=timezone.now() - STALE_AFTER,
).values_list("node", "service")
)
context["health_summary"] = {
"configured": len(checks),
"needs_attention": len(checks - healthy),
}
return context return context
+15 -13
View File
@@ -244,7 +244,7 @@ NAVIGATION_ICONS = {
"all_users": "customers", "all_users": "customers",
"customers": "customers", "customers": "customers",
"customer_onboarding": "customers", "customer_onboarding": "customers",
"move_accounts": "customers", "move_accounts": "transfer",
"operator_create": "customers", "operator_create": "customers",
"resellers": "resellers", "resellers": "resellers",
"reseller_create": "resellers", "reseller_create": "resellers",
@@ -252,9 +252,9 @@ NAVIGATION_ICONS = {
"manager_packages": "packages", "manager_packages": "packages",
"reseller_profiles": "packages", "reseller_profiles": "packages",
"domains": "network", "domains": "network",
"dns": "network", "dns": "nodes",
"dns_defaults": "network", "dns_defaults": "nodes",
"connected_nodes": "network", "connected_nodes": "nodes",
"account_security": "lock", "account_security": "lock",
"certificates": "lock", "certificates": "lock",
"operator_certificates": "lock", "operator_certificates": "lock",
@@ -266,23 +266,25 @@ NAVIGATION_ICONS = {
"operator_settings": "settings", "operator_settings": "settings",
"http_defaults": "settings", "http_defaults": "settings",
"theme_management": "appearance", "theme_management": "appearance",
"announcements": "mail", "announcements": "message",
"email": "mail", "email": "mail",
"forwarders": "mail", "forwarders": "transfer",
"replies": "mail", "replies": "message",
"spam": "mail", "spam": "shield",
"mail_queue_index": "mail", "mail_queue_index": "queue",
"mail_delivery": "mail", "mail_delivery": "mail",
"backups": "archive", "backups": "archive",
"operator_backups": "archive", "operator_backups": "archive",
"system_backup": "archive", "system_backup": "archive",
"service_health": "health", "service_health": "health",
"statistics": "health", "statistics": "chart",
"installation": "information", "installation": "information",
"tasks": "clock", "tasks": "clock",
"updates": "transfer", "updates": "download",
"directadmin_guide": "transfer", "directadmin_guide": "download",
"redirects": "transfer", "redirects": "transfer",
"plans": "plans",
"logs": "plans",
} }
@@ -295,7 +297,7 @@ def link(route, label, *args):
return ( return (
reverse(f"panel:{route}", args=args), reverse(f"panel:{route}", args=args),
label, label,
NAVIGATION_ICONS.get(key, "plans"), NAVIGATION_ICONS[key],
) )