feat: Improved disk-space UI and CLI that shows the actual path being monitored instead of just a disk number
Check / stable / fmt (push) Has been cancelled
Check / beta / clippy (push) Has been cancelled
Check / stable / clippy (push) Has been cancelled
Check / nightly / doc (push) Has been cancelled
Check / 1.89.0 / check (push) Has been cancelled
Test Suite / ubuntu / beta (push) Has been cancelled
Test Suite / ubuntu / stable (push) Has been cancelled
Test Suite / macos-latest / stable (push) Has been cancelled
Test Suite / windows-latest / stable (push) Has been cancelled
Test Suite / ubuntu / stable / coverage (push) Has been cancelled
Check / stable / fmt (push) Has been cancelled
Check / beta / clippy (push) Has been cancelled
Check / stable / clippy (push) Has been cancelled
Check / nightly / doc (push) Has been cancelled
Check / 1.89.0 / check (push) Has been cancelled
Test Suite / ubuntu / beta (push) Has been cancelled
Test Suite / ubuntu / stable (push) Has been cancelled
Test Suite / macos-latest / stable (push) Has been cancelled
Test Suite / windows-latest / stable (push) Has been cancelled
Test Suite / ubuntu / stable / coverage (push) Has been cancelled
This commit is contained in:
@@ -296,6 +296,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_lidarr_serdeable_from_disk_spaces() {
|
||||
let disk_spaces = vec![DiskSpace {
|
||||
path: Some("/path".to_owned()),
|
||||
free_space: 1,
|
||||
total_space: 1,
|
||||
}];
|
||||
|
||||
@@ -233,6 +233,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_radarr_serdeable_from_disk_spaces() {
|
||||
let disk_spaces = vec![DiskSpace {
|
||||
path: Some("/path".to_owned()),
|
||||
free_space: 1,
|
||||
total_space: 1,
|
||||
}];
|
||||
|
||||
@@ -83,6 +83,7 @@ pub struct CommandBody {
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DiskSpace {
|
||||
pub path: Option<String>,
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
pub free_space: i64,
|
||||
#[serde(deserialize_with = "super::from_i64")]
|
||||
|
||||
@@ -427,6 +427,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_sonarr_serdeable_from_disk_spaces() {
|
||||
let disk_spaces = vec![DiskSpace {
|
||||
path: Some("/path".to_owned()),
|
||||
free_space: 1,
|
||||
total_space: 1,
|
||||
}];
|
||||
|
||||
@@ -17,10 +17,12 @@ mod tests {
|
||||
let (mock, app, _server) = MockServarrApi::get()
|
||||
.returns(json!([
|
||||
{
|
||||
"path": "/path1",
|
||||
"freeSpace": 1111,
|
||||
"totalSpace": 2222,
|
||||
},
|
||||
{
|
||||
"path": "/path2",
|
||||
"freeSpace": 3333,
|
||||
"totalSpace": 4444
|
||||
}
|
||||
@@ -30,10 +32,12 @@ mod tests {
|
||||
let mut network = test_network(&app);
|
||||
let disk_space_vec = vec![
|
||||
DiskSpace {
|
||||
path: Some("/path1".to_owned()),
|
||||
free_space: 1111,
|
||||
total_space: 2222,
|
||||
},
|
||||
DiskSpace {
|
||||
path: Some("/path2".to_owned()),
|
||||
free_space: 3333,
|
||||
total_space: 4444,
|
||||
},
|
||||
|
||||
@@ -4,6 +4,7 @@ use chrono::DateTime;
|
||||
|
||||
pub fn diskspace() -> DiskSpace {
|
||||
DiskSpace {
|
||||
path: Some("/path".to_owned()),
|
||||
free_space: 6500,
|
||||
total_space: 8675309,
|
||||
}
|
||||
|
||||
@@ -113,10 +113,12 @@ mod tests {
|
||||
let (mock, app, _server) = MockServarrApi::get()
|
||||
.returns(json!([
|
||||
{
|
||||
"path": "/path1",
|
||||
"freeSpace": 1111,
|
||||
"totalSpace": 2222,
|
||||
},
|
||||
{
|
||||
"path": "/path2",
|
||||
"freeSpace": 3333,
|
||||
"totalSpace": 4444
|
||||
}
|
||||
@@ -127,10 +129,12 @@ mod tests {
|
||||
let mut network = test_network(&app);
|
||||
let disk_space_vec = vec![
|
||||
DiskSpace {
|
||||
path: Some("/path1".to_owned()),
|
||||
free_space: 1111,
|
||||
total_space: 2222,
|
||||
},
|
||||
DiskSpace {
|
||||
path: Some("/path2".to_owned()),
|
||||
free_space: 3333,
|
||||
total_space: 4444,
|
||||
},
|
||||
|
||||
@@ -148,10 +148,15 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
|
||||
for i in 0..disk_space_vec.len() {
|
||||
let DiskSpace {
|
||||
path,
|
||||
free_space,
|
||||
total_space,
|
||||
} = &disk_space_vec[i];
|
||||
let title = format!("Disk {}", i + 1);
|
||||
let title = if let Some(path) = path {
|
||||
path
|
||||
} else {
|
||||
&format!("Disk {}", i + 1)
|
||||
};
|
||||
let ratio = if *total_space == 0 {
|
||||
0f64
|
||||
} else {
|
||||
|
||||
@@ -141,10 +141,15 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
|
||||
for i in 0..disk_space_vec.len() {
|
||||
let DiskSpace {
|
||||
path,
|
||||
free_space,
|
||||
total_space,
|
||||
} = &disk_space_vec[i];
|
||||
let title = format!("Disk {}", i + 1);
|
||||
let title = if let Some(path) = path {
|
||||
path
|
||||
} else {
|
||||
&format!("Disk {}", i + 1)
|
||||
};
|
||||
let ratio = if *total_space == 0 {
|
||||
0f64
|
||||
} else {
|
||||
|
||||
@@ -149,10 +149,16 @@ fn draw_stats_context(f: &mut Frame<'_>, app: &App<'_>, area: Rect) {
|
||||
|
||||
for i in 0..disk_space_vec.len() {
|
||||
let DiskSpace {
|
||||
path,
|
||||
free_space,
|
||||
total_space,
|
||||
..
|
||||
} = &disk_space_vec[i];
|
||||
let title = format!("Disk {}", i + 1);
|
||||
let title = if let Some(path) = path {
|
||||
path
|
||||
} else {
|
||||
&format!("Disk {}", i + 1)
|
||||
};
|
||||
let ratio = if *total_space == 0 {
|
||||
0f64
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user