duck.etc.blueprints.dashboard.ui.components.errors_panel

ErrorsPanel component — displays a breakdown of HTTP error responses by status code with proportional bar indicators.

Module Contents

Classes

ErrorsPanel

Renders error counts broken down by HTTP status code.

API

class duck.etc.blueprints.dashboard.ui.components.errors_panel.ErrorsPanel(element: Optional[str] = None, properties: Optional[Dict[str, str]] = None, props: Optional[Dict[str, str]] = None, style: Optional[Dict[str, str]] = None, inner_html: Optional[Union[str, str, float]] = None, children: Optional[List[duck.html.components.HtmlComponent]] = None, **kwargs)[source]

Bases: duck.html.components.InnerComponent

Renders error counts broken down by HTTP status code.

Shows each status code as a row with a label, proportional fill bar, and numeric count.

Props: data (list[dict]): Output of services.get_error_breakdown().

Initialization

Initialize an HTML component.

Parameters:
  • element – The HTML element tag name (e.g., textarea, input, button). Can be None, but make sure element is returned by get_element method.

  • accept_inner_html – Whether the HTML component accepts an inner body (e.g., inner-body-here).

  • inner_html – Inner html to add to the HTML component. Defaults to None.

  • properties – Dictionary for properties to initialize the component with.

  • props – Just same as properties argument (added for simplicity).

  • style – Dictionary for style to initialize the component with.

  • **kwargs – Extra keyword arguments

Raises:

HtmlComponentError – If ‘element’ is not a string or ‘inner_html’ is set but ‘accept_inner_html’ is False.

build_body(data: list) duck.html.components.container.Container[source]

Returns the scrollable body containing all error rows.

Parameters:

data – List of error breakdown dicts.

Returns:

A Container with the rendered error rows.

build_header(data: list) duck.html.components.container.Container[source]

Returns the panel header with title and total error count.

Parameters:

data – List of error breakdown dicts.

Returns:

A Container with header markup.

get_element() str[source]
Returns:

The HTML element tag for this component.

on_create() None[source]

Builds the panel header and error rows.

render_row(entry: dict, max_count: int) str[source]

Returns the HTML string for a single error status row.

Parameters:
  • entry – Dict with keys: code, label, count.

  • max_count – The highest count in the dataset for bar scaling.

Returns:

HTML string for the error row div.