.. _views:

Views
=====

Views allow you to add an interactive view on a selected set of resources.

You can add, edit, and remove views in the "Views" menu. A view can have a comment, which the list
of views shows to describe what the view is for. Adding or removing a view, or changing its
filters, requires the `Resource.Modify` privilege on `/view`. Changing only a view's comment or
layout requires `Resource.Modify` on `/view/{id}`.

Resource Selection
------------------

The resource selection is controlled by an include-exclude filter system.

You define what resources to consider for including which then get passed through an exclude list to
single specific types out again.

This way you can, for example, easily configure to include all virtual machine resources, but then
exclude any such VM that resides on a specific remote.

Filter Types
^^^^^^^^^^^^

 .. todo auto-generate below list

The following lists of filter types are available to be used in include or exclude lists.

- The `resource-type` filter allows you to filter by a specific resource type.
  The following types are available:

  - `datastore`: A Proxmox Backup Server datastore.
  - `lxc`: A LXC container.
  - `network`: A Proxmox VE SDN zone or fabric.
  - `node`: A Proxmox VE or Proxmox Backup Server node.
  - `qemu`: A QEMU virtual machine.
  - `storage`: A Proxmox VE storage

- The `resource-pool` filter allows you to include or exclude only resources that are located in a
  specific resource pool-name.
- The `tag` filter allows you to filter resources that are tagged with a specific tag-name.
- The `remote` filter allows you to filter resources located on a specific remote.
- The `resource-id` filter allows you to filter resources with a specific ID.


Each filter can be prefixed with an optional `<match-behavior>:` prefix. Currently there is only
the `exact` matching behavior available. This behavior is the default if no prefix is provided.


Customizable Dashboard
----------------------

You can create customizable dashboards for a view from a set of pre-defined widgets.
Only resources matching your include minus the ones matching your exclude filters will be displayed
in these widgets.

To edit the layout of a view, click the pencil icon at the top right of the view. This requires the
`Resource.Modify` privilege on the view. While editing, you can add and remove rows and widgets,
move widgets by dragging them, and change their relative width with the "Flex" controls. Adding a
widget, or clicking a widget's pencil icon, opens the "Widget Options" panel on the right. There
you can set a custom title, for example to tell apart two widgets of the same type, and change
widget-specific options such as its variant or graph type. Changes are previewed immediately in the
layout. Click the check mark to save the layout, or the cross to discard the changes.

The "Bulk Actions" menu in the same bar lets you start, shut down, hibernate, or migrate the
Proxmox VE guests shown by the view (see :ref:`guests`). It acts only on guests for which you hold
the required privilege (`Resource.Manage`, or `Resource.Migrate` for migration). Individual actions
are disabled if you do not hold the required privilege on any eligible guest in the view, and the
menu itself is disabled while guests load or when no guest can be acted on.


Widgets
^^^^^^^

The following widgets are available:

- The `nodes` widget shows a status overview of the Proxmox VE and Proxmox
  Backup Server nodes, and can be limited to a single remote type.
- The `guests` widget shows a status overview of the virtual guests, and can be
  limited to QEMU virtual machines or LXC containers.
- The `pbs-datastores` widget shows the usage and status of Proxmox Backup
  Server datastores, counting **Online**, **Error**, **Under Maintenance**,
  **Not Mounted** (shown when non-zero), **High usage**, **Unknown**, and
  **All**. Clicking a row opens a matching search scoped to the current view.
- The `remotes` widget lists the configured remotes and their status. It can
  also show a wizard for adding a new remote.
- The `subscription` widget shows the subscription status of the remotes.
- The `sdn` widget shows the status of the Software-Defined Networking (SDN)
  zones.
- The `leaderboard` widget lists the ten resources with the highest usage over
  the last day and shows their usage history. Guests and nodes are ranked by CPU
  usage or by used memory relative to total memory; Proxmox VE storages and
  Proxmox Backup Server datastores are ranked by used space relative to total
  space. Usage over time is shown as a heatmap by default, or as a line, area,
  or bar graph. External links to a remote's web interface are hidden unless you
  have direct audit access on that remote.
