diff --git a/docs/deployment.md b/docs/deployment.md index fa2bc0b..ddb5e27 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -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 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 Open **About Coulobre → Configure features** as a superuser with a verified diff --git a/src/coulobre/hosting/cluster_account_views.py b/src/coulobre/hosting/cluster_account_views.py new file mode 100644 index 0000000..9147fec --- /dev/null +++ b/src/coulobre/hosting/cluster_account_views.py @@ -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, + ) diff --git a/src/coulobre/hosting/static/hosting/panel.css b/src/coulobre/hosting/static/hosting/panel.css index 7335d36..41c6062 100644 --- a/src/coulobre/hosting/static/hosting/panel.css +++ b/src/coulobre/hosting/static/hosting/panel.css @@ -1400,3 +1400,13 @@ dd { .workspace-list li + li { 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; +} diff --git a/src/coulobre/hosting/templates/hosting/account_list.html b/src/coulobre/hosting/templates/hosting/account_list.html index 9c3dc85..32cf2ed 100644 --- a/src/coulobre/hosting/templates/hosting/account_list.html +++ b/src/coulobre/hosting/templates/hosting/account_list.html @@ -13,6 +13,7 @@ {% endif %} {% endblock %} +{% block page_tabs %}{% include "hosting/hosting_account_tabs.html" %}{% endblock %} {% block page_context %}