Detail View

This module contains views to implement the Proxy.

card-style detail view in the Smarter Dashboard.

class smarter.apps.proxy.views.detailview.ProxyDetailView(**kwargs)[source]

Bases: DocsBaseView

Renders the detail view for a Smarter dashboard proxy.

This view renders a detailed manifest for a specific proxy, including its configuration and metadata, in YAML format. It is intended for authenticated users and provides error handling for missing or unsupported proxy kinds and names.

Parameters:
  • request (ASGIRequest) – Django HTTP request object.

  • args (tuple) – Additional positional arguments.

  • kwargs (dict) – Keyword arguments, must include ‘hashed_id’, the Proxy’s hashed id.

Returns:

Rendered HTML page with proxy manifest details, or a 404 error page if the proxy is not found or parameters are invalid.

Return type:

HttpResponse

Note

The user may view their own Proxies, their account’s, and the built-in Proxies. Otherwise, a “not found” response is returned.

See also

Proxy for proxy metadata retrieval. ApiV1CliDescribeApiView for API details.

Example usage:

GET /proxy/proxies/<hashed_id>/
get(request, *args, **kwargs)[source]

Handle GET requests to render the proxy manifest detail view.

This method processes the incoming request to retrieve the specified proxy’s manifest details and renders them in a user-friendly format. It performs validation on the provided proxy name and kind, retrieves the proxy metadata, and handles any errors that may arise during this process.

Process: 1. Extract and validate ‘name’ and ‘kind’ from kwargs. 2. Retrieve the proxy metadata using the provided name and user context. 3. If the proxy is found, call the API view to get the proxy details 4. Convert the JSON response to YAML format for better readability. 5. Render the proxy manifest detail template with the retrieved data. 6. Handle any errors that occur during the process and return appropriate error responses.

Parameters:
  • request (ASGIRequest) – Django HTTP request object.

  • args (tuple) – Additional positional arguments.

  • kwargs (dict) – Keyword arguments, must include ‘name’ (proxy name) and ‘kind’ (proxy type).

Returns:

Rendered HTML page with proxy manifest details, or an error response if the proxy is not found or parameters are invalid.

Return type:

HttpResponse

proxy: Proxy | None = None
template_path: str | None = 'common/manifest_detail.html'