> ## Documentation Index
> Fetch the complete documentation index at: https://docs.azalt.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Dashboard

> Container of widgets with org-wide filters, visibility controls, and password-protected public sharing.

### Dashboard

Dashboards are containers for widgets that visualize environmental indicators. They support an org-wide global filter (sites, years, statuses), layout management, and optional public sharing with password protection.

#### At a Glance

* Grid layout; drag to move and resize widgets
* Global filter: `siteIds`, `startYear`, `endYear`, `statuses`
* Visibility: private (org members) or public (optional password)
* Filter precedence: widget filter overrides dashboard global filter
* Defaults: statuses fall back to organization defaults (or `APPROVED`)

#### Data Shape

```typescript theme={null}
// apps/azalt/src/server/db/types/dashboard.ts (simplified)
interface Dashboard {
  id: string;
  name: string;
  description: string | null;
  organizationId: string;
  globalFilter: {
    siteIds?: string[];
    startYear?: number;
    endYear?: number;
    statuses?: ("APPROVED" | "COMPLETED" | "REJECTED")[];
  };
  isPublic: boolean;     // public dashboards require no login
  password: string | null; // bcrypt hash when set; optional for public
  order: number;         // display order within org
}
```

#### Global Filter

* Dashboard global filter applies to all widgets unless the widget defines its own filter.
* Unified filter keys: `siteIds`, `startYear`, `endYear`, `statuses`.
* Status fallback: if neither widget nor dashboard defines `statuses`, we use the organization default dashboard statuses, else `APPROVED`.
* Public dashboards accept per-widget temporary filter overrides via the API without saving them.

#### Visibility & Sharing

* Private: members of the current organization only.
* Public: anyone with the link; optional password gate. Passwords are validated server-side (bcrypt).
* Public view stores a successful password locally for user convenience; no accounts are needed.

#### Filter Precedence

1. Public overrides (request-time per-widget) → 2) Widget filter → 3) Dashboard global filter → 4) Org default statuses → 5) `APPROVED`.

#### Security & Permissions

* Read: Viewer role or higher (private dashboards) or public link (public dashboards)
* Write (create/update/delete/reorder/updateGlobalFilters): Manager role or higher
* API: corresponding procedures are available for both app and API key access where applicable

#### Typical Operations

* Create a dashboard (private by default)
* Toggle public access and set/remove a password
* Reorder dashboards and widgets via drag-and-drop
* Update global filter (sites/years/statuses)
* Export widget visuals (from the UI) when needed

#### API Notes

* `dashboards.get`: returns `globalFilter` normalized to an object and `organizationDefaultStatuses` for UI defaults
* `dashboards.update`: accepts `name`, `description`, `isPublic`, optional `password`
* `dashboards.updateGlobalFilters`: saves the unified `globalFilter`
* `dashboards.getWithData` (public): returns dashboard, widgets, datasets, indicators, and per-widget data with merged filters

#### Related Concepts

* Widget — visualization unit configured per indicator
* Indicator — calculated metric source for widgets
* Dataset — coefficients and reference values for indicator calculations
