Show hosting accounts and their owning nodes across panels
This commit is contained in:
1 parent
2719fe2dce
commit
d39b442f65
12 files changed
+360
No files matched your search
@@ -3491,6 +3491,27 @@ other panel as well. If a panel secret changes, exchange its new public
|
|||||||
key and re-enroll it. Each panel keeps its own hosting accounts and can
|
key and re-enroll it. Each panel keeps its own hosting accounts and can
|
||||||
operate while another panel is unreachable.
|
operate while another panel is unreachable.
|
||||||
|
|
||||||
|
#### View hosting accounts across panels
|
||||||
|
|
||||||
|
On each owning panel, open **Enrolled panels**, select **Hosting inventory
|
||||||
|
sharing** on the source panel's row, and choose **Share hosting accounts**.
|
||||||
|
Only the mapped local operator can enable sharing. This grants read-only
|
||||||
|
access to active account names, primary domains and status, not to
|
||||||
|
customer profiles or service credentials. Sharing is directional and off
|
||||||
|
by default, including for previously enrolled peers.
|
||||||
|
|
||||||
|
On the source panel, open **Hosting accounts → All nodes** to search and
|
||||||
|
filter by the owning panel. The combined view shows the first page from
|
||||||
|
each node. Select a node to page through all of its results. The node
|
||||||
|
column uses short hostnames unless they collide. Hover or focus the node
|
||||||
|
label to read the full host shown by the enrollment. Account links open
|
||||||
|
the owning panel, which still checks its own operator sign-in.
|
||||||
|
|
||||||
|
If a peer is unavailable, doesn't share its inventory or hasn't been
|
||||||
|
upgraded to a version that supports it, the list marks the results as
|
||||||
|
incomplete. **This node** continues to show the regular local list. The
|
||||||
|
cluster inventory is not exposed to customers or managers.
|
||||||
|
|
||||||
### Set up hosting features
|
### Set up hosting features
|
||||||
|
|
||||||
Open **About Coulobre → Configure features** as a superuser with a verified
|
Open **About Coulobre → Configure features** as a superuser with a verified
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
from django.http import Http404
|
||||||
|
from django.utils.decorators import method_decorator
|
||||||
|
from django.views.decorators.cache import never_cache
|
||||||
|
from django.views.generic import TemplateView
|
||||||
|
|
||||||
|
from .account_administration import OperatorAuthorization
|
||||||
|
from .cluster_accounts import (
|
||||||
|
MAX_OFFSET,
|
||||||
|
PAGE_SIZE,
|
||||||
|
collect_inventory,
|
||||||
|
inventory_nodes,
|
||||||
|
search_term,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@method_decorator(never_cache, name="dispatch")
|
||||||
|
class ClusterAccountList(OperatorAuthorization, TemplateView):
|
||||||
|
template_name = "hosting/cluster_account_list.html"
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
nodes = inventory_nodes(self.request)
|
||||||
|
if not nodes:
|
||||||
|
raise Http404
|
||||||
|
selected = self.request.GET.get("node", "")
|
||||||
|
subset = [
|
||||||
|
node for node in nodes if not selected or node.key == selected
|
||||||
|
]
|
||||||
|
if not subset:
|
||||||
|
raise Http404
|
||||||
|
offset = self.request.GET.get("offset", "0")
|
||||||
|
if (
|
||||||
|
not offset.isascii()
|
||||||
|
or not offset.isdecimal()
|
||||||
|
or len(offset) > len(str(MAX_OFFSET))
|
||||||
|
or int(offset) > MAX_OFFSET
|
||||||
|
or int(offset) % PAGE_SIZE
|
||||||
|
or (int(offset) and not selected)
|
||||||
|
):
|
||||||
|
raise Http404
|
||||||
|
offset = int(offset)
|
||||||
|
try:
|
||||||
|
search = search_term(self.request.GET.get("q", ""))
|
||||||
|
except ValueError:
|
||||||
|
raise Http404 from None
|
||||||
|
pages = collect_inventory(subset, self.request.user, search, offset)
|
||||||
|
return super().get_context_data(
|
||||||
|
cluster_view=True,
|
||||||
|
cluster_nodes=nodes,
|
||||||
|
pages=pages,
|
||||||
|
unavailable_nodes=[
|
||||||
|
page["node"] for page in pages if page["unavailable"]
|
||||||
|
],
|
||||||
|
selected_node=selected,
|
||||||
|
search=search,
|
||||||
|
previous_offset=offset - PAGE_SIZE if offset else None,
|
||||||
|
next_offset=(
|
||||||
|
offset + PAGE_SIZE
|
||||||
|
if selected and pages[0]["more"] and offset < MAX_OFFSET
|
||||||
|
else None
|
||||||
|
),
|
||||||
|
**kwargs,
|
||||||
|
)
|
||||||
@@ -1400,3 +1400,13 @@ dd {
|
|||||||
.workspace-list li + li {
|
.workspace-list li + li {
|
||||||
margin-top: 0.4rem;
|
margin-top: 0.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hosting-node-full {
|
||||||
|
display: none;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hosting-node:hover .hosting-node-full,
|
||||||
|
.hosting-node:focus .hosting-node-full {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</header>
|
</header>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% block page_tabs %}{% include "hosting/hosting_account_tabs.html" %}{% endblock %}
|
||||||
{% block page_context %}
|
{% block page_context %}
|
||||||
<div class="workspace-context form-actions account-toolbar">
|
<div class="workspace-context form-actions account-toolbar">
|
||||||
<form class="form-actions" method="get" action="{% url 'panel:accounts' %}" role="search">
|
<form class="form-actions" method="get" action="{% url 'panel:accounts' %}" role="search">
|
||||||
@@ -41,6 +42,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Account</th>
|
<th scope="col">Account</th>
|
||||||
|
{% if local_hosting_node %}<th scope="col">Hosting node</th>{% endif %}
|
||||||
<th scope="col">Status</th>
|
<th scope="col">Status</th>
|
||||||
{% if is_operator and perms.hosting.view_customer %}<th scope="col">Customer</th>{% endif %}
|
{% if is_operator and perms.hosting.view_customer %}<th scope="col">Customer</th>{% endif %}
|
||||||
{% if is_tenant or perms.hosting.view_hostingplan %}<th scope="col">Hosting package</th>{% endif %}
|
{% if is_tenant or perms.hosting.view_hostingplan %}<th scope="col">Hosting package</th>{% endif %}
|
||||||
@@ -61,6 +63,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
{% if local_hosting_node %}<td>{% include "hosting/hosting_node.html" with node=local_hosting_node only %}</td>{% endif %}
|
||||||
<td>{% include "hosting/account_status.html" %}</td>
|
<td>{% include "hosting/account_status.html" %}</td>
|
||||||
{% if is_operator and perms.hosting.view_customer %}<td>{{ account.customer|default_if_none:"No customer linked" }}</td>{% endif %}
|
{% if is_operator and perms.hosting.view_customer %}<td>{{ account.customer|default_if_none:"No customer linked" }}</td>{% endif %}
|
||||||
{% if is_tenant or perms.hosting.view_hostingplan %}
|
{% if is_tenant or perms.hosting.view_hostingplan %}
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
{% extends "hosting/workspace_page.html" %}
|
||||||
|
{% block title %}Hosting accounts · Coulobre Panel{% endblock %}
|
||||||
|
{% block page_title %}Hosting accounts{% endblock %}
|
||||||
|
{% block page_metadata %}
|
||||||
|
<p class="heading-meta">Find accounts across enrolled panels. Open an account on the panel that hosts it.</p>
|
||||||
|
{% endblock %}
|
||||||
|
{% block page_actions %}
|
||||||
|
<a class="button primary" href="{% url 'panel:account_create' %}">Add account on this node</a>
|
||||||
|
{% endblock %}
|
||||||
|
{% block page_tabs %}{% include "hosting/hosting_account_tabs.html" %}{% endblock %}
|
||||||
|
{% block page_context %}
|
||||||
|
<div class="workspace-context form-actions account-toolbar">
|
||||||
|
<form class="form-actions" method="get" action="{% url 'panel:cluster_accounts' %}" role="search">
|
||||||
|
<label class="visually-hidden" for="cluster-account-search">Search by name or domain</label>
|
||||||
|
<input id="cluster-account-search" type="search" name="q" placeholder="Name or domain" value="{{ search }}">
|
||||||
|
<label for="hosting-node">Hosting node</label>
|
||||||
|
<select id="hosting-node" name="node">
|
||||||
|
<option value="">All nodes</option>
|
||||||
|
{% for node in cluster_nodes %}
|
||||||
|
<option value="{{ node.key }}"{% if selected_node == node.key %} selected{% endif %}>{{ node.label }}{% if not node.peer %} (this node){% endif %}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
<button type="submit" class="button secondary">Search</button>
|
||||||
|
{% if search or selected_node %}<a class="quiet-link" href="{% url 'panel:cluster_accounts' %}">Clear</a>{% endif %}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
{% block page_content %}
|
||||||
|
{% if unavailable_nodes %}
|
||||||
|
<p class="notice" role="status">Results may be incomplete. Could not read the hosting inventory on {% for node in unavailable_nodes %}{{ node.label }}{% if not forloop.last %}, {% endif %}{% endfor %}. Check that the peer is reachable and allows inventory sharing.</p>
|
||||||
|
{% endif %}
|
||||||
|
<section class="surface" aria-label="Cluster hosting account list">
|
||||||
|
<div class="table-scroll">
|
||||||
|
<table>
|
||||||
|
<thead><tr><th scope="col">Account</th><th scope="col">Hosting node</th><th scope="col">Status</th></tr></thead>
|
||||||
|
{% for page in pages %}
|
||||||
|
{% if not page.unavailable %}
|
||||||
|
<tbody>
|
||||||
|
{% for account in page.accounts %}
|
||||||
|
<tr>
|
||||||
|
<th scope="row"><a class="record-link" href="{{ account.url }}">{{ account.name }}</a><div class="domain muted account-domain">{{ account.primary_domain }}</div></th>
|
||||||
|
<td>{% include "hosting/hosting_node.html" with node=page.node only %}</td>
|
||||||
|
<td>{% include "hosting/account_status.html" %}</td>
|
||||||
|
</tr>
|
||||||
|
{% empty %}
|
||||||
|
<tr>
|
||||||
|
<td colspan="3" class="muted">No matching accounts on {{ page.node.label }}{% if previous_offset is not None %} on this page{% endif %}.</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
{% if page.more and not selected_node %}
|
||||||
|
<tr><td colspan="3"><a class="record-link" href="{% querystring node=page.node.key offset=None %}">View all results on {{ page.node.label }}</a></td></tr>
|
||||||
|
{% endif %}
|
||||||
|
</tbody>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
{% if previous_offset is not None or next_offset is not None %}
|
||||||
|
<nav class="pagination" aria-label="Node results">
|
||||||
|
{% if previous_offset is not None %}<a class="button secondary" href="{% querystring offset=previous_offset %}">Previous</a>{% endif %}
|
||||||
|
{% if next_offset is not None %}<a class="button secondary" href="{% querystring offset=next_offset %}">Next</a>{% endif %}
|
||||||
|
</nav>
|
||||||
|
{% endif %}
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
{% if cluster_nodes %}
|
||||||
|
<nav class="account-navigation" aria-label="Hosting account views">
|
||||||
|
<a href="{% url 'panel:accounts' %}{% querystring node=None offset=None page=None %}"{% if not cluster_view %} aria-current="page"{% endif %}>This node</a>
|
||||||
|
<a href="{% url 'panel:cluster_accounts' %}{% querystring node=None offset=None page=None customer=None %}"{% if cluster_view %} aria-current="page"{% endif %}>All nodes</a>
|
||||||
|
</nav>
|
||||||
|
{% endif %}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
{% if node.label == node.authority %}
|
||||||
|
{{ node.label }}
|
||||||
|
{% else %}
|
||||||
|
<span class="hosting-node" tabindex="0" aria-label="{{ node.authority }}">{{ node.label }}<span class="hosting-node-full muted" aria-hidden="true">{{ node.authority }}</span></span>
|
||||||
|
{% endif %}
|
||||||
@@ -45,6 +45,17 @@
|
|||||||
<button type="submit" class="button secondary" name="action" value="refresh">Refresh health</button>
|
<button type="submit" class="button secondary" name="action" value="refresh">Refresh health</button>
|
||||||
</form>
|
</form>
|
||||||
{% if request.user.pk == peer.operator_id %}
|
{% if request.user.pk == peer.operator_id %}
|
||||||
|
<details><summary>Hosting inventory sharing · {% if peer.account_inventory_allowed %}On{% else %}Off{% endif %}</summary>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}<input type="hidden" name="peer" value="{{ peer.pk }}">
|
||||||
|
<p>Allow the mapped operator on this peer to list this panel's account names, domains and status.</p>
|
||||||
|
{% if peer.account_inventory_allowed %}
|
||||||
|
<button type="submit" class="button secondary" name="action" value="deny-inventory">Stop sharing accounts</button>
|
||||||
|
{% else %}
|
||||||
|
<button type="submit" class="button secondary" name="action" value="allow-inventory">Share hosting accounts</button>
|
||||||
|
{% endif %}
|
||||||
|
</form>
|
||||||
|
</details>
|
||||||
{% if peer.status.can_check_packages %}
|
{% if peer.status.can_check_packages %}
|
||||||
<details><summary>Check peer packages</summary>
|
<details><summary>Check peer packages</summary>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
|||||||
@@ -0,0 +1,166 @@
|
|||||||
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.test import TestCase, override_settings
|
||||||
|
from django.urls import reverse
|
||||||
|
from django.utils import timezone
|
||||||
|
from django_otp import DEVICE_ID_SESSION_KEY
|
||||||
|
from django_otp.plugins.otp_totp.models import TOTPDevice
|
||||||
|
|
||||||
|
from .cluster_accounts import PAGE_SIZE
|
||||||
|
from .models import HostingAccount, PanelPeer
|
||||||
|
from .peering import PeerAccessError
|
||||||
|
|
||||||
|
|
||||||
|
@override_settings(PASSWORD_RESET_ORIGIN="https://web1.a.cluster.example")
|
||||||
|
class ClusterAccountTests(TestCase):
|
||||||
|
@classmethod
|
||||||
|
def setUpTestData(cls):
|
||||||
|
cls.operator = get_user_model().objects.create_superuser("mapped")
|
||||||
|
cls.device = TOTPDevice.objects.create(user=cls.operator, name="test")
|
||||||
|
cls.local = HostingAccount.objects.create(
|
||||||
|
name="Local hosting", primary_domain="local.example.test"
|
||||||
|
)
|
||||||
|
cls.peer = PanelPeer.objects.create(
|
||||||
|
origin="https://web2.cluster.example",
|
||||||
|
public_key="ab" * 32,
|
||||||
|
remote_username="remote-operator",
|
||||||
|
operator=cls.operator,
|
||||||
|
)
|
||||||
|
cls.customer = get_user_model().objects.create_user("customer")
|
||||||
|
cls.cluster = reverse("panel:cluster_accounts")
|
||||||
|
cls.local_list = reverse("panel:accounts")
|
||||||
|
|
||||||
|
def sign_in(self):
|
||||||
|
self.client.force_login(self.operator)
|
||||||
|
session = self.client.session
|
||||||
|
session[DEVICE_ID_SESSION_KEY] = self.device.persistent_id
|
||||||
|
session.save()
|
||||||
|
|
||||||
|
def remote_result(self, *, count=1, more=False):
|
||||||
|
return {
|
||||||
|
"accounts": [
|
||||||
|
{
|
||||||
|
"id": number,
|
||||||
|
"name": f"Remote site {number}",
|
||||||
|
"primary_domain": f"remote{number}.example.test",
|
||||||
|
"services_suspended": True,
|
||||||
|
}
|
||||||
|
for number in range(1, count + 1)
|
||||||
|
],
|
||||||
|
"more": more,
|
||||||
|
}
|
||||||
|
|
||||||
|
def test_short_name_and_links_point_to_owner(self):
|
||||||
|
self.sign_in()
|
||||||
|
local = self.client.get(self.local_list)
|
||||||
|
self.assertContains(local, "This node")
|
||||||
|
self.assertContains(local, "All nodes")
|
||||||
|
self.assertContains(local, 'aria-label="web1.a.cluster.example"')
|
||||||
|
self.assertContains(local, ">web1<")
|
||||||
|
with patch(
|
||||||
|
"coulobre.hosting.cluster_accounts.peer_call",
|
||||||
|
return_value=self.remote_result(),
|
||||||
|
) as exchange:
|
||||||
|
response = self.client.get(self.cluster)
|
||||||
|
self.assertContains(response, self.local.get_absolute_url())
|
||||||
|
self.assertContains(response, "Remote site 1")
|
||||||
|
self.assertContains(
|
||||||
|
response,
|
||||||
|
self.peer.origin + reverse("panel:account", kwargs={"pk": 1}),
|
||||||
|
)
|
||||||
|
self.assertContains(response, ">web2<")
|
||||||
|
self.assertContains(response, 'aria-label="web2.cluster.example"')
|
||||||
|
self.assertIn("no-store", response.headers["Cache-Control"])
|
||||||
|
exchange.assert_called_once_with(
|
||||||
|
self.peer, "account-inventory", "mapped", '{"q": "", "offset": 0}'
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_hostname_collision_only_expands_colliding_labels(self):
|
||||||
|
PanelPeer.objects.create(
|
||||||
|
origin="https://web1.b.cluster.example",
|
||||||
|
public_key="cd" * 32,
|
||||||
|
remote_username="collision",
|
||||||
|
operator=self.operator,
|
||||||
|
)
|
||||||
|
self.sign_in()
|
||||||
|
response = self.client.get(self.cluster, {"node": "local"})
|
||||||
|
self.assertContains(response, ">web1.a<")
|
||||||
|
labels = [node.label for node in response.context["cluster_nodes"]]
|
||||||
|
self.assertEqual(labels, ["web1.a", "web1.b", "web2"])
|
||||||
|
|
||||||
|
def test_filter_and_search_visit_only_selected_node_and_can_page(self):
|
||||||
|
self.sign_in()
|
||||||
|
with patch(
|
||||||
|
"coulobre.hosting.cluster_accounts.peer_call",
|
||||||
|
return_value=self.remote_result(count=PAGE_SIZE, more=True),
|
||||||
|
) as exchange:
|
||||||
|
response = self.client.get(
|
||||||
|
self.cluster,
|
||||||
|
{"node": self.peer.pk, "q": "remote", "offset": 20},
|
||||||
|
)
|
||||||
|
self.assertNotContains(response, self.local.name)
|
||||||
|
self.assertContains(response, "Previous")
|
||||||
|
self.assertContains(response, "Next")
|
||||||
|
self.assertContains(response, "offset=40")
|
||||||
|
exchange.assert_called_once_with(
|
||||||
|
self.peer,
|
||||||
|
"account-inventory",
|
||||||
|
"mapped",
|
||||||
|
'{"q": "remote", "offset": 20}',
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_unavailable_or_invalid_peer_results_do_not_hide_local_accounts(
|
||||||
|
self,
|
||||||
|
):
|
||||||
|
self.sign_in()
|
||||||
|
for result in (
|
||||||
|
PeerAccessError("Peer unavailable"),
|
||||||
|
self.remote_result() | {"unexpected": True},
|
||||||
|
):
|
||||||
|
with (
|
||||||
|
self.subTest(result=result),
|
||||||
|
patch(
|
||||||
|
"coulobre.hosting.cluster_accounts.peer_call",
|
||||||
|
**(
|
||||||
|
{"side_effect": result}
|
||||||
|
if isinstance(result, Exception)
|
||||||
|
else {"return_value": result}
|
||||||
|
),
|
||||||
|
),
|
||||||
|
):
|
||||||
|
response = self.client.get(self.cluster)
|
||||||
|
self.assertContains(response, "Results may be incomplete")
|
||||||
|
self.assertContains(response, self.local.name)
|
||||||
|
self.assertNotContains(response, "Remote site")
|
||||||
|
|
||||||
|
def test_only_mapped_verified_operators_can_use_inventory(self):
|
||||||
|
self.client.force_login(self.operator)
|
||||||
|
self.assertEqual(self.client.get(self.cluster).status_code, 403)
|
||||||
|
self.client.force_login(self.customer)
|
||||||
|
self.assertEqual(self.client.get(self.cluster).status_code, 403)
|
||||||
|
self.sign_in()
|
||||||
|
other = get_user_model().objects.create_superuser("unmapped")
|
||||||
|
PanelPeer.objects.filter(pk=self.peer.pk).update(operator=other)
|
||||||
|
with patch("coulobre.hosting.cluster_accounts.peer_call") as exchange:
|
||||||
|
self.assertEqual(self.client.get(self.cluster).status_code, 404)
|
||||||
|
self.assertNotContains(
|
||||||
|
self.client.get(self.local_list), "All nodes"
|
||||||
|
)
|
||||||
|
exchange.assert_not_called()
|
||||||
|
|
||||||
|
def test_revoked_peer_and_unknown_filters_are_not_available(self):
|
||||||
|
self.sign_in()
|
||||||
|
self.assertEqual(
|
||||||
|
self.client.get(self.cluster, {"node": "999"}).status_code, 404
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
self.client.get(self.cluster, {"offset": "20"}).status_code, 404
|
||||||
|
)
|
||||||
|
PanelPeer.objects.filter(pk=self.peer.pk).update(
|
||||||
|
revoked_at=timezone.now()
|
||||||
|
)
|
||||||
|
self.assertEqual(self.client.get(self.cluster).status_code, 404)
|
||||||
|
self.assertNotContains(
|
||||||
|
self.client.get(self.local_list), "Hosting node"
|
||||||
|
)
|
||||||
@@ -22,6 +22,7 @@ from .account_security import (
|
|||||||
)
|
)
|
||||||
from .backup_restores import RestoreKind
|
from .backup_restores import RestoreKind
|
||||||
from .certificate_views import customer_certificates, operator_certificates
|
from .certificate_views import customer_certificates, operator_certificates
|
||||||
|
from .cluster_account_views import ClusterAccountList
|
||||||
from .credential_views import DatabaseCredentialView, MailboxCredentialView
|
from .credential_views import DatabaseCredentialView, MailboxCredentialView
|
||||||
from .customer_backup_views import CustomerBackupView, CustomerRestoreView
|
from .customer_backup_views import CustomerBackupView, CustomerRestoreView
|
||||||
from .database_login_views import (
|
from .database_login_views import (
|
||||||
@@ -328,6 +329,11 @@ urlpatterns = [
|
|||||||
name="smtp_applications",
|
name="smtp_applications",
|
||||||
),
|
),
|
||||||
path("", views.AccountList.as_view(), name="accounts"),
|
path("", views.AccountList.as_view(), name="accounts"),
|
||||||
|
path(
|
||||||
|
"accounts/cluster/",
|
||||||
|
ClusterAccountList.as_view(),
|
||||||
|
name="cluster_accounts",
|
||||||
|
),
|
||||||
path(
|
path(
|
||||||
"service-health/", ServiceHealthView.as_view(), name="service_health"
|
"service-health/", ServiceHealthView.as_view(), name="service_health"
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ from .backup_restores import (
|
|||||||
retry_remote_mail_restore,
|
retry_remote_mail_restore,
|
||||||
)
|
)
|
||||||
from .backup_retention import change_backup_retention, protect_backup
|
from .backup_retention import change_backup_retention, protect_backup
|
||||||
|
from .cluster_accounts import inventory_nodes
|
||||||
from .dns_defaults import hosting_address_choices, zone_defaults
|
from .dns_defaults import hosting_address_choices, zone_defaults
|
||||||
from .dns_forms import (
|
from .dns_forms import (
|
||||||
DnsZoneEditForm,
|
DnsZoneEditForm,
|
||||||
@@ -400,6 +401,9 @@ class AccountList(TenantScopeMixin, PermissionRequiredMixin, ListView):
|
|||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(search=self.search, **kwargs)
|
context = super().get_context_data(search=self.search, **kwargs)
|
||||||
|
if nodes := inventory_nodes(self.request):
|
||||||
|
context["cluster_nodes"] = nodes
|
||||||
|
context["local_hosting_node"] = nodes[0]
|
||||||
if not self.search and not self.request.GET.get("customer"):
|
if not self.search and not self.request.GET.get("customer"):
|
||||||
context["onboarding"] = onboarding_context(self.request)
|
context["onboarding"] = onboarding_context(self.request)
|
||||||
context["show_customer_website_link"] = settings.WEBSITE_USAGE
|
context["show_customer_website_link"] = settings.WEBSITE_USAGE
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ CUSTOMER_NAV_ROUTES = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WORKSPACE_PARENT_ROUTES = {
|
WORKSPACE_PARENT_ROUTES = {
|
||||||
|
"cluster_accounts": ("accounts", ()),
|
||||||
"user_delete": ("all_users", ()),
|
"user_delete": ("all_users", ()),
|
||||||
"remote_deploy": ("connected_nodes", ()),
|
"remote_deploy": ("connected_nodes", ()),
|
||||||
"dns_topology": ("dns_defaults", ()),
|
"dns_topology": ("dns_defaults", ()),
|
||||||
|
|||||||
Reference in new issue
Block a user