| 1 | use serde::Deserialize; |
| 2 | |
| 3 | use super::IgnoreList; |
| 4 | |
| 5 | /// Whether the disk graph legend labels use device names or mount points. |
| 6 | #[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq)] |
| 7 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 8 | #[serde(rename_all = "snake_case")] |
| 9 | pub enum DiskGraphLegend { |
| 10 | /// Label entries by kernel device name (e.g. `sda`, `nvme0n1`). |
| 11 | #[default] |
| 12 | Disk, |
| 13 | /// Label entries by mount point (e.g. `/`, `/home`). |
| 14 | Mount, |
| 15 | } |
| 16 | |
| 17 | /// Disk I/O graph configuration. |
| 18 | #[derive(Clone, Debug, Default, Deserialize)] |
| 19 | #[cfg_attr(feature = "generate_schema", derive(schemars::JsonSchema))] |
| 20 | #[cfg_attr(test, serde(deny_unknown_fields), derive(PartialEq, Eq))] |
| 21 | pub(crate) struct DiskIoGraphConfig { |
| 22 | /// Whether to show the read rate line. Defaults to true. |
| 23 | pub(crate) show_read: Option<bool>, |
| 24 | |
| 25 | /// Whether to show the write rate line. Defaults to true. |
| 26 | pub(crate) show_write: Option<bool>, |
| 27 | |
| 28 | /// Whether to label legend entries by device name or mount point. Defaults to disk name. |
| 29 | pub(crate) legend: Option<DiskGraphLegend>, |
| 30 | |
| 31 | /// Whether to use a logarithmic scale on the y-axis. Defaults to false. |
| 32 | pub(crate) use_log: Option<bool>, |
| 33 | |
| 34 | /// Where to position the legend within the widget. |
| 35 | pub(crate) legend_position: Option<String>, |
| 36 | |
| 37 | /// An optional list of device names to include or exclude. |
| 38 | pub(crate) name_filter: Option<IgnoreList>, |
| 39 | |
| 40 | /// Whether to include block devices that aren't currently mounted (currently Linux only). Defaults to false. |
| 41 | pub(crate) include_unmounted: Option<bool>, |
| 42 | } |