- The `task-summary` widget summarizes recent tasks, grouped by a chosen
  criterion. Opening a task's status or log from the summary requires direct
  `Resource.Audit` on `/resource/{remote}`.
- The `resource-tree` widget shows the selected resources in a hierarchical
  tree.
- The `node-resource-gauge` widget displays a single node resource, such as
  CPU, memory, or storage, as a gauge chart, and can be limited to a single
  remote type.
- The `map` widget plots the remotes on an interactive world map at their
  configured geographic location. Markers are colored by the remote's status,
  and markers that are close together are clustered as you zoom out.
- The `updates` widget shows how many nodes are up to date, have pending
  updates, or could not be checked, using the update status last fetched from
  the remotes (see :ref:`remote_status`). In a view, it covers the nodes of the
  view. If you have audit access to remotes, clicking a row opens the "Updates"
  tab under "Remotes".
- The `ceph` widget shows how many Ceph clusters report each health state, as
  in the cluster list of the "Ceph" menu. Unreachable clusters count as
  warnings, and clusters that are gone count as errors. If health checks are
  muted in Ceph, which leaves them out of the health state, another row counts
  the clusters with such checks. In a view, it covers the clusters with a
  member on a node of the view. A view does not grant access to Ceph clusters,
  see :ref:`ceph` for the required privilege. If you have audit access to
  remotes, clicking a row opens the "Ceph" menu.

Map Widget
^^^^^^^^^^

The locations shown by the `map` widget come from the remotes and cannot be
edited in Proxmox Datacenter Manager. Configure them on the remote side:

- On Proxmox VE, set a cluster-wide default in the datacenter options, and
  optionally override it per node in the node options.
- On Proxmox Backup Server, set the location under the "Configuration" menu, in
  the "Other" tab's "Location" section.

Each location of a remote is a point on the map. Points that are too close to
tell apart at the current zoom level are combined into one, which shows how
many points it combines. A point has the color of the worst status of its
remotes. If the remotes of a combined point have different statuses, a ring
around it shows the share of remotes in each status. Points with a warning or
an error pulse slowly. If there is room, the name of the location, or of the
remote if the location has none, is shown next to a point, provided all the
points it combines have the same name.
In a view, the map also keeps nodes hosting resources matched by the view (and
Proxmox Backup Server remotes with matching resources), even if those nodes are
excluded by the view filter.

Running migrations of guests between remotes are shown as animated arrows from
the source to the target location. Hovering an arrow shows the guest and its
route.

- Proxmox Datacenter Manager records the destination for migrations it starts.
  For other migrations, the destination comes from the task log, if its address
  belongs to exactly one node of exactly one Proxmox VE remote. As Proxmox VE
  does not log the API port, remotes behind the same address cannot be told
  apart, and such routes are only shown to users with `Resource.Audit` on both
  remotes, not through a view.
- Migrations within a cluster are not shown.
- Both remotes need a location on the map. If the source or target node has no
  location, another location of its remote is used.
- There is no arrow while the source and the target are in the same combined
  point or too close to each other.
- A view must include the source node to list a migration and also the target
  node to include its destination. Without a view, listing the migration
  requires `Resource.Audit` on the source remote, and showing its destination
  requires that privilege on the target remote as well.
- Migrations started directly on a remote may take longer to appear, and
  short migrations may not appear.

The lower left corner of the map summarizes the remotes on the map, those with
an error or a warning, and the migrations shown on it. Each entry opens a list.
Selecting a remote opens it. Selecting a migration opens its task only if you
have `Resource.Audit` on the source remote.

The part of the world where it is currently night is shaded. The moon button,
"Show where it is night", turns that off and on, and the browser remembers the
choice for maps opened later.

The map background is drawn from public-domain vector data by `Natural Earth
<https://www.naturalearthdata.com/>`_, shipped in the `proxmox-geojson-data`
package.


Access Control
--------------

You can grant permissions on specific views. With such a permission the user can operate on the
view and all its selected resources.
