build(deps): updated dependencies and edition to 2024

This commit is contained in:
veeso
2025-03-15 14:15:45 +01:00
parent 8a9ba7745a
commit b0f314837e
46 changed files with 3621 additions and 2835 deletions
+14
View File
@@ -1,6 +1,7 @@
# Changelog # Changelog
- [Changelog](#changelog) - [Changelog](#changelog)
- [0.17.0](#0170)
- [0.16.1](#0161) - [0.16.1](#0161)
- [0.16.0](#0160) - [0.16.0](#0160)
- [0.15.0](#0150) - [0.15.0](#0150)
@@ -39,6 +40,19 @@
--- ---
## 0.17.0
Released on ??
- Dependencies:
- `argh` to `0.1.13`
- `bytesize` to `2`
- `dirs` to `6`
- `magic-crypt` to `4`
- `notify` to `8`
- `ssh2-config` to `0.3`
- `remotefs-ssh` to `0.4`
## 0.16.1 ## 0.16.1
Released on 12/11/2024 Released on 12/11/2024
Generated
+1122 -694
View File
File diff suppressed because it is too large Load Diff
+15 -15
View File
@@ -2,7 +2,7 @@
authors = ["Christian Visintin <christian.visintin@veeso.dev>"] authors = ["Christian Visintin <christian.visintin@veeso.dev>"]
categories = ["command-line-utilities"] categories = ["command-line-utilities"]
description = "termscp is a feature rich terminal file transfer and explorer with support for SCP/SFTP/FTP/Kube/S3/WebDAV" description = "termscp is a feature rich terminal file transfer and explorer with support for SCP/SFTP/FTP/Kube/S3/WebDAV"
edition = "2021" edition = "2024"
homepage = "https://termscp.veeso.dev" homepage = "https://termscp.veeso.dev"
include = ["src/**/*", "build.rs", "LICENSE", "README.md", "CHANGELOG.md"] include = ["src/**/*", "build.rs", "LICENSE", "README.md", "CHANGELOG.md"]
keywords = ["terminal", "ftp", "scp", "sftp", "tui"] keywords = ["terminal", "ftp", "scp", "sftp", "tui"]
@@ -10,7 +10,7 @@ license = "MIT"
name = "termscp" name = "termscp"
readme = "README.md" readme = "README.md"
repository = "https://github.com/veeso/termscp" repository = "https://github.com/veeso/termscp"
version = "0.16.1" version = "0.17.0"
[package.metadata.rpm] [package.metadata.rpm]
package = "termscp" package = "termscp"
@@ -33,10 +33,10 @@ path = "src/main.rs"
[dependencies] [dependencies]
argh = "^0.1" argh = "^0.1"
bitflags = "^2" bitflags = "^2"
bytesize = "^1" bytesize = "^2"
chrono = "^0.4" chrono = "^0.4"
content_inspector = "^0.2" content_inspector = "^0.2"
dirs = "^5.0" dirs = "^6"
edit = "^0.1" edit = "^0.1"
filetime = "^0.2" filetime = "^0.2"
hostname = "^0.4" hostname = "^0.4"
@@ -48,12 +48,12 @@ keyring = { version = "^3", optional = true, features = [
lazy-regex = "^3" lazy-regex = "^3"
lazy_static = "^1" lazy_static = "^1"
log = "^0.4" log = "^0.4"
magic-crypt = "^3" magic-crypt = "4"
notify = "6" notify = "8"
notify-rust = { version = "^4.5", default-features = false, features = ["d"] } notify-rust = { version = "^4", default-features = false, features = ["d"] }
nucleo = "0.5" nucleo = "0.5"
open = "^5.0" open = "^5.0"
rand = "^0.8.5" rand = "^0.9"
regex = "^1" regex = "^1"
remotefs = "^0.3" remotefs = "^0.3"
remotefs-aws-s3 = { version = "^0.3", default-features = false, features = [ remotefs-aws-s3 = { version = "^0.3", default-features = false, features = [
@@ -63,7 +63,7 @@ remotefs-aws-s3 = { version = "^0.3", default-features = false, features = [
remotefs-kube = "0.4" remotefs-kube = "0.4"
remotefs-webdav = "^0.2" remotefs-webdav = "^0.2"
rpassword = "^7" rpassword = "^7"
self_update = { version = "^0.41", default-features = false, features = [ self_update = { version = "^0.42", default-features = false, features = [
"rustls", "rustls",
"archive-tar", "archive-tar",
"archive-zip", "archive-zip",
@@ -72,10 +72,10 @@ self_update = { version = "^0.41", default-features = false, features = [
] } ] }
serde = { version = "^1", features = ["derive"] } serde = { version = "^1", features = ["derive"] }
simplelog = "^0.12" simplelog = "^0.12"
ssh2-config = "^0.2" ssh2-config = "^0.3"
tempfile = "^3" tempfile = "3"
thiserror = "^1" thiserror = "2"
tokio = { version = "=1.38.1", features = ["rt"] } tokio = { version = "1.44", features = ["rt"] }
toml = "^0.8" toml = "^0.8"
tui-realm-stdlib = "2" tui-realm-stdlib = "2"
tuirealm = "2" tuirealm = "2"
@@ -106,12 +106,12 @@ remotefs-smb = { version = "^0.3", optional = true }
[target."cfg(target_family = \"windows\")"] [target."cfg(target_family = \"windows\")"]
[target."cfg(target_family = \"windows\")".dependencies] [target."cfg(target_family = \"windows\")".dependencies]
remotefs-ftp = { version = "^0.2", features = ["native-tls"] } remotefs-ftp = { version = "^0.2", features = ["native-tls"] }
remotefs-ssh = "^0.4" remotefs-ssh = "^0.5"
[target."cfg(target_family = \"unix\")"] [target."cfg(target_family = \"unix\")"]
[target."cfg(target_family = \"unix\")".dependencies] [target."cfg(target_family = \"unix\")".dependencies]
remotefs-ftp = { version = "^0.2", features = ["vendored", "native-tls"] } remotefs-ftp = { version = "^0.2", features = ["vendored", "native-tls"] }
remotefs-ssh = { version = "^0.4", features = ["ssh2-vendored"] } remotefs-ssh = { version = "^0.5", features = ["ssh2-vendored"] }
uzers = "0.12" uzers = "0.12"
[profile.dev] [profile.dev]
+13 -4
View File
@@ -243,7 +243,7 @@ impl ActivityManager {
None => { None => {
return Err(format!( return Err(format!(
r#"Could not resolve bookmark name: "{bookmark_name}" no such bookmark"# r#"Could not resolve bookmark name: "{bookmark_name}" no such bookmark"#
)) ));
} }
Some(params) => params, Some(params) => params,
}; };
@@ -495,19 +495,28 @@ impl ActivityManager {
match ThemeProvider::new(theme_path.as_path()) { match ThemeProvider::new(theme_path.as_path()) {
Ok(provider) => provider, Ok(provider) => provider,
Err(err) => { Err(err) => {
error!("Could not initialize theme provider with file '{}': {}; using theme provider in degraded mode", theme_path.display(), err); error!(
"Could not initialize theme provider with file '{}': {}; using theme provider in degraded mode",
theme_path.display(),
err
);
ThemeProvider::degraded() ThemeProvider::degraded()
} }
} }
} }
None => { None => {
error!("This system doesn't provide a configuration directory; using theme provider in degraded mode"); error!(
"This system doesn't provide a configuration directory; using theme provider in degraded mode"
);
ThemeProvider::degraded() ThemeProvider::degraded()
} }
} }
} }
Err(err) => { Err(err) => {
error!("Could not initialize configuration directory: {}; using theme provider in degraded mode", err); error!(
"Could not initialize configuration directory: {}; using theme provider in degraded mode",
err
);
ThemeProvider::degraded() ThemeProvider::degraded()
} }
} }
+2 -2
View File
@@ -4,8 +4,8 @@
use std::io::{Read, Write}; use std::io::{Read, Write};
use serde::de::DeserializeOwned;
use serde::Serialize; use serde::Serialize;
use serde::de::DeserializeOwned;
use thiserror::Error; use thiserror::Error;
/// Contains the error for serializer/deserializer /// Contains the error for serializer/deserializer
@@ -63,7 +63,7 @@ where
return Err(SerializerError::new_ex( return Err(SerializerError::new_ex(
SerializerErrorKind::Serialization, SerializerErrorKind::Serialization,
err.to_string(), err.to_string(),
)) ));
} }
}; };
trace!("Serialized new bookmarks data: {}", data); trace!("Serialized new bookmarks data: {}", data);
+49 -21
View File
@@ -364,8 +364,16 @@ impl Formatter {
if fsentry.is_file() { if fsentry.is_file() {
// Get byte size // Get byte size
let size: ByteSize = ByteSize(fsentry.metadata().size); let size: ByteSize = ByteSize(fsentry.metadata().size);
let mut fmt = size.display().si().to_string();
// pad with up to len 10
let pad = 10usize.saturating_sub(fmt.len());
for _ in 0..pad {
fmt.push(' ');
}
format!("{cur_str}{prefix}{fmt}")
// Add to cur str, prefix and the key value // Add to cur str, prefix and the key value
format!("{cur_str}{prefix}{size:10}") //format!("{cur_str}{prefix}{size:10}", size = size.display().si())
} else if fsentry.metadata().symlink.is_some() { } else if fsentry.metadata().symlink.is_some() {
let size = ByteSize( let size = ByteSize(
fsentry fsentry
@@ -376,7 +384,14 @@ impl Formatter {
.to_string_lossy() .to_string_lossy()
.len() as u64, .len() as u64,
); );
format!("{cur_str}{prefix}{size:10}") let mut fmt = size.display().si().to_string();
// pad with up to len 10
let pad = 10usize.saturating_sub(fmt.len());
for _ in 0..pad {
fmt.push(' ');
}
format!("{cur_str}{prefix}{fmt}")
} else { } else {
// Add to cur str, prefix and the key value // Add to cur str, prefix and the key value
format!("{cur_str}{prefix} ") format!("{cur_str}{prefix} ")
@@ -596,7 +611,7 @@ mod tests {
assert_eq!( assert_eq!(
formatter.fmt(&entry), formatter.fmt(&entry),
format!( format!(
"bar.txt -rw-r--r-- root 8.2 KB {}", "bar.txt -rw-r--r-- root 8.2 kB {}",
fmt_time(t, "%b %d %Y %H:%M") fmt_time(t, "%b %d %Y %H:%M")
) )
); );
@@ -604,7 +619,7 @@ mod tests {
assert_eq!( assert_eq!(
formatter.fmt(&entry), formatter.fmt(&entry),
format!( format!(
"bar.txt -rw-r--r-- 0 8.2 KB {}", "bar.txt -rw-r--r-- 0 8.2 kB {}",
fmt_time(t, "%b %d %Y %H:%M") fmt_time(t, "%b %d %Y %H:%M")
) )
); );
@@ -627,7 +642,7 @@ mod tests {
assert_eq!( assert_eq!(
formatter.fmt(&entry), formatter.fmt(&entry),
format!( format!(
"piroparoporoperoperupup… -rw-r--r-- root 8.2 KB {}", "piroparoporoperoperupup… -rw-r--r-- root 8.2 kB {}",
fmt_time(t, "%b %d %Y %H:%M") fmt_time(t, "%b %d %Y %H:%M")
) )
); );
@@ -635,7 +650,7 @@ mod tests {
assert_eq!( assert_eq!(
formatter.fmt(&entry), formatter.fmt(&entry),
format!( format!(
"piroparoporoperoperupup… -rw-r--r-- 0 8.2 KB {}", "piroparoporoperoperupup… -rw-r--r-- 0 8.2 kB {}",
fmt_time(t, "%b %d %Y %H:%M") fmt_time(t, "%b %d %Y %H:%M")
) )
); );
@@ -658,7 +673,7 @@ mod tests {
assert_eq!( assert_eq!(
formatter.fmt(&entry), formatter.fmt(&entry),
format!( format!(
"bar.txt -????????? root 8.2 KB {}", "bar.txt -????????? root 8.2 kB {}",
fmt_time(t, "%b %d %Y %H:%M") fmt_time(t, "%b %d %Y %H:%M")
) )
); );
@@ -666,7 +681,7 @@ mod tests {
assert_eq!( assert_eq!(
formatter.fmt(&entry), formatter.fmt(&entry),
format!( format!(
"bar.txt -????????? 0 8.2 KB {}", "bar.txt -????????? 0 8.2 kB {}",
fmt_time(t, "%b %d %Y %H:%M") fmt_time(t, "%b %d %Y %H:%M")
) )
); );
@@ -689,7 +704,7 @@ mod tests {
assert_eq!( assert_eq!(
formatter.fmt(&entry), formatter.fmt(&entry),
format!( format!(
"bar.txt -????????? 0 8.2 KB {}", "bar.txt -????????? 0 8.2 kB {}",
fmt_time(t, "%b %d %Y %H:%M") fmt_time(t, "%b %d %Y %H:%M")
) )
); );
@@ -697,7 +712,7 @@ mod tests {
assert_eq!( assert_eq!(
formatter.fmt(&entry), formatter.fmt(&entry),
format!( format!(
"bar.txt -????????? 0 8.2 KB {}", "bar.txt -????????? 0 8.2 kB {}",
fmt_time(t, "%b %d %Y %H:%M") fmt_time(t, "%b %d %Y %H:%M")
) )
); );
@@ -774,8 +789,9 @@ mod tests {
#[test] #[test]
fn test_fs_explorer_formatter_all_together_now() { fn test_fs_explorer_formatter_all_together_now() {
let formatter: Formatter = let formatter: Formatter = Formatter::new(
Formatter::new("{NAME:16} {SYMLINK:12} {GROUP} {USER} {PEX} {SIZE} {ATIME:20:%a %b %d %Y %H:%M} {CTIME:20:%a %b %d %Y %H:%M} {MTIME:20:%a %b %d %Y %H:%M}"); "{NAME:16} {SYMLINK:12} {GROUP} {USER} {PEX} {SIZE} {ATIME:20:%a %b %d %Y %H:%M} {CTIME:20:%a %b %d %Y %H:%M} {MTIME:20:%a %b %d %Y %H:%M}",
);
// Directory (with symlink) // Directory (with symlink)
let t: SystemTime = SystemTime::now(); let t: SystemTime = SystemTime::now();
let entry = File { let entry = File {
@@ -792,12 +808,15 @@ mod tests {
mode: Some(UnixPex::from(0o755)), mode: Some(UnixPex::from(0o755)),
}, },
}; };
assert_eq!(formatter.fmt(&entry), format!( assert_eq!(
formatter.fmt(&entry),
format!(
"projects -> project.info 0 0 lrwxr-xr-x 12 B {} {} {}", "projects -> project.info 0 0 lrwxr-xr-x 12 B {} {} {}",
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
)); )
);
// Directory without symlink // Directory without symlink
let entry = File { let entry = File {
path: PathBuf::from("/home/cvisintin/projects"), path: PathBuf::from("/home/cvisintin/projects"),
@@ -813,12 +832,15 @@ mod tests {
mode: Some(UnixPex::from(0o755)), mode: Some(UnixPex::from(0o755)),
}, },
}; };
assert_eq!(formatter.fmt(&entry), format!( assert_eq!(
formatter.fmt(&entry),
format!(
"projects/ 0 0 drwxr-xr-x {} {} {}", "projects/ 0 0 drwxr-xr-x {} {} {}",
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
)); )
);
// File with symlink // File with symlink
let entry = File { let entry = File {
path: PathBuf::from("/bar.txt"), path: PathBuf::from("/bar.txt"),
@@ -834,12 +856,15 @@ mod tests {
mode: Some(UnixPex::from(0o644)), mode: Some(UnixPex::from(0o644)),
}, },
}; };
assert_eq!(formatter.fmt(&entry), format!( assert_eq!(
formatter.fmt(&entry),
format!(
"bar.txt -> project.info 0 0 lrw-r--r-- 12 B {} {} {}", "bar.txt -> project.info 0 0 lrw-r--r-- 12 B {} {} {}",
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
)); )
);
// File without symlink // File without symlink
let entry = File { let entry = File {
path: PathBuf::from("/bar.txt"), path: PathBuf::from("/bar.txt"),
@@ -855,12 +880,15 @@ mod tests {
mode: Some(UnixPex::from(0o644)), mode: Some(UnixPex::from(0o644)),
}, },
}; };
assert_eq!(formatter.fmt(&entry), format!( assert_eq!(
"bar.txt 0 0 -rw-r--r-- 8.2 KB {} {} {}", formatter.fmt(&entry),
format!(
"bar.txt 0 0 -rw-r--r-- 8.2 kB {} {} {}",
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
fmt_time(t, "%a %b %d %Y %H:%M"), fmt_time(t, "%a %b %d %Y %H:%M"),
)); )
);
} }
#[test] #[test]
+2 -2
View File
@@ -523,7 +523,7 @@ mod tests {
assert_eq!( assert_eq!(
explorer.fmt_file(&entry), explorer.fmt_file(&entry),
format!( format!(
"bar.txt -rw-r--r-- root 8.2 KB {}", "bar.txt -rw-r--r-- root 8.2 kB {}",
fmt_time(t, "%b %d %Y %H:%M") fmt_time(t, "%b %d %Y %H:%M")
) )
); );
@@ -531,7 +531,7 @@ mod tests {
assert_eq!( assert_eq!(
explorer.fmt_file(&entry), explorer.fmt_file(&entry),
format!( format!(
"bar.txt -rw-r--r-- 0 8.2 KB {}", "bar.txt -rw-r--r-- 0 8.2 kB {}",
fmt_time(t, "%b %d %Y %H:%M") fmt_time(t, "%b %d %Y %H:%M")
) )
); );
+4 -2
View File
@@ -301,11 +301,13 @@ mod test {
#[test] #[test]
fn password_missing() { fn password_missing() {
assert!(FileTransferParams::new( assert!(
FileTransferParams::new(
FileTransferProtocol::Scp, FileTransferProtocol::Scp,
ProtocolParams::AwsS3(AwsS3Params::new("omar", Some("eu-west-1"), Some("test"))) ProtocolParams::AwsS3(AwsS3Params::new("omar", Some("eu-west-1"), Some("test")))
) )
.password_missing()); .password_missing()
);
assert_eq!( assert_eq!(
FileTransferParams::new( FileTransferParams::new(
FileTransferProtocol::Scp, FileTransferProtocol::Scp,
+1 -1
View File
@@ -1,8 +1,8 @@
use std::io::{Read, Write}; use std::io::{Read, Write};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use remotefs::fs::{Metadata, UnixPex};
use remotefs::File; use remotefs::File;
use remotefs::fs::{Metadata, UnixPex};
use super::HostResult; use super::HostResult;
+47 -35
View File
@@ -5,8 +5,8 @@ use std::os::unix::fs::PermissionsExt as _;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use filetime::FileTime; use filetime::FileTime;
use remotefs::fs::{FileType, Metadata, UnixPex};
use remotefs::File; use remotefs::File;
use remotefs::fs::{FileType, Metadata, UnixPex};
use super::{HostBridge, HostResult}; use super::{HostBridge, HostResult};
use crate::host::{HostError, HostErrorType}; use crate::host::{HostError, HostErrorType};
@@ -135,7 +135,7 @@ impl HostBridge for Localhost {
HostErrorType::FileAlreadyExists, HostErrorType::FileAlreadyExists,
None, None,
dir_path.as_path(), dir_path.as_path(),
)) ));
} }
} }
} }
@@ -559,7 +559,7 @@ mod tests {
use std::io::Write; use std::io::Write;
use std::ops::AddAssign; use std::ops::AddAssign;
#[cfg(posix)] #[cfg(posix)]
use std::os::unix::fs::{symlink, PermissionsExt}; use std::os::unix::fs::{PermissionsExt, symlink};
use std::time::{Duration, SystemTime}; use std::time::{Duration, SystemTime};
use pretty_assertions::assert_eq; use pretty_assertions::assert_eq;
@@ -661,9 +661,10 @@ mod tests {
#[should_panic] #[should_panic]
fn test_host_localhost_open_read_err_no_such_file() { fn test_host_localhost_open_read_err_no_such_file() {
let mut host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap(); let mut host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
assert!(host assert!(
.open_file(PathBuf::from("/bin/foo-bar-test-omar-123-456-789.txt").as_path()) host.open_file(PathBuf::from("/bin/foo-bar-test-omar-123-456-789.txt").as_path())
.is_ok()); .is_ok()
);
} }
#[test] #[test]
@@ -704,11 +705,13 @@ mod tests {
// Create sample file // Create sample file
assert!(StdFile::create(format!("{}/foo.txt", tmpdir.path().display()).as_str()).is_ok()); assert!(StdFile::create(format!("{}/foo.txt", tmpdir.path().display()).as_str()).is_ok());
// Create symlink // Create symlink
assert!(symlink( assert!(
symlink(
format!("{}/foo.txt", tmpdir.path().display()), format!("{}/foo.txt", tmpdir.path().display()),
format!("{}/bar.txt", tmpdir.path().display()) format!("{}/bar.txt", tmpdir.path().display())
) )
.is_ok()); .is_ok()
);
// Get dir // Get dir
let host: Localhost = Localhost::new(PathBuf::from(tmpdir.path())).ok().unwrap(); let host: Localhost = Localhost::new(PathBuf::from(tmpdir.path())).ok().unwrap();
let files: Vec<File> = host.files.clone(); let files: Vec<File> = host.files.clone();
@@ -747,16 +750,18 @@ mod tests {
// Try to re-create directory // Try to re-create directory
assert!(host.mkdir(PathBuf::from("test_dir").as_path()).is_err()); assert!(host.mkdir(PathBuf::from("test_dir").as_path()).is_err());
// Try abs path // Try abs path
assert!(host assert!(
.mkdir_ex(PathBuf::from("/tmp/test_dir_123456789").as_path(), true) host.mkdir_ex(PathBuf::from("/tmp/test_dir_123456789").as_path(), true)
.is_ok()); .is_ok()
);
// Fail // Fail
assert!(host assert!(
.mkdir_ex( host.mkdir_ex(
PathBuf::from("/aaaa/oooooo/tmp/test_dir_123456789").as_path(), PathBuf::from("/aaaa/oooooo/tmp/test_dir_123456789").as_path(),
true true
) )
.is_err()); .is_err()
);
} }
#[test] #[test]
@@ -780,12 +785,14 @@ mod tests {
assert_eq!(files.len(), 1); // There should be 1 file now assert_eq!(files.len(), 1); // There should be 1 file now
assert!(host.remove(files.get(0).unwrap()).is_ok()); assert!(host.remove(files.get(0).unwrap()).is_ok());
// Remove unexisting directory // Remove unexisting directory
assert!(host assert!(
.remove(&make_fsentry(PathBuf::from("/a/b/c/d"), true)) host.remove(&make_fsentry(PathBuf::from("/a/b/c/d"), true))
.is_err()); .is_err()
assert!(host );
.remove(&make_fsentry(PathBuf::from("/aaaaaaa"), false)) assert!(
.is_err()); host.remove(&make_fsentry(PathBuf::from("/aaaaaaa"), false))
.is_err()
);
} }
#[test] #[test]
@@ -803,18 +810,20 @@ mod tests {
// Rename file // Rename file
let dst_path: PathBuf = let dst_path: PathBuf =
PathBuf::from(format!("{}/bar.txt", tmpdir.path().display()).as_str()); PathBuf::from(format!("{}/bar.txt", tmpdir.path().display()).as_str());
assert!(host assert!(
.rename(files.get(0).unwrap(), dst_path.as_path()) host.rename(files.get(0).unwrap(), dst_path.as_path())
.is_ok()); .is_ok()
);
// There should be still 1 file now, but named bar.txt // There should be still 1 file now, but named bar.txt
let files: Vec<File> = host.files.clone(); let files: Vec<File> = host.files.clone();
assert_eq!(files.len(), 1); // There should be 0 files now assert_eq!(files.len(), 1); // There should be 0 files now
assert_eq!(files.get(0).unwrap().name(), "bar.txt"); assert_eq!(files.get(0).unwrap().name(), "bar.txt");
// Fail // Fail
let bad_path: PathBuf = PathBuf::from("/asdailsjoidoewojdijow/ashdiuahu"); let bad_path: PathBuf = PathBuf::from("/asdailsjoidoewojdijow/ashdiuahu");
assert!(host assert!(
.rename(files.get(0).unwrap(), bad_path.as_path()) host.rename(files.get(0).unwrap(), bad_path.as_path())
.is_err()); .is_err()
);
} }
#[test] #[test]
@@ -853,12 +862,13 @@ mod tests {
// Chmod to dir // Chmod to dir
assert!(host.chmod(tmpdir.path(), UnixPex::from(0o750)).is_ok()); assert!(host.chmod(tmpdir.path(), UnixPex::from(0o750)).is_ok());
// Error // Error
assert!(host assert!(
.chmod( host.chmod(
Path::new("/tmp/krgiogoiegj/kwrgnoerig"), Path::new("/tmp/krgiogoiegj/kwrgnoerig"),
UnixPex::from(0o777) UnixPex::from(0o777)
) )
.is_err()); .is_err()
);
} }
#[cfg(posix)] #[cfg(posix)]
@@ -883,12 +893,13 @@ mod tests {
// Verify host has two files // Verify host has two files
assert_eq!(host.files.len(), 2); assert_eq!(host.files.len(), 2);
// Fail copy // Fail copy
assert!(host assert!(
.copy( host.copy(
&make_fsentry(PathBuf::from("/a/a7/a/a7a"), false), &make_fsentry(PathBuf::from("/a/a7/a/a7a"), false),
PathBuf::from("571k422i").as_path() PathBuf::from("571k422i").as_path()
) )
.is_err()); .is_err()
);
} }
#[cfg(posix)] #[cfg(posix)]
@@ -996,9 +1007,10 @@ mod tests {
assert!(host.symlink(Path::new("link.txt"), p.as_path()).is_ok()); assert!(host.symlink(Path::new("link.txt"), p.as_path()).is_ok());
// Fail symlink // Fail symlink
assert!(host.symlink(Path::new("link.txt"), p.as_path()).is_err()); assert!(host.symlink(Path::new("link.txt"), p.as_path()).is_err());
assert!(host assert!(
.symlink(Path::new("/tmp/oooo/aaaa"), p.as_path()) host.symlink(Path::new("/tmp/oooo/aaaa"), p.as_path())
.is_err()); .is_err()
);
} }
#[test] #[test]
+1 -1
View File
@@ -5,7 +5,7 @@
use self_update::backends::github::Update as GithubUpdater; use self_update::backends::github::Update as GithubUpdater;
pub use self_update::errors::Error as UpdateError; pub use self_update::errors::Error as UpdateError;
use self_update::update::Release as UpdRelease; use self_update::update::Release as UpdRelease;
use self_update::{cargo_crate_version, Status}; use self_update::{Status, cargo_crate_version};
use crate::utils::parser::parse_semver; use crate::utils::parser::parse_semver;
+1 -1
View File
@@ -16,7 +16,7 @@ use super::keys::{KeyStorage, KeyStorageError};
// Local // Local
use crate::config::{ use crate::config::{
bookmarks::{Bookmark, UserHosts}, bookmarks::{Bookmark, UserHosts},
serialization::{deserialize, serialize, SerializerError, SerializerErrorKind}, serialization::{SerializerError, SerializerErrorKind, deserialize, serialize},
}; };
use crate::filetransfer::FileTransferParams; use crate::filetransfer::FileTransferParams;
use crate::utils::crypto; use crate::utils::crypto;
+11 -7
View File
@@ -4,14 +4,14 @@
// Locals // Locals
// Ext // Ext
use std::fs::{create_dir, remove_file, File, OpenOptions}; use std::fs::{File, OpenOptions, create_dir, remove_file};
use std::io::Write; use std::io::Write;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;
use std::string::ToString; use std::string::ToString;
use crate::config::params::{UserConfig, DEFAULT_NOTIFICATION_TRANSFER_THRESHOLD}; use crate::config::params::{DEFAULT_NOTIFICATION_TRANSFER_THRESHOLD, UserConfig};
use crate::config::serialization::{deserialize, serialize, SerializerError, SerializerErrorKind}; use crate::config::serialization::{SerializerError, SerializerErrorKind, deserialize, serialize};
use crate::explorer::GroupDirs; use crate::explorer::GroupDirs;
use crate::filetransfer::FileTransferProtocol; use crate::filetransfer::FileTransferProtocol;
@@ -480,9 +480,11 @@ mod tests {
// Change some stuff // Change some stuff
client.set_text_editor(PathBuf::from("/usr/bin/vim")); client.set_text_editor(PathBuf::from("/usr/bin/vim"));
client.set_default_protocol(FileTransferProtocol::Scp); client.set_default_protocol(FileTransferProtocol::Scp);
assert!(client assert!(
client
.add_ssh_key("192.168.1.31", "pi", "piroporopero") .add_ssh_key("192.168.1.31", "pi", "piroporopero")
.is_ok()); .is_ok()
);
assert!(client.write_config().is_ok()); assert!(client.write_config().is_ok());
// Istantiate a new client // Istantiate a new client
let client: ConfigClient = ConfigClient::new(cfg_path.as_path(), key_path.as_path()) let client: ConfigClient = ConfigClient::new(cfg_path.as_path(), key_path.as_path())
@@ -678,9 +680,11 @@ mod tests {
.unwrap(); .unwrap();
// Add a new key // Add a new key
let rsa_key: String = get_sample_rsa_key(); let rsa_key: String = get_sample_rsa_key();
assert!(client assert!(
client
.add_ssh_key("192.168.1.31", "pi", rsa_key.as_str()) .add_ssh_key("192.168.1.31", "pi", rsa_key.as_str())
.is_ok()); .is_ok()
);
// Iterate keys // Iterate keys
for key in client.iter_ssh_keys() { for key in client.iter_ssh_keys() {
let host: SshHost = client.get_ssh_key(key).ok().unwrap().unwrap(); let host: SshHost = client.get_ssh_key(key).ok().unwrap().unwrap();
+1 -1
View File
@@ -16,7 +16,7 @@ pub fn init(level: LogLevel) -> Result<(), String> {
Ok(None) => { Ok(None) => {
return Err(String::from( return Err(String::from(
"This system doesn't seem to support CACHE_DIR", "This system doesn't seem to support CACHE_DIR",
)) ));
} }
Err(err) => return Err(err), Err(err) => return Err(err),
}; };
+7 -3
View File
@@ -123,9 +123,11 @@ mod tests {
.ok() .ok()
.unwrap(); .unwrap();
// Add ssh key // Add ssh key
assert!(client assert!(
client
.add_ssh_key("192.168.1.31", "pi", "piroporopero") .add_ssh_key("192.168.1.31", "pi", "piroporopero")
.is_ok()); .is_ok()
);
// Create ssh key storage // Create ssh key storage
let storage: SshKeyStorage = SshKeyStorage::from(&client); let storage: SshKeyStorage = SshKeyStorage::from(&client);
// Verify key exists // Verify key exists
@@ -141,7 +143,9 @@ mod tests {
#[test] #[test]
fn sould_resolve_key_from_ssh2_config() { fn sould_resolve_key_from_ssh2_config() {
let rsa_key = test_helpers::create_sample_file_with_content("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDErJhQxEI0+VvhlXVUyh+vMCm7aXfCA/g633AG8ezD/5EylwchtAr2JCoBWnxn4zV8nI9dMqOgm0jO4IsXpKOjQojv+0VOH7I+cDlBg0tk4hFlvyyS6YviDAfDDln3jYUM+5QNDfQLaZlH2WvcJ3mkDxLVlI9MBX1BAeSmChLxwAvxALp2ncImNQLzDO9eHcig3dtMrEKkzXQowRW5Y7eUzg2+vvVq4H2DOjWwUndvB5sJkhEfTUVE7ID8ZdGJo60kUb/02dZYj+IbkAnMCsqktk0cg/4XFX82hEfRYFeb1arkysFisPU1DOb6QielL/axeTebVplaouYcXY0pFdJt root@8c50fd4c345a"); let rsa_key = test_helpers::create_sample_file_with_content(
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDErJhQxEI0+VvhlXVUyh+vMCm7aXfCA/g633AG8ezD/5EylwchtAr2JCoBWnxn4zV8nI9dMqOgm0jO4IsXpKOjQojv+0VOH7I+cDlBg0tk4hFlvyyS6YviDAfDDln3jYUM+5QNDfQLaZlH2WvcJ3mkDxLVlI9MBX1BAeSmChLxwAvxALp2ncImNQLzDO9eHcig3dtMrEKkzXQowRW5Y7eUzg2+vvVq4H2DOjWwUndvB5sJkhEfTUVE7ID8ZdGJo60kUb/02dZYj+IbkAnMCsqktk0cg/4XFX82hEfRYFeb1arkysFisPU1DOb6QielL/axeTebVplaouYcXY0pFdJt root@8c50fd4c345a",
);
let ssh_config_file = test_helpers::create_sample_file_with_content(format!( let ssh_config_file = test_helpers::create_sample_file_with_content(format!(
r#" r#"
Host test Host test
+1 -1
View File
@@ -8,7 +8,7 @@ use std::fs::OpenOptions;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::string::ToString; use std::string::ToString;
use crate::config::serialization::{deserialize, serialize, SerializerError, SerializerErrorKind}; use crate::config::serialization::{SerializerError, SerializerErrorKind, deserialize, serialize};
use crate::config::themes::Theme; use crate::config::themes::Theme;
/// ThemeProvider provides a high level API to communicate with the termscp theme /// ThemeProvider provides a high level API to communicate with the termscp theme
+41 -21
View File
@@ -7,7 +7,7 @@ mod change;
// -- export // -- export
use std::collections::HashMap; use std::collections::HashMap;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::sync::mpsc::{channel, Receiver, RecvTimeoutError}; use std::sync::mpsc::{Receiver, RecvTimeoutError, channel};
use std::time::Duration; use std::time::Duration;
pub use change::FsChange; pub use change::FsChange;
@@ -245,9 +245,11 @@ mod test {
fn should_watch_path() { fn should_watch_path() {
let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap(); let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap();
let tempdir = TempDir::new().unwrap(); let tempdir = TempDir::new().unwrap();
assert!(watcher assert!(
watcher
.watch(tempdir.path(), Path::new("/tmp/test")) .watch(tempdir.path(), Path::new("/tmp/test"))
.is_ok()); .is_ok()
);
// check if in paths // check if in paths
assert_eq!( assert_eq!(
watcher.paths.get(tempdir.path()).unwrap(), watcher.paths.get(tempdir.path()).unwrap(),
@@ -261,16 +263,20 @@ mod test {
fn should_not_watch_path_if_subdir_of_watched_path() { fn should_not_watch_path_if_subdir_of_watched_path() {
let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap(); let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap();
let tempdir = TempDir::new().unwrap(); let tempdir = TempDir::new().unwrap();
assert!(watcher assert!(
watcher
.watch(tempdir.path(), Path::new("/tmp/test")) .watch(tempdir.path(), Path::new("/tmp/test"))
.is_ok()); .is_ok()
);
// watch subdir // watch subdir
let mut subdir = tempdir.path().to_path_buf(); let mut subdir = tempdir.path().to_path_buf();
subdir.push("abc/def"); subdir.push("abc/def");
// should return already watched // should return already watched
assert!(watcher assert!(
watcher
.watch(subdir.as_path(), Path::new("/tmp/test/abc/def")) .watch(subdir.as_path(), Path::new("/tmp/test/abc/def"))
.is_err()); .is_err()
);
// close tempdir // close tempdir
assert!(tempdir.close().is_ok()); assert!(tempdir.close().is_ok());
} }
@@ -279,9 +285,11 @@ mod test {
fn should_unwatch_path() { fn should_unwatch_path() {
let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap(); let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap();
let tempdir = TempDir::new().unwrap(); let tempdir = TempDir::new().unwrap();
assert!(watcher assert!(
watcher
.watch(tempdir.path(), Path::new("/tmp/test")) .watch(tempdir.path(), Path::new("/tmp/test"))
.is_ok()); .is_ok()
);
// unwatch // unwatch
assert!(watcher.unwatch(tempdir.path()).is_ok()); assert!(watcher.unwatch(tempdir.path()).is_ok());
assert!(watcher.paths.get(tempdir.path()).is_none()); assert!(watcher.paths.get(tempdir.path()).is_none());
@@ -293,9 +301,11 @@ mod test {
fn should_unwatch_path_when_subdir() { fn should_unwatch_path_when_subdir() {
let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap(); let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap();
let tempdir = TempDir::new().unwrap(); let tempdir = TempDir::new().unwrap();
assert!(watcher assert!(
watcher
.watch(tempdir.path(), Path::new("/tmp/test")) .watch(tempdir.path(), Path::new("/tmp/test"))
.is_ok()); .is_ok()
);
// unwatch // unwatch
let mut subdir = tempdir.path().to_path_buf(); let mut subdir = tempdir.path().to_path_buf();
subdir.push("abc/def"); subdir.push("abc/def");
@@ -318,9 +328,11 @@ mod test {
fn should_tell_whether_path_is_watched() { fn should_tell_whether_path_is_watched() {
let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap(); let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap();
let tempdir = TempDir::new().unwrap(); let tempdir = TempDir::new().unwrap();
assert!(watcher assert!(
watcher
.watch(tempdir.path(), Path::new("/tmp/test")) .watch(tempdir.path(), Path::new("/tmp/test"))
.is_ok()); .is_ok()
);
assert_eq!(watcher.watched(tempdir.path()), true); assert_eq!(watcher.watched(tempdir.path()), true);
let mut subdir = tempdir.path().to_path_buf(); let mut subdir = tempdir.path().to_path_buf();
subdir.push("abc/def"); subdir.push("abc/def");
@@ -336,9 +348,11 @@ mod test {
let mut watcher = FsWatcher::init(Duration::from_millis(100)).unwrap(); let mut watcher = FsWatcher::init(Duration::from_millis(100)).unwrap();
let tempdir = TempDir::new().unwrap(); let tempdir = TempDir::new().unwrap();
let tempdir_path = PathBuf::from(format!("/private{}", tempdir.path().display())); let tempdir_path = PathBuf::from(format!("/private{}", tempdir.path().display()));
assert!(watcher assert!(
watcher
.watch(tempdir_path.as_path(), Path::new("/tmp/test")) .watch(tempdir_path.as_path(), Path::new("/tmp/test"))
.is_ok()); .is_ok()
);
// create file // create file
let file_path = test_helpers::make_file_at(tempdir_path.as_path(), "test.txt").unwrap(); let file_path = test_helpers::make_file_at(tempdir_path.as_path(), "test.txt").unwrap();
// wait // wait
@@ -362,9 +376,11 @@ mod test {
let mut watcher = FsWatcher::init(Duration::from_millis(100)).unwrap(); let mut watcher = FsWatcher::init(Duration::from_millis(100)).unwrap();
let tempdir = TempDir::new().unwrap(); let tempdir = TempDir::new().unwrap();
let tempdir_path = PathBuf::from(format!("/private{}", tempdir.path().display())); let tempdir_path = PathBuf::from(format!("/private{}", tempdir.path().display()));
assert!(watcher assert!(
watcher
.watch(tempdir_path.as_path(), Path::new("/tmp/test")) .watch(tempdir_path.as_path(), Path::new("/tmp/test"))
.is_ok()); .is_ok()
);
// create file // create file
let file_path = test_helpers::make_file_at(tempdir_path.as_path(), "test.txt").unwrap(); let file_path = test_helpers::make_file_at(tempdir_path.as_path(), "test.txt").unwrap();
std::thread::sleep(Duration::from_millis(500)); std::thread::sleep(Duration::from_millis(500));
@@ -424,9 +440,11 @@ mod test {
fn should_poll_nothing() { fn should_poll_nothing() {
let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap(); let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap();
let tempdir = TempDir::new().unwrap(); let tempdir = TempDir::new().unwrap();
assert!(watcher assert!(
watcher
.watch(tempdir.path(), Path::new("/tmp/test")) .watch(tempdir.path(), Path::new("/tmp/test"))
.is_ok()); .is_ok()
);
assert!(watcher.poll().ok().unwrap().is_none()); assert!(watcher.poll().ok().unwrap().is_none());
// close tempdir // close tempdir
assert!(tempdir.close().is_ok()); assert!(tempdir.close().is_ok());
@@ -437,9 +455,11 @@ mod test {
fn should_get_watched_paths() { fn should_get_watched_paths() {
let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap(); let mut watcher = FsWatcher::init(Duration::from_secs(5)).unwrap();
assert!(watcher.watch(Path::new("/tmp"), Path::new("/tmp")).is_ok()); assert!(watcher.watch(Path::new("/tmp"), Path::new("/tmp")).is_ok());
assert!(watcher assert!(
watcher
.watch(Path::new("/home"), Path::new("/home")) .watch(Path::new("/home"), Path::new("/home"))
.is_ok()); .is_ok()
);
let mut watched_paths = watcher.watched_paths(); let mut watched_paths = watcher.watched_paths();
watched_paths.sort(); watched_paths.sort();
assert_eq!(watched_paths, vec![Path::new("/home"), Path::new("/tmp")]); assert_eq!(watched_paths, vec![Path::new("/home"), Path::new("/tmp")]);
+1 -1
View File
@@ -4,11 +4,11 @@
// Locals // Locals
use super::{AuthActivity, FileTransferParams, FormTab, HostBridgeProtocol}; use super::{AuthActivity, FileTransferParams, FormTab, HostBridgeProtocol};
use crate::filetransfer::HostBridgeParams;
use crate::filetransfer::params::{ use crate::filetransfer::params::{
AwsS3Params, GenericProtocolParams, KubeProtocolParams, ProtocolParams, SmbParams, AwsS3Params, GenericProtocolParams, KubeProtocolParams, ProtocolParams, SmbParams,
WebDAVProtocolParams, WebDAVProtocolParams,
}; };
use crate::filetransfer::HostBridgeParams;
impl AuthActivity { impl AuthActivity {
/// Delete bookmark /// Delete bookmark
+11 -12
View File
@@ -10,14 +10,13 @@ use tuirealm::{Component, Event, MockComponent, NoUserEvent, State, StateValue};
use super::{FileTransferProtocol, FormMsg, Msg, UiMsg}; use super::{FileTransferProtocol, FormMsg, Msg, UiMsg};
use crate::ui::activities::auth::{ use crate::ui::activities::auth::{
FormTab, HostBridgeProtocol, UiAuthFormMsg, HOST_BRIDGE_RADIO_PROTOCOL_FTP, FormTab, HOST_BRIDGE_RADIO_PROTOCOL_FTP, HOST_BRIDGE_RADIO_PROTOCOL_FTPS,
HOST_BRIDGE_RADIO_PROTOCOL_FTPS, HOST_BRIDGE_RADIO_PROTOCOL_KUBE, HOST_BRIDGE_RADIO_PROTOCOL_KUBE, HOST_BRIDGE_RADIO_PROTOCOL_LOCALHOST,
HOST_BRIDGE_RADIO_PROTOCOL_LOCALHOST, HOST_BRIDGE_RADIO_PROTOCOL_S3, HOST_BRIDGE_RADIO_PROTOCOL_S3, HOST_BRIDGE_RADIO_PROTOCOL_SCP, HOST_BRIDGE_RADIO_PROTOCOL_SFTP,
HOST_BRIDGE_RADIO_PROTOCOL_SCP, HOST_BRIDGE_RADIO_PROTOCOL_SFTP, HOST_BRIDGE_RADIO_PROTOCOL_SMB, HOST_BRIDGE_RADIO_PROTOCOL_WEBDAV, HostBridgeProtocol,
HOST_BRIDGE_RADIO_PROTOCOL_SMB, HOST_BRIDGE_RADIO_PROTOCOL_WEBDAV, REMOTE_RADIO_PROTOCOL_FTP, REMOTE_RADIO_PROTOCOL_FTP, REMOTE_RADIO_PROTOCOL_FTPS, REMOTE_RADIO_PROTOCOL_KUBE,
REMOTE_RADIO_PROTOCOL_FTPS, REMOTE_RADIO_PROTOCOL_KUBE, REMOTE_RADIO_PROTOCOL_S3, REMOTE_RADIO_PROTOCOL_S3, REMOTE_RADIO_PROTOCOL_SCP, REMOTE_RADIO_PROTOCOL_SFTP,
REMOTE_RADIO_PROTOCOL_SCP, REMOTE_RADIO_PROTOCOL_SFTP, REMOTE_RADIO_PROTOCOL_SMB, REMOTE_RADIO_PROTOCOL_SMB, REMOTE_RADIO_PROTOCOL_WEBDAV, UiAuthFormMsg,
REMOTE_RADIO_PROTOCOL_WEBDAV,
}; };
// -- protocol // -- protocol
@@ -93,10 +92,10 @@ impl Component<Msg, NoUserEvent> for RemoteProtocolRadio {
code: Key::Down, .. code: Key::Down, ..
}) => return Some(Msg::Ui(UiMsg::Remote(UiAuthFormMsg::ProtocolBlurDown))), }) => return Some(Msg::Ui(UiMsg::Remote(UiAuthFormMsg::ProtocolBlurDown))),
Event::Keyboard(KeyEvent { code: Key::Up, .. }) => { Event::Keyboard(KeyEvent { code: Key::Up, .. }) => {
return Some(Msg::Ui(UiMsg::Remote(UiAuthFormMsg::ProtocolBlurUp))) return Some(Msg::Ui(UiMsg::Remote(UiAuthFormMsg::ProtocolBlurUp)));
} }
Event::Keyboard(KeyEvent { code: Key::Tab, .. }) => { Event::Keyboard(KeyEvent { code: Key::Tab, .. }) => {
return Some(Msg::Ui(UiMsg::Remote(UiAuthFormMsg::ParamsFormBlur))) return Some(Msg::Ui(UiMsg::Remote(UiAuthFormMsg::ParamsFormBlur)));
} }
Event::Keyboard(KeyEvent { Event::Keyboard(KeyEvent {
code: Key::BackTab, .. code: Key::BackTab, ..
@@ -228,10 +227,10 @@ impl Component<Msg, NoUserEvent> for HostBridgeProtocolRadio {
code: Key::Down, .. code: Key::Down, ..
}) => return Some(Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::ProtocolBlurDown))), }) => return Some(Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::ProtocolBlurDown))),
Event::Keyboard(KeyEvent { code: Key::Up, .. }) => { Event::Keyboard(KeyEvent { code: Key::Up, .. }) => {
return Some(Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::ProtocolBlurUp))) return Some(Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::ProtocolBlurUp)));
} }
Event::Keyboard(KeyEvent { code: Key::Tab, .. }) => { Event::Keyboard(KeyEvent { code: Key::Tab, .. }) => {
return Some(Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::ParamsFormBlur))) return Some(Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::ParamsFormBlur)));
} }
Event::Keyboard(KeyEvent { Event::Keyboard(KeyEvent {
code: Key::BackTab, .. code: Key::BackTab, ..
+1 -1
View File
@@ -5,8 +5,8 @@
use std::env; use std::env;
use super::{AuthActivity, FileTransferParams, FileTransferProtocol, FormTab, HostBridgeProtocol}; use super::{AuthActivity, FileTransferParams, FileTransferProtocol, FormTab, HostBridgeProtocol};
use crate::filetransfer::params::ProtocolParams;
use crate::filetransfer::HostBridgeParams; use crate::filetransfer::HostBridgeParams;
use crate::filetransfer::params::ProtocolParams;
use crate::system::auto_update::{Release, Update, UpdateStatus}; use crate::system::auto_update::{Release, Update, UpdateStatus};
use crate::system::notifications::Notification; use crate::system::notifications::Notification;
+1 -1
View File
@@ -17,7 +17,7 @@ use tuirealm::application::PollStrategy;
use tuirealm::listener::EventListenerCfg; use tuirealm::listener::EventListenerCfg;
use tuirealm::{Application, NoUserEvent, Update}; use tuirealm::{Application, NoUserEvent, Update};
use super::{Activity, Context, ExitReason, CROSSTERM_MAX_POLL}; use super::{Activity, CROSSTERM_MAX_POLL, Context, ExitReason};
use crate::config::themes::Theme; use crate::config::themes::Theme;
use crate::filetransfer::{FileTransferParams, FileTransferProtocol}; use crate::filetransfer::{FileTransferParams, FileTransferProtocol};
use crate::system::bookmarks_client::BookmarksClient; use crate::system::bookmarks_client::BookmarksClient;
+320 -236
View File
@@ -181,10 +181,11 @@ impl AuthActivity {
assert!(self.app.active(id).is_ok()); assert!(self.app.active(id).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::AddressBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::AddressBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Protocol)) .active(&Id::HostBridge(AuthFormId::Protocol))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::AddressBlurUp) => { UiMsg::Remote(UiAuthFormMsg::AddressBlurUp) => {
assert!(self.app.active(&Id::Remote(AuthFormId::Protocol)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::Protocol)).is_ok());
@@ -196,10 +197,11 @@ impl AuthActivity {
assert!(self.app.active(&Id::BookmarkSavePassword).is_ok()); assert!(self.app.active(&Id::BookmarkSavePassword).is_ok());
} }
UiMsg::BookmarksTabBlur => { UiMsg::BookmarksTabBlur => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Protocol)) .active(&Id::HostBridge(AuthFormId::Protocol))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::ChangeFormTab) => { UiMsg::HostBridge(UiAuthFormMsg::ChangeFormTab) => {
self.last_form_tab = FormTab::Remote; self.last_form_tab = FormTab::Remote;
@@ -207,10 +209,11 @@ impl AuthActivity {
} }
UiMsg::Remote(UiAuthFormMsg::ChangeFormTab) => { UiMsg::Remote(UiAuthFormMsg::ChangeFormTab) => {
self.last_form_tab = FormTab::HostBridge; self.last_form_tab = FormTab::HostBridge;
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Protocol)) .active(&Id::HostBridge(AuthFormId::Protocol))
.is_ok()); .is_ok()
);
} }
UiMsg::CloseDeleteBookmark => { UiMsg::CloseDeleteBookmark => {
assert!(self.app.umount(&Id::DeleteBookmarkPopup).is_ok()); assert!(self.app.umount(&Id::DeleteBookmarkPopup).is_ok());
@@ -237,25 +240,28 @@ impl AuthActivity {
assert!(self.app.umount(&Id::BookmarkSavePassword).is_ok()); assert!(self.app.umount(&Id::BookmarkSavePassword).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::LocalDirectoryBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::LocalDirectoryBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Protocol)) .active(&Id::HostBridge(AuthFormId::Protocol))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::LocalDirectoryBlurDown) => { UiMsg::Remote(UiAuthFormMsg::LocalDirectoryBlurDown) => {
assert!(self.app.active(&Id::Remote(AuthFormId::Protocol)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::Protocol)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::LocalDirectoryBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::LocalDirectoryBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::RemoteDirectory)) .active(&Id::HostBridge(AuthFormId::RemoteDirectory))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::LocalDirectoryBlurUp) => { UiMsg::Remote(UiAuthFormMsg::LocalDirectoryBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::RemoteDirectory)) .active(&Id::Remote(AuthFormId::RemoteDirectory))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::ParamsFormBlur) => { UiMsg::HostBridge(UiAuthFormMsg::ParamsFormBlur) => {
assert!(self.app.active(&Id::BookmarksList).is_ok()); assert!(self.app.active(&Id::BookmarksList).is_ok());
@@ -264,8 +270,8 @@ impl AuthActivity {
assert!(self.app.active(&Id::BookmarksList).is_ok()); assert!(self.app.active(&Id::BookmarksList).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::PasswordBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::PasswordBlurDown) => {
assert!(self assert!(
.app self.app
.active(match self.host_bridge_input_mask() { .active(match self.host_bridge_input_mask() {
InputMask::Localhost => unreachable!(), InputMask::Localhost => unreachable!(),
InputMask::Generic => &Id::HostBridge(AuthFormId::RemoteDirectory), InputMask::Generic => &Id::HostBridge(AuthFormId::RemoteDirectory),
@@ -273,15 +279,18 @@ impl AuthActivity {
InputMask::Smb => &Id::HostBridge(AuthFormId::SmbWorkgroup), InputMask::Smb => &Id::HostBridge(AuthFormId::SmbWorkgroup),
#[cfg(win)] #[cfg(win)]
InputMask::Smb => &Id::HostBridge(AuthFormId::RemoteDirectory), InputMask::Smb => &Id::HostBridge(AuthFormId::RemoteDirectory),
InputMask::AwsS3 => unreachable!("this shouldn't happen (password on s3)"), InputMask::AwsS3 =>
InputMask::Kube => unreachable!("this shouldn't happen (password on kube)"), unreachable!("this shouldn't happen (password on s3)"),
InputMask::Kube =>
unreachable!("this shouldn't happen (password on kube)"),
InputMask::WebDAV => &Id::HostBridge(AuthFormId::RemoteDirectory), InputMask::WebDAV => &Id::HostBridge(AuthFormId::RemoteDirectory),
}) })
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::PasswordBlurDown) => { UiMsg::Remote(UiAuthFormMsg::PasswordBlurDown) => {
assert!(self assert!(
.app self.app
.active(match self.remote_input_mask() { .active(match self.remote_input_mask() {
InputMask::Localhost => unreachable!(), InputMask::Localhost => unreachable!(),
InputMask::Generic => &Id::Remote(AuthFormId::RemoteDirectory), InputMask::Generic => &Id::Remote(AuthFormId::RemoteDirectory),
@@ -289,24 +298,28 @@ impl AuthActivity {
InputMask::Smb => &Id::Remote(AuthFormId::SmbWorkgroup), InputMask::Smb => &Id::Remote(AuthFormId::SmbWorkgroup),
#[cfg(win)] #[cfg(win)]
InputMask::Smb => &Id::Remote(AuthFormId::RemoteDirectory), InputMask::Smb => &Id::Remote(AuthFormId::RemoteDirectory),
InputMask::AwsS3 => unreachable!("this shouldn't happen (password on s3)"), InputMask::AwsS3 =>
InputMask::Kube => unreachable!("this shouldn't happen (password on kube)"), unreachable!("this shouldn't happen (password on s3)"),
InputMask::Kube =>
unreachable!("this shouldn't happen (password on kube)"),
InputMask::WebDAV => &Id::Remote(AuthFormId::RemoteDirectory), InputMask::WebDAV => &Id::Remote(AuthFormId::RemoteDirectory),
}) })
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::PasswordBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::PasswordBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Username)) .active(&Id::HostBridge(AuthFormId::Username))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::PasswordBlurUp) => { UiMsg::Remote(UiAuthFormMsg::PasswordBlurUp) => {
assert!(self.app.active(&Id::Remote(AuthFormId::Username)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::Username)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::PortBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::PortBlurDown) => {
assert!(self assert!(
.app self.app
.active(match self.host_bridge_input_mask() { .active(match self.host_bridge_input_mask() {
InputMask::Generic => &Id::HostBridge(AuthFormId::Username), InputMask::Generic => &Id::HostBridge(AuthFormId::Username),
InputMask::Smb => &Id::HostBridge(AuthFormId::SmbShare), InputMask::Smb => &Id::HostBridge(AuthFormId::SmbShare),
@@ -316,11 +329,12 @@ impl AuthActivity {
| InputMask::WebDAV => | InputMask::WebDAV =>
unreachable!("this shouldn't happen (port on s3/kube/webdav)"), unreachable!("this shouldn't happen (port on s3/kube/webdav)"),
}) })
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::PortBlurDown) => { UiMsg::Remote(UiAuthFormMsg::PortBlurDown) => {
assert!(self assert!(
.app self.app
.active(match self.remote_input_mask() { .active(match self.remote_input_mask() {
InputMask::Generic => &Id::Remote(AuthFormId::Username), InputMask::Generic => &Id::Remote(AuthFormId::Username),
InputMask::Smb => &Id::Remote(AuthFormId::SmbShare), InputMask::Smb => &Id::Remote(AuthFormId::SmbShare),
@@ -330,20 +344,22 @@ impl AuthActivity {
| InputMask::WebDAV => | InputMask::WebDAV =>
unreachable!("this shouldn't happen (port on s3/kube/webdav)"), unreachable!("this shouldn't happen (port on s3/kube/webdav)"),
}) })
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::PortBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::PortBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Address)) .active(&Id::HostBridge(AuthFormId::Address))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::PortBlurUp) => { UiMsg::Remote(UiAuthFormMsg::PortBlurUp) => {
assert!(self.app.active(&Id::Remote(AuthFormId::Address)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::Address)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::ProtocolBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::ProtocolBlurDown) => {
assert!(self assert!(
.app self.app
.active(match self.host_bridge_input_mask() { .active(match self.host_bridge_input_mask() {
InputMask::Localhost => &Id::HostBridge(AuthFormId::LocalDirectory), InputMask::Localhost => &Id::HostBridge(AuthFormId::LocalDirectory),
InputMask::Generic => &Id::HostBridge(AuthFormId::Address), InputMask::Generic => &Id::HostBridge(AuthFormId::Address),
@@ -352,11 +368,12 @@ impl AuthActivity {
InputMask::Kube => &Id::HostBridge(AuthFormId::KubeNamespace), InputMask::Kube => &Id::HostBridge(AuthFormId::KubeNamespace),
InputMask::WebDAV => &Id::HostBridge(AuthFormId::WebDAVUri), InputMask::WebDAV => &Id::HostBridge(AuthFormId::WebDAVUri),
}) })
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::ProtocolBlurDown) => { UiMsg::Remote(UiAuthFormMsg::ProtocolBlurDown) => {
assert!(self assert!(
.app self.app
.active(match self.remote_input_mask() { .active(match self.remote_input_mask() {
InputMask::Localhost => &Id::Remote(AuthFormId::LocalDirectory), InputMask::Localhost => &Id::Remote(AuthFormId::LocalDirectory),
InputMask::Generic => &Id::Remote(AuthFormId::Address), InputMask::Generic => &Id::Remote(AuthFormId::Address),
@@ -365,38 +382,43 @@ impl AuthActivity {
InputMask::Kube => &Id::Remote(AuthFormId::KubeNamespace), InputMask::Kube => &Id::Remote(AuthFormId::KubeNamespace),
InputMask::WebDAV => &Id::Remote(AuthFormId::WebDAVUri), InputMask::WebDAV => &Id::Remote(AuthFormId::WebDAVUri),
}) })
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::ProtocolBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::ProtocolBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::LocalDirectory)) .active(&Id::HostBridge(AuthFormId::LocalDirectory))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::ProtocolBlurUp) => { UiMsg::Remote(UiAuthFormMsg::ProtocolBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::LocalDirectory)) .active(&Id::Remote(AuthFormId::LocalDirectory))
.is_ok()); .is_ok()
);
} }
UiMsg::RececentsListBlur => { UiMsg::RececentsListBlur => {
assert!(self.app.active(&Id::BookmarksList).is_ok()); assert!(self.app.active(&Id::BookmarksList).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::RemoteDirectoryBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::RemoteDirectoryBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::LocalDirectory)) .active(&Id::HostBridge(AuthFormId::LocalDirectory))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::RemoteDirectoryBlurDown) => { UiMsg::Remote(UiAuthFormMsg::RemoteDirectoryBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::LocalDirectory)) .active(&Id::Remote(AuthFormId::LocalDirectory))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::RemoteDirectoryBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::RemoteDirectoryBlurUp) => {
assert!(self assert!(
.app self.app
.active(match self.host_bridge_input_mask() { .active(match self.host_bridge_input_mask() {
InputMask::Localhost => unreachable!(), InputMask::Localhost => unreachable!(),
InputMask::Generic => &Id::HostBridge(AuthFormId::Password), InputMask::Generic => &Id::HostBridge(AuthFormId::Password),
@@ -408,11 +430,12 @@ impl AuthActivity {
InputMask::AwsS3 => &Id::HostBridge(AuthFormId::S3NewPathStyle), InputMask::AwsS3 => &Id::HostBridge(AuthFormId::S3NewPathStyle),
InputMask::WebDAV => &Id::HostBridge(AuthFormId::Password), InputMask::WebDAV => &Id::HostBridge(AuthFormId::Password),
}) })
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::RemoteDirectoryBlurUp) => { UiMsg::Remote(UiAuthFormMsg::RemoteDirectoryBlurUp) => {
assert!(self assert!(
.app self.app
.active(match self.remote_input_mask() { .active(match self.remote_input_mask() {
InputMask::Localhost => unreachable!(), InputMask::Localhost => unreachable!(),
InputMask::Generic => &Id::Remote(AuthFormId::Password), InputMask::Generic => &Id::Remote(AuthFormId::Password),
@@ -424,322 +447,371 @@ impl AuthActivity {
InputMask::AwsS3 => &Id::Remote(AuthFormId::S3NewPathStyle), InputMask::AwsS3 => &Id::Remote(AuthFormId::S3NewPathStyle),
InputMask::WebDAV => &Id::Remote(AuthFormId::Password), InputMask::WebDAV => &Id::Remote(AuthFormId::Password),
}) })
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::S3BucketBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::S3BucketBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3Region)) .active(&Id::HostBridge(AuthFormId::S3Region))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3BucketBlurDown) => { UiMsg::Remote(UiAuthFormMsg::S3BucketBlurDown) => {
assert!(self.app.active(&Id::Remote(AuthFormId::S3Region)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::S3Region)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::S3BucketBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::S3BucketBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Protocol)) .active(&Id::HostBridge(AuthFormId::Protocol))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3BucketBlurUp) => { UiMsg::Remote(UiAuthFormMsg::S3BucketBlurUp) => {
assert!(self.app.active(&Id::Remote(AuthFormId::Protocol)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::Protocol)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::S3RegionBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::S3RegionBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3Endpoint)) .active(&Id::HostBridge(AuthFormId::S3Endpoint))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3RegionBlurDown) => { UiMsg::Remote(UiAuthFormMsg::S3RegionBlurDown) => {
assert!(self.app.active(&Id::Remote(AuthFormId::S3Endpoint)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::S3Endpoint)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::S3RegionBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::S3RegionBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3Bucket)) .active(&Id::HostBridge(AuthFormId::S3Bucket))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3RegionBlurUp) => { UiMsg::Remote(UiAuthFormMsg::S3RegionBlurUp) => {
assert!(self.app.active(&Id::Remote(AuthFormId::S3Bucket)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::S3Bucket)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::S3EndpointBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::S3EndpointBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3Profile)) .active(&Id::HostBridge(AuthFormId::S3Profile))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3EndpointBlurDown) => { UiMsg::Remote(UiAuthFormMsg::S3EndpointBlurDown) => {
assert!(self.app.active(&Id::Remote(AuthFormId::S3Profile)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::S3Profile)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::S3EndpointBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::S3EndpointBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3Region)) .active(&Id::HostBridge(AuthFormId::S3Region))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3EndpointBlurUp) => { UiMsg::Remote(UiAuthFormMsg::S3EndpointBlurUp) => {
assert!(self.app.active(&Id::Remote(AuthFormId::S3Region)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::S3Region)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::S3ProfileBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::S3ProfileBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3AccessKey)) .active(&Id::HostBridge(AuthFormId::S3AccessKey))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3ProfileBlurDown) => { UiMsg::Remote(UiAuthFormMsg::S3ProfileBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::S3AccessKey)) .active(&Id::Remote(AuthFormId::S3AccessKey))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::S3ProfileBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::S3ProfileBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3Endpoint)) .active(&Id::HostBridge(AuthFormId::S3Endpoint))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3ProfileBlurUp) => { UiMsg::Remote(UiAuthFormMsg::S3ProfileBlurUp) => {
assert!(self.app.active(&Id::Remote(AuthFormId::S3Endpoint)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::S3Endpoint)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::S3AccessKeyBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::S3AccessKeyBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3SecretAccessKey)) .active(&Id::HostBridge(AuthFormId::S3SecretAccessKey))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3AccessKeyBlurDown) => { UiMsg::Remote(UiAuthFormMsg::S3AccessKeyBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::S3SecretAccessKey)) .active(&Id::Remote(AuthFormId::S3SecretAccessKey))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::S3AccessKeyBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::S3AccessKeyBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3Profile)) .active(&Id::HostBridge(AuthFormId::S3Profile))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3AccessKeyBlurUp) => { UiMsg::Remote(UiAuthFormMsg::S3AccessKeyBlurUp) => {
assert!(self.app.active(&Id::Remote(AuthFormId::S3Profile)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::S3Profile)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::S3SecretAccessKeyBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::S3SecretAccessKeyBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3SecurityToken)) .active(&Id::HostBridge(AuthFormId::S3SecurityToken))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3SecretAccessKeyBlurDown) => { UiMsg::Remote(UiAuthFormMsg::S3SecretAccessKeyBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::S3SecurityToken)) .active(&Id::Remote(AuthFormId::S3SecurityToken))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::S3SecretAccessKeyBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::S3SecretAccessKeyBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3AccessKey)) .active(&Id::HostBridge(AuthFormId::S3AccessKey))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3SecretAccessKeyBlurUp) => { UiMsg::Remote(UiAuthFormMsg::S3SecretAccessKeyBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::S3AccessKey)) .active(&Id::Remote(AuthFormId::S3AccessKey))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::S3SecurityTokenBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::S3SecurityTokenBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3SessionToken)) .active(&Id::HostBridge(AuthFormId::S3SessionToken))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3SecurityTokenBlurDown) => { UiMsg::Remote(UiAuthFormMsg::S3SecurityTokenBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::S3SessionToken)) .active(&Id::Remote(AuthFormId::S3SessionToken))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::S3SecurityTokenBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::S3SecurityTokenBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3SecretAccessKey)) .active(&Id::HostBridge(AuthFormId::S3SecretAccessKey))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3SecurityTokenBlurUp) => { UiMsg::Remote(UiAuthFormMsg::S3SecurityTokenBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::S3SecretAccessKey)) .active(&Id::Remote(AuthFormId::S3SecretAccessKey))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::S3SessionTokenBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::S3SessionTokenBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3NewPathStyle)) .active(&Id::HostBridge(AuthFormId::S3NewPathStyle))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3SessionTokenBlurDown) => { UiMsg::Remote(UiAuthFormMsg::S3SessionTokenBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::S3NewPathStyle)) .active(&Id::Remote(AuthFormId::S3NewPathStyle))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::S3SessionTokenBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::S3SessionTokenBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3SecurityToken)) .active(&Id::HostBridge(AuthFormId::S3SecurityToken))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3SessionTokenBlurUp) => { UiMsg::Remote(UiAuthFormMsg::S3SessionTokenBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::S3SecurityToken)) .active(&Id::Remote(AuthFormId::S3SecurityToken))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::S3NewPathStyleBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::S3NewPathStyleBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::RemoteDirectory)) .active(&Id::HostBridge(AuthFormId::RemoteDirectory))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3NewPathStyleBlurDown) => { UiMsg::Remote(UiAuthFormMsg::S3NewPathStyleBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::RemoteDirectory)) .active(&Id::Remote(AuthFormId::RemoteDirectory))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::S3NewPathStyleBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::S3NewPathStyleBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::S3SessionToken)) .active(&Id::HostBridge(AuthFormId::S3SessionToken))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::S3NewPathStyleBlurUp) => { UiMsg::Remote(UiAuthFormMsg::S3NewPathStyleBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::S3SessionToken)) .active(&Id::Remote(AuthFormId::S3SessionToken))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::KubeClientCertBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::KubeClientCertBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::KubeClientKey)) .active(&Id::HostBridge(AuthFormId::KubeClientKey))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::KubeClientCertBlurDown) => { UiMsg::Remote(UiAuthFormMsg::KubeClientCertBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::KubeClientKey)) .active(&Id::Remote(AuthFormId::KubeClientKey))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::KubeClientCertBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::KubeClientCertBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::KubeUsername)) .active(&Id::HostBridge(AuthFormId::KubeUsername))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::KubeClientCertBlurUp) => { UiMsg::Remote(UiAuthFormMsg::KubeClientCertBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::KubeUsername)) .active(&Id::Remote(AuthFormId::KubeUsername))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::KubeClientKeyBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::KubeClientKeyBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::RemoteDirectory)) .active(&Id::HostBridge(AuthFormId::RemoteDirectory))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::KubeClientKeyBlurDown) => { UiMsg::Remote(UiAuthFormMsg::KubeClientKeyBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::RemoteDirectory)) .active(&Id::Remote(AuthFormId::RemoteDirectory))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::KubeClientKeyBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::KubeClientKeyBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::KubeClientCert)) .active(&Id::HostBridge(AuthFormId::KubeClientCert))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::KubeClientKeyBlurUp) => { UiMsg::Remote(UiAuthFormMsg::KubeClientKeyBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::KubeClientCert)) .active(&Id::Remote(AuthFormId::KubeClientCert))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::KubeNamespaceBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::KubeNamespaceBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::KubeClusterUrl)) .active(&Id::HostBridge(AuthFormId::KubeClusterUrl))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::KubeNamespaceBlurDown) => { UiMsg::Remote(UiAuthFormMsg::KubeNamespaceBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::KubeClusterUrl)) .active(&Id::Remote(AuthFormId::KubeClusterUrl))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::KubeNamespaceBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::KubeNamespaceBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Protocol)) .active(&Id::HostBridge(AuthFormId::Protocol))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::KubeNamespaceBlurUp) => { UiMsg::Remote(UiAuthFormMsg::KubeNamespaceBlurUp) => {
assert!(self.app.active(&Id::Remote(AuthFormId::Protocol)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::Protocol)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::KubeClusterUrlBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::KubeClusterUrlBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::KubeUsername)) .active(&Id::HostBridge(AuthFormId::KubeUsername))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::KubeClusterUrlBlurDown) => { UiMsg::Remote(UiAuthFormMsg::KubeClusterUrlBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::KubeUsername)) .active(&Id::Remote(AuthFormId::KubeUsername))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::KubeClusterUrlBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::KubeClusterUrlBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::KubeNamespace)) .active(&Id::HostBridge(AuthFormId::KubeNamespace))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::KubeClusterUrlBlurUp) => { UiMsg::Remote(UiAuthFormMsg::KubeClusterUrlBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::KubeNamespace)) .active(&Id::Remote(AuthFormId::KubeNamespace))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::KubeUsernameBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::KubeUsernameBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::KubeClientCert)) .active(&Id::HostBridge(AuthFormId::KubeClientCert))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::KubeUsernameBlurDown) => { UiMsg::Remote(UiAuthFormMsg::KubeUsernameBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::KubeClientCert)) .active(&Id::Remote(AuthFormId::KubeClientCert))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::KubeUsernameBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::KubeUsernameBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::KubeClusterUrl)) .active(&Id::HostBridge(AuthFormId::KubeClusterUrl))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::KubeUsernameBlurUp) => { UiMsg::Remote(UiAuthFormMsg::KubeUsernameBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::KubeClusterUrl)) .active(&Id::Remote(AuthFormId::KubeClusterUrl))
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::SmbShareBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::SmbShareBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Username)) .active(&Id::HostBridge(AuthFormId::Username))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::SmbShareBlurDown) => { UiMsg::Remote(UiAuthFormMsg::SmbShareBlurDown) => {
assert!(self.app.active(&Id::Remote(AuthFormId::Username)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::Username)).is_ok());
@@ -762,24 +834,27 @@ impl AuthActivity {
} }
#[cfg(posix)] #[cfg(posix)]
UiMsg::HostBridge(UiAuthFormMsg::SmbWorkgroupDown) => { UiMsg::HostBridge(UiAuthFormMsg::SmbWorkgroupDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::RemoteDirectory)) .active(&Id::HostBridge(AuthFormId::RemoteDirectory))
.is_ok()); .is_ok()
);
} }
#[cfg(posix)] #[cfg(posix)]
UiMsg::Remote(UiAuthFormMsg::SmbWorkgroupDown) => { UiMsg::Remote(UiAuthFormMsg::SmbWorkgroupDown) => {
assert!(self assert!(
.app self.app
.active(&Id::Remote(AuthFormId::RemoteDirectory)) .active(&Id::Remote(AuthFormId::RemoteDirectory))
.is_ok()); .is_ok()
);
} }
#[cfg(posix)] #[cfg(posix)]
UiMsg::HostBridge(UiAuthFormMsg::SmbWorkgroupUp) => { UiMsg::HostBridge(UiAuthFormMsg::SmbWorkgroupUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Password)) .active(&Id::HostBridge(AuthFormId::Password))
.is_ok()); .is_ok()
);
} }
#[cfg(posix)] #[cfg(posix)]
UiMsg::Remote(UiAuthFormMsg::SmbWorkgroupUp) => { UiMsg::Remote(UiAuthFormMsg::SmbWorkgroupUp) => {
@@ -807,54 +882,63 @@ impl AuthActivity {
self.mount_bookmark_save_dialog(self.get_current_form_tab()); self.mount_bookmark_save_dialog(self.get_current_form_tab());
} }
UiMsg::HostBridge(UiAuthFormMsg::UsernameBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::UsernameBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Password)) .active(&Id::HostBridge(AuthFormId::Password))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::UsernameBlurDown) => { UiMsg::Remote(UiAuthFormMsg::UsernameBlurDown) => {
assert!(self.app.active(&Id::Remote(AuthFormId::Password)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::Password)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::UsernameBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::UsernameBlurUp) => {
assert!(self assert!(
.app self.app
.active(match self.host_bridge_input_mask() { .active(match self.host_bridge_input_mask() {
InputMask::Localhost => unreachable!(), InputMask::Localhost => unreachable!(),
InputMask::Generic => &Id::HostBridge(AuthFormId::Port), InputMask::Generic => &Id::HostBridge(AuthFormId::Port),
InputMask::Smb => &Id::HostBridge(AuthFormId::SmbShare), InputMask::Smb => &Id::HostBridge(AuthFormId::SmbShare),
InputMask::Kube => unreachable!("this shouldn't happen (username on kube)"), InputMask::Kube =>
InputMask::AwsS3 => unreachable!("this shouldn't happen (username on s3)"), unreachable!("this shouldn't happen (username on kube)"),
InputMask::AwsS3 =>
unreachable!("this shouldn't happen (username on s3)"),
InputMask::WebDAV => &Id::HostBridge(AuthFormId::WebDAVUri), InputMask::WebDAV => &Id::HostBridge(AuthFormId::WebDAVUri),
}) })
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::UsernameBlurUp) => { UiMsg::Remote(UiAuthFormMsg::UsernameBlurUp) => {
assert!(self assert!(
.app self.app
.active(match self.remote_input_mask() { .active(match self.remote_input_mask() {
InputMask::Localhost => unreachable!(), InputMask::Localhost => unreachable!(),
InputMask::Generic => &Id::Remote(AuthFormId::Port), InputMask::Generic => &Id::Remote(AuthFormId::Port),
InputMask::Smb => &Id::Remote(AuthFormId::SmbShare), InputMask::Smb => &Id::Remote(AuthFormId::SmbShare),
InputMask::Kube => unreachable!("this shouldn't happen (username on kube)"), InputMask::Kube =>
InputMask::AwsS3 => unreachable!("this shouldn't happen (username on s3)"), unreachable!("this shouldn't happen (username on kube)"),
InputMask::AwsS3 =>
unreachable!("this shouldn't happen (username on s3)"),
InputMask::WebDAV => &Id::Remote(AuthFormId::WebDAVUri), InputMask::WebDAV => &Id::Remote(AuthFormId::WebDAVUri),
}) })
.is_ok()); .is_ok()
);
} }
UiMsg::HostBridge(UiAuthFormMsg::WebDAVUriBlurDown) => { UiMsg::HostBridge(UiAuthFormMsg::WebDAVUriBlurDown) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Username)) .active(&Id::HostBridge(AuthFormId::Username))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::WebDAVUriBlurDown) => { UiMsg::Remote(UiAuthFormMsg::WebDAVUriBlurDown) => {
assert!(self.app.active(&Id::Remote(AuthFormId::Username)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::Username)).is_ok());
} }
UiMsg::HostBridge(UiAuthFormMsg::WebDAVUriBlurUp) => { UiMsg::HostBridge(UiAuthFormMsg::WebDAVUriBlurUp) => {
assert!(self assert!(
.app self.app
.active(&Id::HostBridge(AuthFormId::Protocol)) .active(&Id::HostBridge(AuthFormId::Protocol))
.is_ok()); .is_ok()
);
} }
UiMsg::Remote(UiAuthFormMsg::WebDAVUriBlurUp) => { UiMsg::Remote(UiAuthFormMsg::WebDAVUriBlurUp) => {
assert!(self.app.active(&Id::Remote(AuthFormId::Protocol)).is_ok()); assert!(self.app.active(&Id::Remote(AuthFormId::Protocol)).is_ok());
+179 -135
View File
@@ -12,14 +12,14 @@ use tuirealm::ratatui::widgets::Clear;
use tuirealm::{State, StateValue, Sub, SubClause, SubEventClause}; use tuirealm::{State, StateValue, Sub, SubClause, SubEventClause};
use super::{ use super::{
components, AuthActivity, AuthFormId, Context, FileTransferProtocol, FormTab, AuthActivity, AuthFormId, Context, FileTransferProtocol, FormTab, HostBridgeProtocol, Id,
HostBridgeProtocol, Id, InputMask, InputMask, components,
}; };
use crate::filetransfer::FileTransferParams;
use crate::filetransfer::params::{ use crate::filetransfer::params::{
AwsS3Params, GenericProtocolParams, KubeProtocolParams, ProtocolParams, SmbParams, AwsS3Params, GenericProtocolParams, KubeProtocolParams, ProtocolParams, SmbParams,
WebDAVProtocolParams, WebDAVProtocolParams,
}; };
use crate::filetransfer::FileTransferParams;
use crate::utils::ui::{Popup, Size}; use crate::utils::ui::{Popup, Size};
impl AuthActivity { impl AuthActivity {
@@ -28,23 +28,26 @@ impl AuthActivity {
let key_color = self.theme().misc_keys; let key_color = self.theme().misc_keys;
let info_color = self.theme().misc_info_dialog; let info_color = self.theme().misc_info_dialog;
// Headers // Headers
assert!(self assert!(
.app self.app
.mount(Id::Title, Box::<components::Title>::default(), vec![]) .mount(Id::Title, Box::<components::Title>::default(), vec![])
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.mount(Id::Subtitle, Box::<components::Subtitle>::default(), vec![]) .mount(Id::Subtitle, Box::<components::Subtitle>::default(), vec![])
.is_ok()); .is_ok()
);
// Footer // Footer
assert!(self assert!(
.app self.app
.mount( .mount(
Id::HelpFooter, Id::HelpFooter,
Box::new(components::HelpFooter::new(key_color)), Box::new(components::HelpFooter::new(key_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Host bridge auth form // Host bridge auth form
self.mount_host_bridge_protocol(HostBridgeProtocol::Localhost); self.mount_host_bridge_protocol(HostBridgeProtocol::Localhost);
@@ -113,8 +116,8 @@ impl AuthActivity {
.get_string(super::STORE_KEY_LATEST_VERSION) .get_string(super::STORE_KEY_LATEST_VERSION)
{ {
let version: String = version.to_string(); let version: String = version.to_string();
assert!(self assert!(
.app self.app
.mount( .mount(
Id::NewVersionDisclaimer, Id::NewVersionDisclaimer,
Box::new(components::NewVersionDisclaimer::new( Box::new(components::NewVersionDisclaimer::new(
@@ -123,7 +126,8 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
// Load bookmarks // Load bookmarks
self.view_bookmarks(); self.view_bookmarks();
@@ -455,14 +459,15 @@ impl AuthActivity {
}) })
.collect(); .collect();
let bookmarks_color = self.theme().auth_bookmarks; let bookmarks_color = self.theme().auth_bookmarks;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::BookmarksList, Id::BookmarksList,
Box::new(components::BookmarksList::new(&bookmarks, bookmarks_color)), Box::new(components::BookmarksList::new(&bookmarks, bookmarks_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
/// View recent connections /// View recent connections
@@ -473,14 +478,15 @@ impl AuthActivity {
.map(|x| Self::fmt_recent(self.bookmarks_client().unwrap().get_recent(x).unwrap())) .map(|x| Self::fmt_recent(self.bookmarks_client().unwrap().get_recent(x).unwrap()))
.collect(); .collect();
let recents_color = self.theme().auth_recents; let recents_color = self.theme().auth_recents;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::RecentsList, Id::RecentsList,
Box::new(components::RecentsList::new(&bookmarks, recents_color)), Box::new(components::RecentsList::new(&bookmarks, recents_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
// -- mount // -- mount
@@ -488,14 +494,15 @@ impl AuthActivity {
/// Mount error box /// Mount error box
pub(super) fn mount_error<S: AsRef<str>>(&mut self, text: S) { pub(super) fn mount_error<S: AsRef<str>>(&mut self, text: S) {
let err_color = self.theme().misc_error_dialog; let err_color = self.theme().misc_error_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::ErrorPopup, Id::ErrorPopup,
Box::new(components::ErrorPopup::new(text, err_color)), Box::new(components::ErrorPopup::new(text, err_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::ErrorPopup).is_ok()); assert!(self.app.active(&Id::ErrorPopup).is_ok());
} }
@@ -507,14 +514,15 @@ impl AuthActivity {
/// Mount info box /// Mount info box
pub(super) fn mount_info<S: AsRef<str>>(&mut self, text: S) { pub(super) fn mount_info<S: AsRef<str>>(&mut self, text: S) {
let color = self.theme().misc_info_dialog; let color = self.theme().misc_info_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::InfoPopup, Id::InfoPopup,
Box::new(components::InfoPopup::new(text, color)), Box::new(components::InfoPopup::new(text, color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::InfoPopup).is_ok()); assert!(self.app.active(&Id::InfoPopup).is_ok());
} }
@@ -526,14 +534,15 @@ impl AuthActivity {
/// Mount wait box /// Mount wait box
pub(super) fn mount_wait(&mut self, text: &str) { pub(super) fn mount_wait(&mut self, text: &str) {
let wait_color = self.theme().misc_info_dialog; let wait_color = self.theme().misc_info_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::WaitPopup, Id::WaitPopup,
Box::new(components::WaitPopup::new(text, wait_color)), Box::new(components::WaitPopup::new(text, wait_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::WaitPopup).is_ok()); assert!(self.app.active(&Id::WaitPopup).is_ok());
} }
@@ -545,14 +554,15 @@ impl AuthActivity {
/// Mount size error /// Mount size error
pub(super) fn mount_size_err(&mut self) { pub(super) fn mount_size_err(&mut self) {
// Mount // Mount
assert!(self assert!(
.app self.app
.remount( .remount(
Id::WindowSizeError, Id::WindowSizeError,
Box::new(components::WindowSizeError::new(Color::Red)), Box::new(components::WindowSizeError::new(Color::Red)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::WindowSizeError).is_ok()); assert!(self.app.active(&Id::WindowSizeError).is_ok());
} }
@@ -565,14 +575,15 @@ impl AuthActivity {
pub(super) fn mount_quit(&mut self) { pub(super) fn mount_quit(&mut self) {
// Protocol // Protocol
let quit_color = self.theme().misc_quit_dialog; let quit_color = self.theme().misc_quit_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::QuitPopup, Id::QuitPopup,
Box::new(components::QuitPopup::new(quit_color)), Box::new(components::QuitPopup::new(quit_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::QuitPopup).is_ok()); assert!(self.app.active(&Id::QuitPopup).is_ok());
} }
@@ -584,14 +595,15 @@ impl AuthActivity {
/// Mount bookmark delete dialog /// Mount bookmark delete dialog
pub(super) fn mount_bookmark_del_dialog(&mut self) { pub(super) fn mount_bookmark_del_dialog(&mut self) {
let warn_color = self.theme().misc_warn_dialog; let warn_color = self.theme().misc_warn_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::DeleteBookmarkPopup, Id::DeleteBookmarkPopup,
Box::new(components::DeleteBookmarkPopup::new(warn_color)), Box::new(components::DeleteBookmarkPopup::new(warn_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::DeleteBookmarkPopup).is_ok()); assert!(self.app.active(&Id::DeleteBookmarkPopup).is_ok());
} }
@@ -603,14 +615,15 @@ impl AuthActivity {
/// Mount recent delete dialog /// Mount recent delete dialog
pub(super) fn mount_recent_del_dialog(&mut self) { pub(super) fn mount_recent_del_dialog(&mut self) {
let warn_color = self.theme().misc_warn_dialog; let warn_color = self.theme().misc_warn_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::DeleteRecentPopup, Id::DeleteRecentPopup,
Box::new(components::DeleteRecentPopup::new(warn_color)), Box::new(components::DeleteRecentPopup::new(warn_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::DeleteRecentPopup).is_ok()); assert!(self.app.active(&Id::DeleteRecentPopup).is_ok());
} }
@@ -623,22 +636,24 @@ impl AuthActivity {
pub(super) fn mount_bookmark_save_dialog(&mut self, form_tab: FormTab) { pub(super) fn mount_bookmark_save_dialog(&mut self, form_tab: FormTab) {
let save_color = self.theme().misc_save_dialog; let save_color = self.theme().misc_save_dialog;
let warn_color = self.theme().misc_warn_dialog; let warn_color = self.theme().misc_warn_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::BookmarkName, Id::BookmarkName,
Box::new(components::BookmarkName::new(form_tab, save_color)), Box::new(components::BookmarkName::new(form_tab, save_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::BookmarkSavePassword, Id::BookmarkSavePassword,
Box::new(components::BookmarkSavePassword::new(form_tab, warn_color)), Box::new(components::BookmarkSavePassword::new(form_tab, warn_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Give focus to input bookmark name // Give focus to input bookmark name
assert!(self.app.active(&Id::BookmarkName).is_ok()); assert!(self.app.active(&Id::BookmarkName).is_ok());
} }
@@ -652,14 +667,15 @@ impl AuthActivity {
/// Mount keybindings /// Mount keybindings
pub(super) fn mount_keybindings(&mut self) { pub(super) fn mount_keybindings(&mut self) {
let key_color = self.theme().misc_keys; let key_color = self.theme().misc_keys;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Keybindings, Id::Keybindings,
Box::new(components::Keybindings::new(key_color)), Box::new(components::Keybindings::new(key_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Active help // Active help
assert!(self.app.active(&Id::Keybindings).is_ok()); assert!(self.app.active(&Id::Keybindings).is_ok());
} }
@@ -675,22 +691,24 @@ impl AuthActivity {
if let Some(release_notes) = ctx.store().get_string(super::STORE_KEY_RELEASE_NOTES) { if let Some(release_notes) = ctx.store().get_string(super::STORE_KEY_RELEASE_NOTES) {
// make spans // make spans
let info_color = self.theme().misc_info_dialog; let info_color = self.theme().misc_info_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::NewVersionChangelog, Id::NewVersionChangelog,
Box::new(components::ReleaseNotes::new(release_notes, info_color)), Box::new(components::ReleaseNotes::new(release_notes, info_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::InstallUpdatePopup, Id::InstallUpdatePopup,
Box::new(components::InstallUpdatePopup::new(info_color)), Box::new(components::InstallUpdatePopup::new(info_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::InstallUpdatePopup).is_ok()); assert!(self.app.active(&Id::InstallUpdatePopup).is_ok());
} }
} }
@@ -704,8 +722,8 @@ impl AuthActivity {
pub(super) fn mount_host_bridge_protocol(&mut self, protocol: HostBridgeProtocol) { pub(super) fn mount_host_bridge_protocol(&mut self, protocol: HostBridgeProtocol) {
let protocol_color = self.theme().auth_protocol; let protocol_color = self.theme().auth_protocol;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::HostBridge(AuthFormId::Protocol), Id::HostBridge(AuthFormId::Protocol),
Box::new(components::HostBridgeProtocolRadio::new( Box::new(components::HostBridgeProtocolRadio::new(
@@ -714,13 +732,14 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_remote_protocol(&mut self, protocol: FileTransferProtocol) { pub(super) fn mount_remote_protocol(&mut self, protocol: FileTransferProtocol) {
let protocol_color = self.theme().auth_protocol; let protocol_color = self.theme().auth_protocol;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Remote(AuthFormId::Protocol), Id::Remote(AuthFormId::Protocol),
Box::new(components::RemoteProtocolRadio::new( Box::new(components::RemoteProtocolRadio::new(
@@ -729,7 +748,8 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_remote_directory<S: AsRef<str>>( pub(super) fn mount_remote_directory<S: AsRef<str>>(
@@ -739,8 +759,8 @@ impl AuthActivity {
) { ) {
let id = Self::form_tab_id(form_tab, AuthFormId::RemoteDirectory); let id = Self::form_tab_id(form_tab, AuthFormId::RemoteDirectory);
let protocol_color = self.theme().auth_protocol; let protocol_color = self.theme().auth_protocol;
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputRemoteDirectory::new( Box::new(components::InputRemoteDirectory::new(
@@ -750,7 +770,8 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_local_directory<S: AsRef<str>>( pub(super) fn mount_local_directory<S: AsRef<str>>(
@@ -760,8 +781,8 @@ impl AuthActivity {
) { ) {
let id = Self::form_tab_id(form_tab, AuthFormId::LocalDirectory); let id = Self::form_tab_id(form_tab, AuthFormId::LocalDirectory);
let color = self.theme().auth_username; let color = self.theme().auth_username;
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputLocalDirectory::new( Box::new(components::InputLocalDirectory::new(
@@ -771,40 +792,43 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_address(&mut self, form_tab: FormTab, address: &str) { pub(super) fn mount_address(&mut self, form_tab: FormTab, address: &str) {
let addr_color = self.theme().auth_address; let addr_color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::Address); let id = Self::form_tab_id(form_tab, AuthFormId::Address);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputAddress::new(address, form_tab, addr_color)), Box::new(components::InputAddress::new(address, form_tab, addr_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_port(&mut self, form_tab: FormTab, port: u16) { pub(super) fn mount_port(&mut self, form_tab: FormTab, port: u16) {
let port_color = self.theme().auth_port; let port_color = self.theme().auth_port;
let id = Self::form_tab_id(form_tab, AuthFormId::Port); let id = Self::form_tab_id(form_tab, AuthFormId::Port);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputPort::new(port, form_tab, port_color)), Box::new(components::InputPort::new(port, form_tab, port_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_username(&mut self, form_tab: FormTab, username: &str) { pub(super) fn mount_username(&mut self, form_tab: FormTab, username: &str) {
let username_color = self.theme().auth_username; let username_color = self.theme().auth_username;
let id = Self::form_tab_id(form_tab, AuthFormId::Username); let id = Self::form_tab_id(form_tab, AuthFormId::Username);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputUsername::new( Box::new(components::InputUsername::new(
@@ -814,14 +838,15 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_password(&mut self, form_tab: FormTab, password: &str) { pub(super) fn mount_password(&mut self, form_tab: FormTab, password: &str) {
let password_color = self.theme().auth_password; let password_color = self.theme().auth_password;
let id = Self::form_tab_id(form_tab, AuthFormId::Password); let id = Self::form_tab_id(form_tab, AuthFormId::Password);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputPassword::new( Box::new(components::InputPassword::new(
@@ -831,40 +856,43 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_s3_bucket(&mut self, form_tab: FormTab, bucket: &str) { pub(super) fn mount_s3_bucket(&mut self, form_tab: FormTab, bucket: &str) {
let addr_color = self.theme().auth_address; let addr_color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::S3Bucket); let id = Self::form_tab_id(form_tab, AuthFormId::S3Bucket);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputS3Bucket::new(bucket, form_tab, addr_color)), Box::new(components::InputS3Bucket::new(bucket, form_tab, addr_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_s3_region(&mut self, form_tab: FormTab, region: &str) { pub(super) fn mount_s3_region(&mut self, form_tab: FormTab, region: &str) {
let port_color = self.theme().auth_port; let port_color = self.theme().auth_port;
let id = Self::form_tab_id(form_tab, AuthFormId::S3Region); let id = Self::form_tab_id(form_tab, AuthFormId::S3Region);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputS3Region::new(region, form_tab, port_color)), Box::new(components::InputS3Region::new(region, form_tab, port_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_s3_endpoint(&mut self, form_tab: FormTab, endpoint: &str) { pub(super) fn mount_s3_endpoint(&mut self, form_tab: FormTab, endpoint: &str) {
let username_color = self.theme().auth_username; let username_color = self.theme().auth_username;
let id = Self::form_tab_id(form_tab, AuthFormId::S3Endpoint); let id = Self::form_tab_id(form_tab, AuthFormId::S3Endpoint);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputS3Endpoint::new( Box::new(components::InputS3Endpoint::new(
@@ -874,40 +902,43 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_s3_profile(&mut self, form_tab: FormTab, profile: &str) { pub(super) fn mount_s3_profile(&mut self, form_tab: FormTab, profile: &str) {
let color = self.theme().auth_password; let color = self.theme().auth_password;
let id = Self::form_tab_id(form_tab, AuthFormId::S3Profile); let id = Self::form_tab_id(form_tab, AuthFormId::S3Profile);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputS3Profile::new(profile, form_tab, color)), Box::new(components::InputS3Profile::new(profile, form_tab, color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_s3_access_key(&mut self, form_tab: FormTab, key: &str) { pub(super) fn mount_s3_access_key(&mut self, form_tab: FormTab, key: &str) {
let color = self.theme().auth_address; let color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::S3AccessKey); let id = Self::form_tab_id(form_tab, AuthFormId::S3AccessKey);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputS3AccessKey::new(key, form_tab, color)), Box::new(components::InputS3AccessKey::new(key, form_tab, color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_s3_secret_access_key(&mut self, form_tab: FormTab, key: &str) { pub(super) fn mount_s3_secret_access_key(&mut self, form_tab: FormTab, key: &str) {
let color = self.theme().auth_port; let color = self.theme().auth_port;
let id = Self::form_tab_id(form_tab, AuthFormId::S3SecretAccessKey); let id = Self::form_tab_id(form_tab, AuthFormId::S3SecretAccessKey);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputS3SecretAccessKey::new( Box::new(components::InputS3SecretAccessKey::new(
@@ -915,14 +946,15 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_s3_security_token(&mut self, form_tab: FormTab, token: &str) { pub(super) fn mount_s3_security_token(&mut self, form_tab: FormTab, token: &str) {
let color = self.theme().auth_username; let color = self.theme().auth_username;
let id = Self::form_tab_id(form_tab, AuthFormId::S3SecurityToken); let id = Self::form_tab_id(form_tab, AuthFormId::S3SecurityToken);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputS3SecurityToken::new( Box::new(components::InputS3SecurityToken::new(
@@ -930,27 +962,29 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_s3_session_token(&mut self, form_tab: FormTab, token: &str) { pub(super) fn mount_s3_session_token(&mut self, form_tab: FormTab, token: &str) {
let color = self.theme().auth_password; let color = self.theme().auth_password;
let id = Self::form_tab_id(form_tab, AuthFormId::S3SessionToken); let id = Self::form_tab_id(form_tab, AuthFormId::S3SessionToken);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputS3SessionToken::new(token, form_tab, color)), Box::new(components::InputS3SessionToken::new(token, form_tab, color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_s3_new_path_style(&mut self, form_tab: FormTab, new_path_style: bool) { pub(super) fn mount_s3_new_path_style(&mut self, form_tab: FormTab, new_path_style: bool) {
let color = self.theme().auth_address; let color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::S3NewPathStyle); let id = Self::form_tab_id(form_tab, AuthFormId::S3NewPathStyle);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::RadioS3NewPathStyle::new( Box::new(components::RadioS3NewPathStyle::new(
@@ -960,94 +994,101 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_kube_namespace(&mut self, form_tab: FormTab, value: &str) { pub(super) fn mount_kube_namespace(&mut self, form_tab: FormTab, value: &str) {
let color = self.theme().auth_port; let color = self.theme().auth_port;
let id = Self::form_tab_id(form_tab, AuthFormId::KubeNamespace); let id = Self::form_tab_id(form_tab, AuthFormId::KubeNamespace);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputKubeNamespace::new(value, form_tab, color)), Box::new(components::InputKubeNamespace::new(value, form_tab, color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_kube_cluster_url(&mut self, form_tab: FormTab, value: &str) { pub(super) fn mount_kube_cluster_url(&mut self, form_tab: FormTab, value: &str) {
let color = self.theme().auth_username; let color = self.theme().auth_username;
let id = Self::form_tab_id(form_tab, AuthFormId::KubeClusterUrl); let id = Self::form_tab_id(form_tab, AuthFormId::KubeClusterUrl);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputKubeClusterUrl::new(value, form_tab, color)), Box::new(components::InputKubeClusterUrl::new(value, form_tab, color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_kube_username(&mut self, form_tab: FormTab, value: &str) { pub(super) fn mount_kube_username(&mut self, form_tab: FormTab, value: &str) {
let color = self.theme().auth_password; let color = self.theme().auth_password;
let id = Self::form_tab_id(form_tab, AuthFormId::KubeUsername); let id = Self::form_tab_id(form_tab, AuthFormId::KubeUsername);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputKubeUsername::new(value, form_tab, color)), Box::new(components::InputKubeUsername::new(value, form_tab, color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_kube_client_cert(&mut self, form_tab: FormTab, value: &str) { pub(super) fn mount_kube_client_cert(&mut self, form_tab: FormTab, value: &str) {
let color = self.theme().auth_address; let color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::KubeClientCert); let id = Self::form_tab_id(form_tab, AuthFormId::KubeClientCert);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputKubeClientCert::new(value, form_tab, color)), Box::new(components::InputKubeClientCert::new(value, form_tab, color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_kube_client_key(&mut self, form_tab: FormTab, value: &str) { pub(super) fn mount_kube_client_key(&mut self, form_tab: FormTab, value: &str) {
let color = self.theme().auth_port; let color = self.theme().auth_port;
let id = Self::form_tab_id(form_tab, AuthFormId::KubeClientKey); let id = Self::form_tab_id(form_tab, AuthFormId::KubeClientKey);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputKubeClientKey::new(value, form_tab, color)), Box::new(components::InputKubeClientKey::new(value, form_tab, color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_smb_share(&mut self, form_tab: FormTab, share: &str) { pub(super) fn mount_smb_share(&mut self, form_tab: FormTab, share: &str) {
let color = self.theme().auth_password; let color = self.theme().auth_password;
let id = Self::form_tab_id(form_tab, AuthFormId::SmbShare); let id = Self::form_tab_id(form_tab, AuthFormId::SmbShare);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputSmbShare::new(share, form_tab, color)), Box::new(components::InputSmbShare::new(share, form_tab, color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
#[cfg(posix)] #[cfg(posix)]
pub(super) fn mount_smb_workgroup(&mut self, form_tab: FormTab, workgroup: &str) { pub(super) fn mount_smb_workgroup(&mut self, form_tab: FormTab, workgroup: &str) {
let color = self.theme().auth_address; let color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::SmbWorkgroup); let id = Self::form_tab_id(form_tab, AuthFormId::SmbWorkgroup);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputSmbWorkgroup::new( Box::new(components::InputSmbWorkgroup::new(
@@ -1055,20 +1096,22 @@ impl AuthActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_webdav_uri(&mut self, form_tab: FormTab, uri: &str) { pub(super) fn mount_webdav_uri(&mut self, form_tab: FormTab, uri: &str) {
let addr_color = self.theme().auth_address; let addr_color = self.theme().auth_address;
let id = Self::form_tab_id(form_tab, AuthFormId::WebDAVUri); let id = Self::form_tab_id(form_tab, AuthFormId::WebDAVUri);
assert!(self assert!(
.app self.app
.remount( .remount(
id, id,
Box::new(components::InputWebDAVUri::new(uri, form_tab, addr_color)), Box::new(components::InputWebDAVUri::new(uri, form_tab, addr_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
fn form_tab_id(form_tab: FormTab, id: AuthFormId) -> Id { fn form_tab_id(form_tab: FormTab, id: AuthFormId) -> Id {
@@ -1949,8 +1992,8 @@ impl AuthActivity {
fn init_global_listener(&mut self) { fn init_global_listener(&mut self) {
use tuirealm::event::{Key, KeyEvent, KeyModifiers}; use tuirealm::event::{Key, KeyEvent, KeyModifiers};
assert!(self assert!(
.app self.app
.mount( .mount(
Id::GlobalListener, Id::GlobalListener,
Box::<components::GlobalListener>::default(), Box::<components::GlobalListener>::default(),
@@ -2007,7 +2050,8 @@ impl AuthActivity {
Sub::new(SubEventClause::WindowResize, SubClause::Always) Sub::new(SubEventClause::WindowResize, SubClause::Always)
] ]
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn get_current_form_tab(&self) -> FormTab { pub(super) fn get_current_form_tab(&self) -> FormTab {
@@ -167,7 +167,9 @@ impl FileTransferActivity {
} }
} else { } else {
// Do not synchronize, disable sync browsing and return // Do not synchronize, disable sync browsing and return
trace!("The user doesn't want to create the directory; disabling synchronized browsing"); trace!(
"The user doesn't want to create the directory; disabling synchronized browsing"
);
self.log( self.log(
LogLevel::Warn, LogLevel::Warn,
format!("Refused to create '{name}'; synchronized browsing disabled"), format!("Refused to create '{name}'; synchronized browsing disabled"),
@@ -7,8 +7,8 @@ use std::io::Read;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::time::SystemTime; use std::time::SystemTime;
use remotefs::fs::Metadata;
use remotefs::File; use remotefs::File;
use remotefs::fs::Metadata;
use super::{FileTransferActivity, LogLevel, SelectedFile, TransferPayload}; use super::{FileTransferActivity, LogLevel, SelectedFile, TransferPayload};
@@ -221,10 +221,7 @@ impl FileTransferActivity {
/// Edit file on remote host /// Edit file on remote host
fn edit_remote_file(&mut self, file: File) -> Result<(), String> { fn edit_remote_file(&mut self, file: File) -> Result<(), String> {
// Create temp file // Create temp file
let tmpfile: PathBuf = match self.download_file_as_temp(&file) { let tmpfile = self.download_file_as_temp(&file)?;
Ok(p) => p,
Err(err) => return Err(err),
};
// Download file // Download file
let file_name = file.name(); let file_name = file.name();
let file_path = file.path().to_path_buf(); let file_path = file.path().to_path_buf();
@@ -243,7 +240,7 @@ impl FileTransferActivity {
"Could not stat \"{}\": {}", "Could not stat \"{}\": {}",
tmpfile.as_path().display(), tmpfile.as_path().display(),
err err
)) ));
} }
}; };
// Edit file // Edit file
@@ -256,7 +253,7 @@ impl FileTransferActivity {
"Could not stat \"{}\": {}", "Could not stat \"{}\": {}",
tmpfile.as_path().display(), tmpfile.as_path().display(),
err err
)) ));
} }
}; };
// Check if file has changed // Check if file has changed
@@ -282,7 +279,7 @@ impl FileTransferActivity {
"Could not stat \"{}\": {}", "Could not stat \"{}\": {}",
tmpfile.as_path().display(), tmpfile.as_path().display(),
err err
)) ));
} }
}; };
// Send file // Send file
@@ -4,8 +4,8 @@ use regex::Regex;
use remotefs::File; use remotefs::File;
use wildmatch::WildMatch; use wildmatch::WildMatch;
use crate::ui::activities::filetransfer::lib::browser::FileExplorerTab;
use crate::ui::activities::filetransfer::FileTransferActivity; use crate::ui::activities::filetransfer::FileTransferActivity;
use crate::ui::activities::filetransfer::lib::browser::FileExplorerTab;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum Filter { pub enum Filter {
@@ -2,8 +2,8 @@
//! //!
//! `filetransfer_activiy` is the module which implements the Filetransfer activity, which is the main activity afterall //! `filetransfer_activiy` is the module which implements the Filetransfer activity, which is the main activity afterall
use remotefs::fs::UnixPex;
use remotefs::File; use remotefs::File;
use remotefs::fs::UnixPex;
use tuirealm::{State, StateValue}; use tuirealm::{State, StateValue};
use super::browser::FileExplorerTab; use super::browser::FileExplorerTab;
@@ -16,12 +16,12 @@ mod transfer;
pub use misc::FooterBar; pub use misc::FooterBar;
pub use popups::{ pub use popups::{
ChmodPopup, CopyPopup, DeletePopup, DisconnectPopup, ErrorPopup, ExecPopup, FatalPopup, ATTR_FILES, ChmodPopup, CopyPopup, DeletePopup, DisconnectPopup, ErrorPopup, ExecPopup,
FileInfoPopup, FilterPopup, GotoPopup, KeybindingsPopup, MkdirPopup, NewfilePopup, FatalPopup, FileInfoPopup, FilterPopup, GotoPopup, KeybindingsPopup, MkdirPopup, NewfilePopup,
OpenWithPopup, ProgressBarFull, ProgressBarPartial, QuitPopup, RenamePopup, ReplacePopup, OpenWithPopup, ProgressBarFull, ProgressBarPartial, QuitPopup, RenamePopup, ReplacePopup,
ReplacingFilesListPopup, SaveAsPopup, SortingPopup, StatusBarLocal, StatusBarRemote, ReplacingFilesListPopup, SaveAsPopup, SortingPopup, StatusBarLocal, StatusBarRemote,
SymlinkPopup, SyncBrowsingMkdirPopup, WaitPopup, WalkdirWaitPopup, WatchedPathsList, SymlinkPopup, SyncBrowsingMkdirPopup, WaitPopup, WalkdirWaitPopup, WatchedPathsList,
WatcherPopup, ATTR_FILES, WatcherPopup,
}; };
pub use transfer::{ExplorerFind, ExplorerFuzzy, ExplorerLocal, ExplorerRemote}; pub use transfer::{ExplorerFind, ExplorerFuzzy, ExplorerLocal, ExplorerRemote};
@@ -20,7 +20,7 @@ use tuirealm::{Component, Event, MockComponent, NoUserEvent, State, StateValue};
use uzers::{get_group_by_gid, get_user_by_uid}; use uzers::{get_group_by_gid, get_user_by_uid};
pub use self::chmod::ChmodPopup; pub use self::chmod::ChmodPopup;
pub use self::goto::{GotoPopup, ATTR_FILES}; pub use self::goto::{ATTR_FILES, GotoPopup};
use super::super::Browser; use super::super::Browser;
use super::{Msg, PendingActionMsg, TransferMsg, UiMsg}; use super::{Msg, PendingActionMsg, TransferMsg, UiMsg};
use crate::explorer::FileSorting; use crate::explorer::FileSorting;
+46 -33
View File
@@ -90,8 +90,10 @@ impl FileTransferActivity {
/// Set text editor to use /// Set text editor to use
pub(super) fn setup_text_editor(&self) { pub(super) fn setup_text_editor(&self) {
unsafe {
env::set_var("EDITOR", self.config().get_text_editor()); env::set_var("EDITOR", self.config().get_text_editor());
} }
}
/// Convert a path to absolute according to host explorer /// Convert a path to absolute according to host explorer
pub(super) fn host_bridge_to_abs_path(&self, path: &Path) -> PathBuf { pub(super) fn host_bridge_to_abs_path(&self, path: &Path) -> PathBuf {
@@ -262,22 +264,24 @@ impl FileTransferActivity {
.map(|x| vec![TextSpan::from(self.host_bridge().fmt_file(x))]) .map(|x| vec![TextSpan::from(self.host_bridge().fmt_file(x))])
.collect(); .collect();
// Update content and title // Update content and title
assert!(self assert!(
.app self.app
.attr( .attr(
&Id::ExplorerHostBridge, &Id::ExplorerHostBridge,
Attribute::Content, Attribute::Content,
AttrValue::Table(files) AttrValue::Table(files)
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.attr( .attr(
&Id::ExplorerHostBridge, &Id::ExplorerHostBridge,
Attribute::Title, Attribute::Title,
AttrValue::Title((hostname, Alignment::Left)) AttrValue::Title((hostname, Alignment::Left))
) )
.is_ok()); .is_ok()
);
} }
/// Update remote file list /// Update remote file list
@@ -307,22 +311,24 @@ impl FileTransferActivity {
.map(|x| vec![TextSpan::from(self.remote().fmt_file(x))]) .map(|x| vec![TextSpan::from(self.remote().fmt_file(x))])
.collect(); .collect();
// Update content and title // Update content and title
assert!(self assert!(
.app self.app
.attr( .attr(
&Id::ExplorerRemote, &Id::ExplorerRemote,
Attribute::Content, Attribute::Content,
AttrValue::Table(files) AttrValue::Table(files)
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.attr( .attr(
&Id::ExplorerRemote, &Id::ExplorerRemote,
Attribute::Title, Attribute::Title,
AttrValue::Title((hostname, Alignment::Left)) AttrValue::Title((hostname, Alignment::Left))
) )
.is_ok()); .is_ok()
);
} }
/// Update log box /// Update log box
@@ -361,27 +367,29 @@ impl FileTransferActivity {
.add_col(TextSpan::from("]: ")) .add_col(TextSpan::from("]: "))
.add_col(TextSpan::from(record.msg.as_str())); .add_col(TextSpan::from(record.msg.as_str()));
} }
assert!(self assert!(
.app self.app
.attr( .attr(
&Id::Log, &Id::Log,
Attribute::Content, Attribute::Content,
AttrValue::Table(table.build()) AttrValue::Table(table.build())
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn update_progress_bar(&mut self, filename: String) { pub(super) fn update_progress_bar(&mut self, filename: String) {
assert!(self assert!(
.app self.app
.attr( .attr(
&Id::ProgressBarFull, &Id::ProgressBarFull,
Attribute::Text, Attribute::Text,
AttrValue::String(self.transfer.full.to_string()) AttrValue::String(self.transfer.full.to_string())
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.attr( .attr(
&Id::ProgressBarFull, &Id::ProgressBarFull,
Attribute::Value, Attribute::Value,
@@ -389,17 +397,19 @@ impl FileTransferActivity {
self.transfer.full.calc_progress() self.transfer.full.calc_progress()
))) )))
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.attr( .attr(
&Id::ProgressBarPartial, &Id::ProgressBarPartial,
Attribute::Text, Attribute::Text,
AttrValue::String(self.transfer.partial.to_string()) AttrValue::String(self.transfer.partial.to_string())
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.attr( .attr(
&Id::ProgressBarPartial, &Id::ProgressBarPartial,
Attribute::Value, Attribute::Value,
@@ -407,15 +417,17 @@ impl FileTransferActivity {
self.transfer.partial.calc_progress() self.transfer.partial.calc_progress()
))) )))
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.attr( .attr(
&Id::ProgressBarPartial, &Id::ProgressBarPartial,
Attribute::Title, Attribute::Title,
AttrValue::Title((filename, Alignment::Center)) AttrValue::Title((filename, Alignment::Center))
) )
.is_ok()); .is_ok()
);
} }
/// Finalize find process /// Finalize find process
@@ -450,14 +462,15 @@ impl FileTransferActivity {
.iter_files() .iter_files()
.map(|x| vec![TextSpan::from(self.found().unwrap().fmt_file(x))]) .map(|x| vec![TextSpan::from(self.found().unwrap().fmt_file(x))])
.collect(); .collect();
assert!(self assert!(
.app self.app
.attr( .attr(
&Id::ExplorerFind, &Id::ExplorerFind,
Attribute::Content, Attribute::Content,
AttrValue::Table(files) AttrValue::Table(files)
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn update_browser_file_list(&mut self) { pub(super) fn update_browser_file_list(&mut self) {
+1 -1
View File
@@ -28,7 +28,7 @@ use session::TransferPayload;
use tempfile::TempDir; use tempfile::TempDir;
use tuirealm::{Application, EventListenerCfg, NoUserEvent}; use tuirealm::{Application, EventListenerCfg, NoUserEvent};
use super::{Activity, Context, ExitReason, CROSSTERM_MAX_POLL}; use super::{Activity, CROSSTERM_MAX_POLL, Context, ExitReason};
use crate::config::themes::Theme; use crate::config::themes::Theme;
use crate::explorer::{FileExplorer, FileSorting}; use crate::explorer::{FileExplorer, FileSorting};
use crate::filetransfer::{ use crate::filetransfer::{
+1 -1
View File
@@ -1239,7 +1239,7 @@ impl FileTransferActivity {
None => { None => {
return Err(String::from( return Err(String::from(
"Could not create tempfile: cache not available", "Could not create tempfile: cache not available",
)) ));
} }
}; };
// Download file // Download file
+1 -1
View File
@@ -8,8 +8,8 @@ use remotefs::fs::File;
use tuirealm::props::{AttrValue, Attribute}; use tuirealm::props::{AttrValue, Attribute};
use tuirealm::{State, StateValue, Update}; use tuirealm::{State, StateValue, Update};
use super::actions::walkdir::WalkdirError;
use super::actions::SelectedFile; use super::actions::SelectedFile;
use super::actions::walkdir::WalkdirError;
use super::browser::{FileExplorerTab, FoundExplorerTab}; use super::browser::{FileExplorerTab, FoundExplorerTab};
use super::{ExitReason, FileTransferActivity, Id, Msg, TransferMsg, TransferOpts, UiMsg}; use super::{ExitReason, FileTransferActivity, Id, Msg, TransferMsg, TransferOpts, UiMsg};
+153 -115
View File
@@ -14,7 +14,7 @@ use unicode_width::UnicodeWidthStr;
use super::browser::{FileExplorerTab, FoundExplorerTab}; use super::browser::{FileExplorerTab, FoundExplorerTab};
use super::components::ATTR_FILES; use super::components::ATTR_FILES;
use super::{components, Context, FileTransferActivity, Id}; use super::{Context, FileTransferActivity, Id, components};
use crate::explorer::FileSorting; use crate::explorer::FileSorting;
use crate::utils::ui::{Popup, Size}; use crate::utils::ui::{Popup, Size};
@@ -33,16 +33,17 @@ impl FileTransferActivity {
let key_color = self.theme().misc_keys; let key_color = self.theme().misc_keys;
let log_panel = self.theme().transfer_log_window; let log_panel = self.theme().transfer_log_window;
let log_background = self.theme().transfer_log_background; let log_background = self.theme().transfer_log_background;
assert!(self assert!(
.app self.app
.mount( .mount(
Id::FooterBar, Id::FooterBar,
Box::new(components::FooterBar::new(key_color)), Box::new(components::FooterBar::new(key_color)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.mount( .mount(
Id::ExplorerHostBridge, Id::ExplorerHostBridge,
Box::new(components::ExplorerLocal::new( Box::new(components::ExplorerLocal::new(
@@ -54,9 +55,10 @@ impl FileTransferActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.mount( .mount(
Id::ExplorerRemote, Id::ExplorerRemote,
Box::new(components::ExplorerRemote::new( Box::new(components::ExplorerRemote::new(
@@ -68,15 +70,17 @@ impl FileTransferActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.mount( .mount(
Id::Log, Id::Log,
Box::new(components::Log::new(vec![], log_panel, log_background)), Box::new(components::Log::new(vec![], log_panel, log_background)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Load status bar // Load status bar
self.refresh_local_status_bar(); self.refresh_local_status_bar();
self.refresh_remote_status_bar(); self.refresh_remote_status_bar();
@@ -339,14 +343,15 @@ impl FileTransferActivity {
pub(super) fn mount_info<S: AsRef<str>>(&mut self, text: S) { pub(super) fn mount_info<S: AsRef<str>>(&mut self, text: S) {
// Mount // Mount
let info_color = self.theme().misc_info_dialog; let info_color = self.theme().misc_info_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::ErrorPopup, Id::ErrorPopup,
Box::new(components::ErrorPopup::new(text, info_color)), Box::new(components::ErrorPopup::new(text, info_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::ErrorPopup).is_ok()); assert!(self.app.active(&Id::ErrorPopup).is_ok());
} }
@@ -354,14 +359,15 @@ impl FileTransferActivity {
pub(super) fn mount_error<S: AsRef<str>>(&mut self, text: S) { pub(super) fn mount_error<S: AsRef<str>>(&mut self, text: S) {
// Mount // Mount
let error_color = self.theme().misc_error_dialog; let error_color = self.theme().misc_error_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::ErrorPopup, Id::ErrorPopup,
Box::new(components::ErrorPopup::new(text, error_color)), Box::new(components::ErrorPopup::new(text, error_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::ErrorPopup).is_ok()); assert!(self.app.active(&Id::ErrorPopup).is_ok());
} }
@@ -374,14 +380,15 @@ impl FileTransferActivity {
self.umount_wait(); self.umount_wait();
// Mount // Mount
let error_color = self.theme().misc_error_dialog; let error_color = self.theme().misc_error_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::FatalPopup, Id::FatalPopup,
Box::new(components::FatalPopup::new(text, error_color)), Box::new(components::FatalPopup::new(text, error_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::FatalPopup).is_ok()); assert!(self.app.active(&Id::FatalPopup).is_ok());
} }
@@ -392,21 +399,22 @@ impl FileTransferActivity {
pub(super) fn mount_wait<S: AsRef<str>>(&mut self, text: S) { pub(super) fn mount_wait<S: AsRef<str>>(&mut self, text: S) {
let color = self.theme().misc_info_dialog; let color = self.theme().misc_info_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::WaitPopup, Id::WaitPopup,
Box::new(components::WaitPopup::new(text, color)), Box::new(components::WaitPopup::new(text, color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::WaitPopup).is_ok()); assert!(self.app.active(&Id::WaitPopup).is_ok());
} }
pub(super) fn mount_walkdir_wait(&mut self) { pub(super) fn mount_walkdir_wait(&mut self) {
let color = self.theme().misc_info_dialog; let color = self.theme().misc_info_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::WaitPopup, Id::WaitPopup,
Box::new(components::WalkdirWaitPopup::new( Box::new(components::WalkdirWaitPopup::new(
@@ -415,7 +423,8 @@ impl FileTransferActivity {
)), )),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::WaitPopup).is_ok()); assert!(self.app.active(&Id::WaitPopup).is_ok());
self.view(); self.view();
@@ -448,14 +457,15 @@ impl FileTransferActivity {
pub(super) fn mount_quit(&mut self) { pub(super) fn mount_quit(&mut self) {
// Protocol // Protocol
let quit_color = self.theme().misc_quit_dialog; let quit_color = self.theme().misc_quit_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::QuitPopup, Id::QuitPopup,
Box::new(components::QuitPopup::new(quit_color)), Box::new(components::QuitPopup::new(quit_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::QuitPopup).is_ok()); assert!(self.app.active(&Id::QuitPopup).is_ok());
} }
@@ -468,14 +478,15 @@ impl FileTransferActivity {
pub(super) fn mount_disconnect(&mut self) { pub(super) fn mount_disconnect(&mut self) {
// Protocol // Protocol
let quit_color = self.theme().misc_quit_dialog; let quit_color = self.theme().misc_quit_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::DisconnectPopup, Id::DisconnectPopup,
Box::new(components::DisconnectPopup::new(quit_color)), Box::new(components::DisconnectPopup::new(quit_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::DisconnectPopup).is_ok()); assert!(self.app.active(&Id::DisconnectPopup).is_ok());
} }
@@ -487,14 +498,15 @@ impl FileTransferActivity {
pub(super) fn mount_chmod(&mut self, mode: UnixPex, title: String) { pub(super) fn mount_chmod(&mut self, mode: UnixPex, title: String) {
// Mount // Mount
let color = self.theme().misc_input_dialog; let color = self.theme().misc_input_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::ChmodPopup, Id::ChmodPopup,
Box::new(components::ChmodPopup::new(mode, color, title)), Box::new(components::ChmodPopup::new(mode, color, title)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::ChmodPopup).is_ok()); assert!(self.app.active(&Id::ChmodPopup).is_ok());
} }
@@ -508,27 +520,29 @@ impl FileTransferActivity {
pub(super) fn mount_filter(&mut self) { pub(super) fn mount_filter(&mut self) {
let input_color = self.theme().misc_input_dialog; let input_color = self.theme().misc_input_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::FilterPopup, Id::FilterPopup,
Box::new(components::FilterPopup::new(input_color)), Box::new(components::FilterPopup::new(input_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::FilterPopup).is_ok()); assert!(self.app.active(&Id::FilterPopup).is_ok());
} }
pub(super) fn mount_copy(&mut self) { pub(super) fn mount_copy(&mut self) {
let input_color = self.theme().misc_input_dialog; let input_color = self.theme().misc_input_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::CopyPopup, Id::CopyPopup,
Box::new(components::CopyPopup::new(input_color)), Box::new(components::CopyPopup::new(input_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::CopyPopup).is_ok()); assert!(self.app.active(&Id::CopyPopup).is_ok());
} }
@@ -538,14 +552,15 @@ impl FileTransferActivity {
pub(super) fn mount_exec(&mut self) { pub(super) fn mount_exec(&mut self) {
let input_color = self.theme().misc_input_dialog; let input_color = self.theme().misc_input_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::ExecPopup, Id::ExecPopup,
Box::new(components::ExecPopup::new(input_color)), Box::new(components::ExecPopup::new(input_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::ExecPopup).is_ok()); assert!(self.app.active(&Id::ExecPopup).is_ok());
} }
@@ -569,8 +584,8 @@ impl FileTransferActivity {
}; };
// Mount component // Mount component
assert!(self assert!(
.app self.app
.remount( .remount(
Id::ExplorerFind, Id::ExplorerFind,
if fuzzy_search { if fuzzy_search {
@@ -592,7 +607,8 @@ impl FileTransferActivity {
}, },
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::ExplorerFind).is_ok()); assert!(self.app.active(&Id::ExplorerFind).is_ok());
} }
@@ -611,14 +627,15 @@ impl FileTransferActivity {
.collect::<Vec<String>>(); .collect::<Vec<String>>();
let input_color = self.theme().misc_input_dialog; let input_color = self.theme().misc_input_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::GotoPopup, Id::GotoPopup,
Box::new(components::GotoPopup::new(input_color, files)), Box::new(components::GotoPopup::new(input_color, files)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::GotoPopup).is_ok()); assert!(self.app.active(&Id::GotoPopup).is_ok());
} }
@@ -641,14 +658,15 @@ impl FileTransferActivity {
pub(super) fn mount_mkdir(&mut self) { pub(super) fn mount_mkdir(&mut self) {
let input_color = self.theme().misc_input_dialog; let input_color = self.theme().misc_input_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::MkdirPopup, Id::MkdirPopup,
Box::new(components::MkdirPopup::new(input_color)), Box::new(components::MkdirPopup::new(input_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::MkdirPopup).is_ok()); assert!(self.app.active(&Id::MkdirPopup).is_ok());
} }
@@ -658,14 +676,15 @@ impl FileTransferActivity {
pub(super) fn mount_newfile(&mut self) { pub(super) fn mount_newfile(&mut self) {
let input_color = self.theme().misc_input_dialog; let input_color = self.theme().misc_input_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::NewfilePopup, Id::NewfilePopup,
Box::new(components::NewfilePopup::new(input_color)), Box::new(components::NewfilePopup::new(input_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::NewfilePopup).is_ok()); assert!(self.app.active(&Id::NewfilePopup).is_ok());
} }
@@ -675,14 +694,15 @@ impl FileTransferActivity {
pub(super) fn mount_openwith(&mut self) { pub(super) fn mount_openwith(&mut self) {
let input_color = self.theme().misc_input_dialog; let input_color = self.theme().misc_input_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::OpenWithPopup, Id::OpenWithPopup,
Box::new(components::OpenWithPopup::new(input_color)), Box::new(components::OpenWithPopup::new(input_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::OpenWithPopup).is_ok()); assert!(self.app.active(&Id::OpenWithPopup).is_ok());
} }
@@ -692,14 +712,15 @@ impl FileTransferActivity {
pub(super) fn mount_rename(&mut self) { pub(super) fn mount_rename(&mut self) {
let input_color = self.theme().misc_input_dialog; let input_color = self.theme().misc_input_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::RenamePopup, Id::RenamePopup,
Box::new(components::RenamePopup::new(input_color)), Box::new(components::RenamePopup::new(input_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::RenamePopup).is_ok()); assert!(self.app.active(&Id::RenamePopup).is_ok());
} }
@@ -709,14 +730,15 @@ impl FileTransferActivity {
pub(super) fn mount_saveas(&mut self) { pub(super) fn mount_saveas(&mut self) {
let input_color = self.theme().misc_input_dialog; let input_color = self.theme().misc_input_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::SaveAsPopup, Id::SaveAsPopup,
Box::new(components::SaveAsPopup::new(input_color)), Box::new(components::SaveAsPopup::new(input_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::SaveAsPopup).is_ok()); assert!(self.app.active(&Id::SaveAsPopup).is_ok());
} }
@@ -727,8 +749,8 @@ impl FileTransferActivity {
pub(super) fn mount_progress_bar(&mut self, root_name: String) { pub(super) fn mount_progress_bar(&mut self, root_name: String) {
let prog_color_full = self.theme().transfer_progress_bar_full; let prog_color_full = self.theme().transfer_progress_bar_full;
let prog_color_partial = self.theme().transfer_progress_bar_partial; let prog_color_partial = self.theme().transfer_progress_bar_partial;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::ProgressBarFull, Id::ProgressBarFull,
Box::new(components::ProgressBarFull::new( Box::new(components::ProgressBarFull::new(
@@ -739,9 +761,10 @@ impl FileTransferActivity {
)), )),
vec![], vec![],
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::ProgressBarPartial, Id::ProgressBarPartial,
Box::new(components::ProgressBarPartial::new( Box::new(components::ProgressBarPartial::new(
@@ -752,7 +775,8 @@ impl FileTransferActivity {
)), )),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::ProgressBarPartial).is_ok()); assert!(self.app.active(&Id::ProgressBarPartial).is_ok());
} }
@@ -768,14 +792,15 @@ impl FileTransferActivity {
FileExplorerTab::Remote => self.remote().get_file_sorting(), FileExplorerTab::Remote => self.remote().get_file_sorting(),
_ => return, _ => return,
}; };
assert!(self assert!(
.app self.app
.remount( .remount(
Id::SortingPopup, Id::SortingPopup,
Box::new(components::SortingPopup::new(sorting, sorting_color)), Box::new(components::SortingPopup::new(sorting, sorting_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::SortingPopup).is_ok()); assert!(self.app.active(&Id::SortingPopup).is_ok());
} }
@@ -785,14 +810,15 @@ impl FileTransferActivity {
pub(super) fn mount_radio_delete(&mut self) { pub(super) fn mount_radio_delete(&mut self) {
let warn_color = self.theme().misc_warn_dialog; let warn_color = self.theme().misc_warn_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::DeletePopup, Id::DeletePopup,
Box::new(components::DeletePopup::new(warn_color)), Box::new(components::DeletePopup::new(warn_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::DeletePopup).is_ok()); assert!(self.app.active(&Id::DeletePopup).is_ok());
} }
@@ -802,8 +828,8 @@ impl FileTransferActivity {
pub(super) fn mount_radio_watch(&mut self, watch: bool, local: &str, remote: &str) { pub(super) fn mount_radio_watch(&mut self, watch: bool, local: &str, remote: &str) {
let info_color = self.theme().misc_info_dialog; let info_color = self.theme().misc_info_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::WatcherPopup, Id::WatcherPopup,
Box::new(components::WatcherPopup::new( Box::new(components::WatcherPopup::new(
@@ -811,7 +837,8 @@ impl FileTransferActivity {
)), )),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::WatcherPopup).is_ok()); assert!(self.app.active(&Id::WatcherPopup).is_ok());
} }
@@ -821,14 +848,15 @@ impl FileTransferActivity {
pub(super) fn mount_watched_paths_list(&mut self, paths: &[std::path::PathBuf]) { pub(super) fn mount_watched_paths_list(&mut self, paths: &[std::path::PathBuf]) {
let info_color = self.theme().misc_info_dialog; let info_color = self.theme().misc_info_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::WatchedPathsList, Id::WatchedPathsList,
Box::new(components::WatchedPathsList::new(paths, info_color)), Box::new(components::WatchedPathsList::new(paths, info_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::WatchedPathsList).is_ok()); assert!(self.app.active(&Id::WatchedPathsList).is_ok());
} }
@@ -838,35 +866,38 @@ impl FileTransferActivity {
pub(super) fn mount_radio_replace(&mut self, file_name: &str) { pub(super) fn mount_radio_replace(&mut self, file_name: &str) {
let warn_color = self.theme().misc_warn_dialog; let warn_color = self.theme().misc_warn_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::ReplacePopup, Id::ReplacePopup,
Box::new(components::ReplacePopup::new(Some(file_name), warn_color)), Box::new(components::ReplacePopup::new(Some(file_name), warn_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::ReplacePopup).is_ok()); assert!(self.app.active(&Id::ReplacePopup).is_ok());
} }
pub(super) fn mount_radio_replace_many(&mut self, files: &[String]) { pub(super) fn mount_radio_replace_many(&mut self, files: &[String]) {
let warn_color = self.theme().misc_warn_dialog; let warn_color = self.theme().misc_warn_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::ReplacingFilesListPopup, Id::ReplacingFilesListPopup,
Box::new(components::ReplacingFilesListPopup::new(files, warn_color)), Box::new(components::ReplacingFilesListPopup::new(files, warn_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::ReplacePopup, Id::ReplacePopup,
Box::new(components::ReplacePopup::new(None, warn_color)), Box::new(components::ReplacePopup::new(None, warn_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::ReplacePopup).is_ok()); assert!(self.app.active(&Id::ReplacePopup).is_ok());
} }
@@ -881,14 +912,15 @@ impl FileTransferActivity {
} }
pub(super) fn mount_file_info(&mut self, file: &File) { pub(super) fn mount_file_info(&mut self, file: &File) {
assert!(self assert!(
.app self.app
.remount( .remount(
Id::FileInfoPopup, Id::FileInfoPopup,
Box::new(components::FileInfoPopup::new(file)), Box::new(components::FileInfoPopup::new(file)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::FileInfoPopup).is_ok()); assert!(self.app.active(&Id::FileInfoPopup).is_ok());
} }
@@ -899,8 +931,8 @@ impl FileTransferActivity {
pub(super) fn refresh_local_status_bar(&mut self) { pub(super) fn refresh_local_status_bar(&mut self) {
let sorting_color = self.theme().transfer_status_sorting; let sorting_color = self.theme().transfer_status_sorting;
let hidden_color = self.theme().transfer_status_hidden; let hidden_color = self.theme().transfer_status_hidden;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::StatusBarHostBridge, Id::StatusBarHostBridge,
Box::new(components::StatusBarLocal::new( Box::new(components::StatusBarLocal::new(
@@ -910,15 +942,16 @@ impl FileTransferActivity {
)), )),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn refresh_remote_status_bar(&mut self) { pub(super) fn refresh_remote_status_bar(&mut self) {
let sorting_color = self.theme().transfer_status_sorting; let sorting_color = self.theme().transfer_status_sorting;
let hidden_color = self.theme().transfer_status_hidden; let hidden_color = self.theme().transfer_status_hidden;
let sync_color = self.theme().transfer_status_sync_browsing; let sync_color = self.theme().transfer_status_sync_browsing;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::StatusBarRemote, Id::StatusBarRemote,
Box::new(components::StatusBarRemote::new( Box::new(components::StatusBarRemote::new(
@@ -929,19 +962,21 @@ impl FileTransferActivity {
)), )),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
} }
pub(super) fn mount_symlink(&mut self) { pub(super) fn mount_symlink(&mut self) {
let input_color = self.theme().misc_input_dialog; let input_color = self.theme().misc_input_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::SymlinkPopup, Id::SymlinkPopup,
Box::new(components::SymlinkPopup::new(input_color)), Box::new(components::SymlinkPopup::new(input_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::SymlinkPopup).is_ok()); assert!(self.app.active(&Id::SymlinkPopup).is_ok());
} }
@@ -951,14 +986,15 @@ impl FileTransferActivity {
pub(super) fn mount_sync_browsing_mkdir_popup(&mut self, dir_name: &str) { pub(super) fn mount_sync_browsing_mkdir_popup(&mut self, dir_name: &str) {
let color = self.theme().misc_info_dialog; let color = self.theme().misc_info_dialog;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::SyncBrowsingMkdirPopup, Id::SyncBrowsingMkdirPopup,
Box::new(components::SyncBrowsingMkdirPopup::new(color, dir_name,)), Box::new(components::SyncBrowsingMkdirPopup::new(color, dir_name,)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::SyncBrowsingMkdirPopup).is_ok()); assert!(self.app.active(&Id::SyncBrowsingMkdirPopup).is_ok());
} }
@@ -969,14 +1005,15 @@ impl FileTransferActivity {
/// Mount help /// Mount help
pub(super) fn mount_help(&mut self) { pub(super) fn mount_help(&mut self) {
let key_color = self.theme().misc_keys; let key_color = self.theme().misc_keys;
assert!(self assert!(
.app self.app
.remount( .remount(
Id::KeybindingsPopup, Id::KeybindingsPopup,
Box::new(components::KeybindingsPopup::new(key_color)), Box::new(components::KeybindingsPopup::new(key_color)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::KeybindingsPopup).is_ok()); assert!(self.app.active(&Id::KeybindingsPopup).is_ok());
} }
@@ -1018,8 +1055,8 @@ impl FileTransferActivity {
// -- global listener // -- global listener
fn mount_global_listener(&mut self) { fn mount_global_listener(&mut self) {
assert!(self assert!(
.app self.app
.mount( .mount(
Id::GlobalListener, Id::GlobalListener,
Box::<components::GlobalListener>::default(), Box::<components::GlobalListener>::default(),
@@ -1062,7 +1099,8 @@ impl FileTransferActivity {
Sub::new(SubEventClause::WindowResize, SubClause::Always) Sub::new(SubEventClause::WindowResize, SubClause::Always)
] ]
) )
.is_ok()); .is_ok()
);
} }
/// Returns a sub clause which requires that no popup is mounted in order to be satisfied /// Returns a sub clause which requires that no popup is mounted in order to be satisfied
+2
View File
@@ -135,7 +135,9 @@ impl SetupActivity {
_ => String::new(), _ => String::new(),
}; };
// Prepare text editor // Prepare text editor
unsafe {
env::set_var("EDITOR", self.config().get_text_editor()); env::set_var("EDITOR", self.config().get_text_editor());
}
let placeholder: String = format!("# Type private SSH key for {username}@{host}\n"); let placeholder: String = format!("# Type private SSH key for {username}@{host}\n");
// Put input mode back to normal // Put input mode back to normal
if let Err(err) = self.context_mut().terminal().disable_raw_mode() { if let Err(err) = self.context_mut().terminal().disable_raw_mode() {
+2
View File
@@ -59,7 +59,9 @@ impl SetupActivity {
None => Ok(()), None => Ok(()),
Some(ctx) => { Some(ctx) => {
// Set editor if config client exists // Set editor if config client exists
unsafe {
env::set_var("EDITOR", ctx.config().get_text_editor()); env::set_var("EDITOR", ctx.config().get_text_editor());
}
// Prepare terminal // Prepare terminal
if let Err(err) = ctx.terminal().disable_raw_mode() { if let Err(err) = ctx.terminal().disable_raw_mode() {
error!("Failed to disable raw mode: {}", err); error!("Failed to disable raw mode: {}", err);
+1 -1
View File
@@ -19,7 +19,7 @@ use tuirealm::listener::EventListenerCfg;
use tuirealm::props::Color; use tuirealm::props::Color;
use tuirealm::{Application, NoUserEvent, Update}; use tuirealm::{Application, NoUserEvent, Update};
use super::{Activity, Context, ExitReason, CROSSTERM_MAX_POLL}; use super::{Activity, CROSSTERM_MAX_POLL, Context, ExitReason};
use crate::config::themes::Theme; use crate::config::themes::Theme;
use crate::system::config_client::ConfigClient; use crate::system::config_client::ConfigClient;
use crate::system::theme_provider::ThemeProvider; use crate::system::theme_provider::ThemeProvider;
+96 -72
View File
@@ -103,10 +103,11 @@ impl SetupActivity {
fn config_update(&mut self, msg: ConfigMsg) -> Option<Msg> { fn config_update(&mut self, msg: ConfigMsg) -> Option<Msg> {
match msg { match msg {
ConfigMsg::CheckUpdatesBlurDown => { ConfigMsg::CheckUpdatesBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Config(IdConfig::PromptOnFileReplace)) .active(&Id::Config(IdConfig::PromptOnFileReplace))
.is_ok()); .is_ok()
);
} }
ConfigMsg::CheckUpdatesBlurUp => { ConfigMsg::CheckUpdatesBlurUp => {
assert!(self.app.active(&Id::Config(IdConfig::HiddenFiles)).is_ok()); assert!(self.app.active(&Id::Config(IdConfig::HiddenFiles)).is_ok());
@@ -121,49 +122,55 @@ impl SetupActivity {
assert!(self.app.active(&Id::Config(IdConfig::LocalFileFmt)).is_ok()); assert!(self.app.active(&Id::Config(IdConfig::LocalFileFmt)).is_ok());
} }
ConfigMsg::GroupDirsBlurUp => { ConfigMsg::GroupDirsBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Config(IdConfig::PromptOnFileReplace)) .active(&Id::Config(IdConfig::PromptOnFileReplace))
.is_ok()); .is_ok()
);
} }
ConfigMsg::HiddenFilesBlurDown => { ConfigMsg::HiddenFilesBlurDown => {
assert!(self.app.active(&Id::Config(IdConfig::CheckUpdates)).is_ok()); assert!(self.app.active(&Id::Config(IdConfig::CheckUpdates)).is_ok());
} }
ConfigMsg::HiddenFilesBlurUp => { ConfigMsg::HiddenFilesBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Config(IdConfig::DefaultProtocol)) .active(&Id::Config(IdConfig::DefaultProtocol))
.is_ok()); .is_ok()
);
} }
ConfigMsg::LocalFileFmtBlurDown => { ConfigMsg::LocalFileFmtBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Config(IdConfig::RemoteFileFmt)) .active(&Id::Config(IdConfig::RemoteFileFmt))
.is_ok()); .is_ok()
);
} }
ConfigMsg::LocalFileFmtBlurUp => { ConfigMsg::LocalFileFmtBlurUp => {
assert!(self.app.active(&Id::Config(IdConfig::GroupDirs)).is_ok()); assert!(self.app.active(&Id::Config(IdConfig::GroupDirs)).is_ok());
} }
ConfigMsg::NotificationsEnabledBlurDown => { ConfigMsg::NotificationsEnabledBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Config(IdConfig::NotificationsThreshold)) .active(&Id::Config(IdConfig::NotificationsThreshold))
.is_ok()); .is_ok()
);
} }
ConfigMsg::NotificationsEnabledBlurUp => { ConfigMsg::NotificationsEnabledBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Config(IdConfig::RemoteFileFmt)) .active(&Id::Config(IdConfig::RemoteFileFmt))
.is_ok()); .is_ok()
);
} }
ConfigMsg::NotificationsThresholdBlurDown => { ConfigMsg::NotificationsThresholdBlurDown => {
assert!(self.app.active(&Id::Config(IdConfig::SshConfig)).is_ok()); assert!(self.app.active(&Id::Config(IdConfig::SshConfig)).is_ok());
} }
ConfigMsg::NotificationsThresholdBlurUp => { ConfigMsg::NotificationsThresholdBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Config(IdConfig::NotificationsEnabled)) .active(&Id::Config(IdConfig::NotificationsEnabled))
.is_ok()); .is_ok()
);
} }
ConfigMsg::PromptOnFileReplaceBlurDown => { ConfigMsg::PromptOnFileReplaceBlurDown => {
assert!(self.app.active(&Id::Config(IdConfig::GroupDirs)).is_ok()); assert!(self.app.active(&Id::Config(IdConfig::GroupDirs)).is_ok());
@@ -172,19 +179,21 @@ impl SetupActivity {
assert!(self.app.active(&Id::Config(IdConfig::CheckUpdates)).is_ok()); assert!(self.app.active(&Id::Config(IdConfig::CheckUpdates)).is_ok());
} }
ConfigMsg::RemoteFileFmtBlurDown => { ConfigMsg::RemoteFileFmtBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Config(IdConfig::NotificationsEnabled)) .active(&Id::Config(IdConfig::NotificationsEnabled))
.is_ok()); .is_ok()
);
} }
ConfigMsg::RemoteFileFmtBlurUp => { ConfigMsg::RemoteFileFmtBlurUp => {
assert!(self.app.active(&Id::Config(IdConfig::LocalFileFmt)).is_ok()); assert!(self.app.active(&Id::Config(IdConfig::LocalFileFmt)).is_ok());
} }
ConfigMsg::TextEditorBlurDown => { ConfigMsg::TextEditorBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Config(IdConfig::DefaultProtocol)) .active(&Id::Config(IdConfig::DefaultProtocol))
.is_ok()); .is_ok()
);
} }
ConfigMsg::TextEditorBlurUp => { ConfigMsg::TextEditorBlurUp => {
assert!(self.app.active(&Id::Config(IdConfig::SshConfig)).is_ok()); assert!(self.app.active(&Id::Config(IdConfig::SshConfig)).is_ok());
@@ -193,10 +202,11 @@ impl SetupActivity {
assert!(self.app.active(&Id::Config(IdConfig::TextEditor)).is_ok()); assert!(self.app.active(&Id::Config(IdConfig::TextEditor)).is_ok());
} }
ConfigMsg::SshConfigBlurUp => { ConfigMsg::SshConfigBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Config(IdConfig::NotificationsThreshold)) .active(&Id::Config(IdConfig::NotificationsThreshold))
.is_ok()); .is_ok()
);
} }
ConfigMsg::ConfigChanged => { ConfigMsg::ConfigChanged => {
self.set_config_changed(true); self.set_config_changed(true);
@@ -259,10 +269,11 @@ impl SetupActivity {
assert!(self.app.active(&Id::Theme(IdTheme::AuthProtocol)).is_ok()); assert!(self.app.active(&Id::Theme(IdTheme::AuthProtocol)).is_ok());
} }
ThemeMsg::AuthBookmarksBlurDown => { ThemeMsg::AuthBookmarksBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::AuthRecentHosts)) .active(&Id::Theme(IdTheme::AuthRecentHosts))
.is_ok()); .is_ok()
);
} }
ThemeMsg::AuthBookmarksBlurUp => { ThemeMsg::AuthBookmarksBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::AuthPassword)).is_ok()); assert!(self.app.active(&Id::Theme(IdTheme::AuthPassword)).is_ok());
@@ -301,10 +312,11 @@ impl SetupActivity {
assert!(self.app.active(&Id::Theme(IdTheme::MiscInfo)).is_ok()); assert!(self.app.active(&Id::Theme(IdTheme::MiscInfo)).is_ok());
} }
ThemeMsg::MiscErrorBlurUp => { ThemeMsg::MiscErrorBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::AuthRecentHosts)) .active(&Id::Theme(IdTheme::AuthRecentHosts))
.is_ok()); .is_ok()
);
} }
ThemeMsg::MiscInfoBlurDown => { ThemeMsg::MiscInfoBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscInput)).is_ok()); assert!(self.app.active(&Id::Theme(IdTheme::MiscInput)).is_ok());
@@ -337,88 +349,100 @@ impl SetupActivity {
assert!(self.app.active(&Id::Theme(IdTheme::MiscQuit)).is_ok()); assert!(self.app.active(&Id::Theme(IdTheme::MiscQuit)).is_ok());
} }
ThemeMsg::MiscWarnBlurDown => { ThemeMsg::MiscWarnBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerLocalBg)) .active(&Id::Theme(IdTheme::ExplorerLocalBg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::MiscWarnBlurUp => { ThemeMsg::MiscWarnBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscSave)).is_ok()); assert!(self.app.active(&Id::Theme(IdTheme::MiscSave)).is_ok());
} }
ThemeMsg::ExplorerLocalBgBlurDown => { ThemeMsg::ExplorerLocalBgBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerLocalFg)) .active(&Id::Theme(IdTheme::ExplorerLocalFg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::ExplorerLocalBgBlurUp => { ThemeMsg::ExplorerLocalBgBlurUp => {
assert!(self.app.active(&Id::Theme(IdTheme::MiscWarn)).is_ok()); assert!(self.app.active(&Id::Theme(IdTheme::MiscWarn)).is_ok());
} }
ThemeMsg::ExplorerLocalFgBlurDown => { ThemeMsg::ExplorerLocalFgBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerLocalHg)) .active(&Id::Theme(IdTheme::ExplorerLocalHg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::ExplorerLocalFgBlurUp => { ThemeMsg::ExplorerLocalFgBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerLocalBg)) .active(&Id::Theme(IdTheme::ExplorerLocalBg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::ExplorerLocalHgBlurDown => { ThemeMsg::ExplorerLocalHgBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerRemoteBg)) .active(&Id::Theme(IdTheme::ExplorerRemoteBg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::ExplorerLocalHgBlurUp => { ThemeMsg::ExplorerLocalHgBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerLocalFg)) .active(&Id::Theme(IdTheme::ExplorerLocalFg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::ExplorerRemoteBgBlurDown => { ThemeMsg::ExplorerRemoteBgBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerRemoteFg)) .active(&Id::Theme(IdTheme::ExplorerRemoteFg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::ExplorerRemoteBgBlurUp => { ThemeMsg::ExplorerRemoteBgBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerLocalHg)) .active(&Id::Theme(IdTheme::ExplorerLocalHg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::ExplorerRemoteFgBlurDown => { ThemeMsg::ExplorerRemoteFgBlurDown => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerRemoteHg)) .active(&Id::Theme(IdTheme::ExplorerRemoteHg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::ExplorerRemoteFgBlurUp => { ThemeMsg::ExplorerRemoteFgBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerRemoteBg)) .active(&Id::Theme(IdTheme::ExplorerRemoteBg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::ExplorerRemoteHgBlurDown => { ThemeMsg::ExplorerRemoteHgBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::ProgBarFull)).is_ok()); assert!(self.app.active(&Id::Theme(IdTheme::ProgBarFull)).is_ok());
} }
ThemeMsg::ExplorerRemoteHgBlurUp => { ThemeMsg::ExplorerRemoteHgBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerRemoteFg)) .active(&Id::Theme(IdTheme::ExplorerRemoteFg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::ProgBarFullBlurDown => { ThemeMsg::ProgBarFullBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::ProgBarPartial)).is_ok()); assert!(self.app.active(&Id::Theme(IdTheme::ProgBarPartial)).is_ok());
} }
ThemeMsg::ProgBarFullBlurUp => { ThemeMsg::ProgBarFullBlurUp => {
assert!(self assert!(
.app self.app
.active(&Id::Theme(IdTheme::ExplorerRemoteHg)) .active(&Id::Theme(IdTheme::ExplorerRemoteHg))
.is_ok()); .is_ok()
);
} }
ThemeMsg::ProgBarPartialBlurDown => { ThemeMsg::ProgBarPartialBlurDown => {
assert!(self.app.active(&Id::Theme(IdTheme::LogBg)).is_ok()); assert!(self.app.active(&Id::Theme(IdTheme::LogBg)).is_ok());
+28 -21
View File
@@ -40,14 +40,15 @@ impl SetupActivity {
/// Mount error box /// Mount error box
pub(super) fn mount_error<S: AsRef<str>>(&mut self, text: S) { pub(super) fn mount_error<S: AsRef<str>>(&mut self, text: S) {
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Common(IdCommon::ErrorPopup), Id::Common(IdCommon::ErrorPopup),
Box::new(components::ErrorPopup::new(text)), Box::new(components::ErrorPopup::new(text)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::Common(IdCommon::ErrorPopup)).is_ok()); assert!(self.app.active(&Id::Common(IdCommon::ErrorPopup)).is_ok());
} }
@@ -58,14 +59,15 @@ impl SetupActivity {
/// Mount quit popup /// Mount quit popup
pub(super) fn mount_quit(&mut self) { pub(super) fn mount_quit(&mut self) {
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Common(IdCommon::QuitPopup), Id::Common(IdCommon::QuitPopup),
Box::<components::QuitPopup>::default(), Box::<components::QuitPopup>::default(),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::Common(IdCommon::QuitPopup)).is_ok()); assert!(self.app.active(&Id::Common(IdCommon::QuitPopup)).is_ok());
} }
@@ -76,14 +78,15 @@ impl SetupActivity {
/// Mount save popup /// Mount save popup
pub(super) fn mount_save_popup(&mut self) { pub(super) fn mount_save_popup(&mut self) {
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Common(IdCommon::SavePopup), Id::Common(IdCommon::SavePopup),
Box::<components::SavePopup>::default(), Box::<components::SavePopup>::default(),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::Common(IdCommon::SavePopup)).is_ok()); assert!(self.app.active(&Id::Common(IdCommon::SavePopup)).is_ok());
} }
@@ -94,14 +97,15 @@ impl SetupActivity {
/// Mount help /// Mount help
pub(super) fn mount_help(&mut self) { pub(super) fn mount_help(&mut self) {
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Common(IdCommon::Keybindings), Id::Common(IdCommon::Keybindings),
Box::<components::Keybindings>::default(), Box::<components::Keybindings>::default(),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::Common(IdCommon::Keybindings)).is_ok()); assert!(self.app.active(&Id::Common(IdCommon::Keybindings)).is_ok());
} }
@@ -144,29 +148,31 @@ impl SetupActivity {
/// Mount common components /// Mount common components
fn mount_commons(&mut self, layout: ViewLayout) { fn mount_commons(&mut self, layout: ViewLayout) {
// Radio tab // Radio tab
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Common(IdCommon::Header), Id::Common(IdCommon::Header),
Box::new(components::Header::new(layout)), Box::new(components::Header::new(layout)),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
// Footer // Footer
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Common(IdCommon::Footer), Id::Common(IdCommon::Footer),
Box::<components::Footer>::default(), Box::<components::Footer>::default(),
vec![], vec![],
) )
.is_ok()); .is_ok()
);
} }
/// Mount global listener /// Mount global listener
fn mount_global_listener(&mut self) { fn mount_global_listener(&mut self) {
assert!(self assert!(
.app self.app
.mount( .mount(
Id::Common(IdCommon::GlobalListener), Id::Common(IdCommon::GlobalListener),
Box::<components::GlobalListener>::default(), Box::<components::GlobalListener>::default(),
@@ -230,7 +236,8 @@ impl SetupActivity {
Sub::new(SubEventClause::WindowResize, SubClause::Always) Sub::new(SubEventClause::WindowResize, SubClause::Always)
] ]
) )
.is_ok()); .is_ok()
);
} }
/// Returns a sub clause which requires that no popup is mounted in order to be satisfied /// Returns a sub clause which requires that no popup is mounted in order to be satisfied
+46 -35
View File
@@ -11,8 +11,8 @@ use tuirealm::ratatui::layout::{Constraint, Direction, Layout};
use tuirealm::{State, StateValue}; use tuirealm::{State, StateValue};
use super::{ use super::{
components, Context, Id, IdCommon, IdConfig, SetupActivity, ViewLayout, RADIO_PROTOCOL_KUBE, Context, Id, IdCommon, IdConfig, RADIO_PROTOCOL_KUBE, RADIO_PROTOCOL_WEBDAV, SetupActivity,
RADIO_PROTOCOL_WEBDAV, ViewLayout, components,
}; };
use crate::explorer::GroupDirs; use crate::explorer::GroupDirs;
use crate::filetransfer::FileTransferProtocol; use crate::filetransfer::FileTransferProtocol;
@@ -145,17 +145,18 @@ impl SetupActivity {
// Text editor // Text editor
let text_editor: String = let text_editor: String =
String::from(self.config().get_text_editor().as_path().to_string_lossy()); String::from(self.config().get_text_editor().as_path().to_string_lossy());
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Config(IdConfig::TextEditor), Id::Config(IdConfig::TextEditor),
Box::new(components::TextEditor::new(text_editor.as_str())), Box::new(components::TextEditor::new(text_editor.as_str())),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Protocol // Protocol
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Config(IdConfig::DefaultProtocol), Id::Config(IdConfig::DefaultProtocol),
Box::new(components::DefaultProtocol::new( Box::new(components::DefaultProtocol::new(
@@ -163,10 +164,11 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Hidden files // Hidden files
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Config(IdConfig::HiddenFiles), Id::Config(IdConfig::HiddenFiles),
Box::new(components::HiddenFiles::new( Box::new(components::HiddenFiles::new(
@@ -174,10 +176,11 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Updates // Updates
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Config(IdConfig::CheckUpdates), Id::Config(IdConfig::CheckUpdates),
Box::new(components::CheckUpdates::new( Box::new(components::CheckUpdates::new(
@@ -185,10 +188,11 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// File replace // File replace
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Config(IdConfig::PromptOnFileReplace), Id::Config(IdConfig::PromptOnFileReplace),
Box::new(components::PromptOnFileReplace::new( Box::new(components::PromptOnFileReplace::new(
@@ -196,19 +200,21 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Group dirs // Group dirs
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Config(IdConfig::GroupDirs), Id::Config(IdConfig::GroupDirs),
Box::new(components::GroupDirs::new(self.config().get_group_dirs())), Box::new(components::GroupDirs::new(self.config().get_group_dirs())),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Local File Fmt // Local File Fmt
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Config(IdConfig::LocalFileFmt), Id::Config(IdConfig::LocalFileFmt),
Box::new(components::LocalFileFmt::new( Box::new(components::LocalFileFmt::new(
@@ -216,10 +222,11 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Remote File Fmt // Remote File Fmt
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Config(IdConfig::RemoteFileFmt), Id::Config(IdConfig::RemoteFileFmt),
Box::new(components::RemoteFileFmt::new( Box::new(components::RemoteFileFmt::new(
@@ -227,10 +234,11 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Notifications enabled // Notifications enabled
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Config(IdConfig::NotificationsEnabled), Id::Config(IdConfig::NotificationsEnabled),
Box::new(components::NotificationsEnabled::new( Box::new(components::NotificationsEnabled::new(
@@ -238,10 +246,11 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Notifications threshold // Notifications threshold
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Config(IdConfig::NotificationsThreshold), Id::Config(IdConfig::NotificationsThreshold),
Box::new(components::NotificationsThreshold::new(&fmt_bytes( Box::new(components::NotificationsThreshold::new(&fmt_bytes(
@@ -249,10 +258,11 @@ impl SetupActivity {
))), ))),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
// Ssh config // Ssh config
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Config(IdConfig::SshConfig), Id::Config(IdConfig::SshConfig),
Box::new(components::SshConfig::new( Box::new(components::SshConfig::new(
@@ -260,7 +270,8 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
/// Collect values from input and put them into the configuration /// Collect values from input and put them into the configuration
+17 -13
View File
@@ -8,7 +8,7 @@
use tuirealm::ratatui::layout::{Constraint, Direction, Layout}; use tuirealm::ratatui::layout::{Constraint, Direction, Layout};
use tuirealm::ratatui::widgets::Clear; use tuirealm::ratatui::widgets::Clear;
use super::{components, Context, Id, IdCommon, IdSsh, SetupActivity, ViewLayout}; use super::{Context, Id, IdCommon, IdSsh, SetupActivity, ViewLayout, components};
use crate::utils::ui::{Popup, Size}; use crate::utils::ui::{Popup, Size};
impl SetupActivity { impl SetupActivity {
@@ -74,14 +74,15 @@ impl SetupActivity {
/// Mount delete ssh key component /// Mount delete ssh key component
pub(crate) fn mount_del_ssh_key(&mut self) { pub(crate) fn mount_del_ssh_key(&mut self) {
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Ssh(IdSsh::DelSshKeyPopup), Id::Ssh(IdSsh::DelSshKeyPopup),
Box::<components::DelSshKeyPopup>::default(), Box::<components::DelSshKeyPopup>::default(),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::Ssh(IdSsh::DelSshKeyPopup)).is_ok()); assert!(self.app.active(&Id::Ssh(IdSsh::DelSshKeyPopup)).is_ok());
} }
@@ -92,22 +93,24 @@ impl SetupActivity {
/// Mount new ssh key prompt /// Mount new ssh key prompt
pub(crate) fn mount_new_ssh_key(&mut self) { pub(crate) fn mount_new_ssh_key(&mut self) {
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Ssh(IdSsh::SshHost), Id::Ssh(IdSsh::SshHost),
Box::<components::SshHost>::default(), Box::<components::SshHost>::default(),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Ssh(IdSsh::SshUsername), Id::Ssh(IdSsh::SshUsername),
Box::<components::SshUsername>::default(), Box::<components::SshUsername>::default(),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::Ssh(IdSsh::SshHost)).is_ok()); assert!(self.app.active(&Id::Ssh(IdSsh::SshHost)).is_ok());
} }
@@ -127,14 +130,15 @@ impl SetupActivity {
format!("{username} at {addr}") format!("{username} at {addr}")
}) })
.collect(); .collect();
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Ssh(IdSsh::SshKeys), Id::Ssh(IdSsh::SshKeys),
Box::new(components::SshKeys::new(&keys)), Box::new(components::SshKeys::new(&keys)),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
assert!(self.app.active(&Id::Ssh(IdSsh::SshKeys)).is_ok()); assert!(self.app.active(&Id::Ssh(IdSsh::SshKeys)).is_ok());
} }
} }
+125 -94
View File
@@ -7,7 +7,7 @@
// Ext // Ext
use tuirealm::ratatui::layout::{Constraint, Direction, Layout}; use tuirealm::ratatui::layout::{Constraint, Direction, Layout};
use super::{components, Context, Id, IdCommon, IdTheme, SetupActivity, Theme, ViewLayout}; use super::{Context, Id, IdCommon, IdTheme, SetupActivity, Theme, ViewLayout, components};
impl SetupActivity { impl SetupActivity {
// -- view // -- view
@@ -242,157 +242,175 @@ impl SetupActivity {
} }
fn load_titles(&mut self) { fn load_titles(&mut self) {
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Theme(IdTheme::AuthTitle), Id::Theme(IdTheme::AuthTitle),
Box::<components::AuthTitle>::default(), Box::<components::AuthTitle>::default(),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::MiscTitle), Id::Theme(IdTheme::MiscTitle),
Box::<components::MiscTitle>::default(), Box::<components::MiscTitle>::default(),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::TransferTitle), Id::Theme(IdTheme::TransferTitle),
Box::<components::TransferTitle>::default(), Box::<components::TransferTitle>::default(),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::TransferTitle2), Id::Theme(IdTheme::TransferTitle2),
Box::<components::TransferTitle2>::default(), Box::<components::TransferTitle2>::default(),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
/// Load values from theme into input fields /// Load values from theme into input fields
pub(crate) fn load_styles(&mut self) { pub(crate) fn load_styles(&mut self) {
let theme: Theme = self.theme().clone(); let theme: Theme = self.theme().clone();
assert!(self assert!(
.app self.app
.remount( .remount(
Id::Theme(IdTheme::AuthAddress), Id::Theme(IdTheme::AuthAddress),
Box::new(components::AuthAddress::new(theme.auth_address)), Box::new(components::AuthAddress::new(theme.auth_address)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::AuthBookmarks), Id::Theme(IdTheme::AuthBookmarks),
Box::new(components::AuthBookmarks::new(theme.auth_bookmarks)), Box::new(components::AuthBookmarks::new(theme.auth_bookmarks)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::AuthPassword), Id::Theme(IdTheme::AuthPassword),
Box::new(components::AuthPassword::new(theme.auth_password)), Box::new(components::AuthPassword::new(theme.auth_password)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::AuthPort), Id::Theme(IdTheme::AuthPort),
Box::new(components::AuthPort::new(theme.auth_port)), Box::new(components::AuthPort::new(theme.auth_port)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::AuthProtocol), Id::Theme(IdTheme::AuthProtocol),
Box::new(components::AuthProtocol::new(theme.auth_protocol)), Box::new(components::AuthProtocol::new(theme.auth_protocol)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::AuthRecentHosts), Id::Theme(IdTheme::AuthRecentHosts),
Box::new(components::AuthRecentHosts::new(theme.auth_recents)), Box::new(components::AuthRecentHosts::new(theme.auth_recents)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::AuthUsername), Id::Theme(IdTheme::AuthUsername),
Box::new(components::AuthUsername::new(theme.auth_username)), Box::new(components::AuthUsername::new(theme.auth_username)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::MiscError), Id::Theme(IdTheme::MiscError),
Box::new(components::MiscError::new(theme.misc_error_dialog)), Box::new(components::MiscError::new(theme.misc_error_dialog)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::MiscInfo), Id::Theme(IdTheme::MiscInfo),
Box::new(components::MiscInfo::new(theme.misc_info_dialog)), Box::new(components::MiscInfo::new(theme.misc_info_dialog)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::MiscInput), Id::Theme(IdTheme::MiscInput),
Box::new(components::MiscInput::new(theme.misc_input_dialog)), Box::new(components::MiscInput::new(theme.misc_input_dialog)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::MiscKeys), Id::Theme(IdTheme::MiscKeys),
Box::new(components::MiscKeys::new(theme.misc_keys)), Box::new(components::MiscKeys::new(theme.misc_keys)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::MiscQuit), Id::Theme(IdTheme::MiscQuit),
Box::new(components::MiscQuit::new(theme.misc_quit_dialog)), Box::new(components::MiscQuit::new(theme.misc_quit_dialog)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::MiscSave), Id::Theme(IdTheme::MiscSave),
Box::new(components::MiscSave::new(theme.misc_save_dialog)), Box::new(components::MiscSave::new(theme.misc_save_dialog)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::MiscWarn), Id::Theme(IdTheme::MiscWarn),
Box::new(components::MiscWarn::new(theme.misc_warn_dialog)), Box::new(components::MiscWarn::new(theme.misc_warn_dialog)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::ExplorerLocalBg), Id::Theme(IdTheme::ExplorerLocalBg),
Box::new(components::ExplorerLocalBg::new( Box::new(components::ExplorerLocalBg::new(
@@ -400,9 +418,10 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::ExplorerLocalFg), Id::Theme(IdTheme::ExplorerLocalFg),
Box::new(components::ExplorerLocalFg::new( Box::new(components::ExplorerLocalFg::new(
@@ -410,9 +429,10 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::ExplorerLocalHg), Id::Theme(IdTheme::ExplorerLocalHg),
Box::new(components::ExplorerLocalHg::new( Box::new(components::ExplorerLocalHg::new(
@@ -420,9 +440,10 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::ExplorerRemoteBg), Id::Theme(IdTheme::ExplorerRemoteBg),
Box::new(components::ExplorerRemoteBg::new( Box::new(components::ExplorerRemoteBg::new(
@@ -430,9 +451,10 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::ExplorerRemoteFg), Id::Theme(IdTheme::ExplorerRemoteFg),
Box::new(components::ExplorerRemoteFg::new( Box::new(components::ExplorerRemoteFg::new(
@@ -440,9 +462,10 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::ExplorerRemoteHg), Id::Theme(IdTheme::ExplorerRemoteHg),
Box::new(components::ExplorerRemoteHg::new( Box::new(components::ExplorerRemoteHg::new(
@@ -450,9 +473,10 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::ProgBarFull), Id::Theme(IdTheme::ProgBarFull),
Box::new(components::ProgBarFull::new( Box::new(components::ProgBarFull::new(
@@ -460,9 +484,10 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::ProgBarPartial), Id::Theme(IdTheme::ProgBarPartial),
Box::new(components::ProgBarPartial::new( Box::new(components::ProgBarPartial::new(
@@ -470,25 +495,28 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::LogBg), Id::Theme(IdTheme::LogBg),
Box::new(components::LogBg::new(theme.transfer_log_background)), Box::new(components::LogBg::new(theme.transfer_log_background)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::LogWindow), Id::Theme(IdTheme::LogWindow),
Box::new(components::LogWindow::new(theme.transfer_log_window)), Box::new(components::LogWindow::new(theme.transfer_log_window)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::StatusSorting), Id::Theme(IdTheme::StatusSorting),
Box::new(components::StatusSorting::new( Box::new(components::StatusSorting::new(
@@ -496,17 +524,19 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::StatusHidden), Id::Theme(IdTheme::StatusHidden),
Box::new(components::StatusHidden::new(theme.transfer_status_hidden)), Box::new(components::StatusHidden::new(theme.transfer_status_hidden)),
vec![] vec![]
) )
.is_ok()); .is_ok()
assert!(self );
.app assert!(
self.app
.remount( .remount(
Id::Theme(IdTheme::StatusSync), Id::Theme(IdTheme::StatusSync),
Box::new(components::StatusSync::new( Box::new(components::StatusSync::new(
@@ -514,6 +544,7 @@ impl SetupActivity {
)), )),
vec![] vec![]
) )
.is_ok()); .is_ok()
);
} }
} }
+4 -3
View File
@@ -3,12 +3,13 @@
//! `random` is the module which provides utilities for rand //! `random` is the module which provides utilities for rand
// Ext // Ext
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng}; use rand::distr::Alphanumeric;
use rand::{Rng, rng};
/// Generate a random alphanumeric string with provided length /// Generate a random alphanumeric string with provided length
pub fn random_alphanumeric_with_len(len: usize) -> String { pub fn random_alphanumeric_with_len(len: usize) -> String {
let mut rng = thread_rng(); let mut rng = rng();
std::iter::repeat(()) std::iter::repeat(())
.map(|()| rng.sample(Alphanumeric)) .map(|()| rng.sample(Alphanumeric))
.map(char::from) .map(char::from)
+7 -3
View File
@@ -20,7 +20,9 @@ mod test {
#[test] #[test]
fn should_parse_ssh2_config() { fn should_parse_ssh2_config() {
let rsa_key = test_helpers::create_sample_file_with_content("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDErJhQxEI0+VvhlXVUyh+vMCm7aXfCA/g633AG8ezD/5EylwchtAr2JCoBWnxn4zV8nI9dMqOgm0jO4IsXpKOjQojv+0VOH7I+cDlBg0tk4hFlvyyS6YviDAfDDln3jYUM+5QNDfQLaZlH2WvcJ3mkDxLVlI9MBX1BAeSmChLxwAvxALp2ncImNQLzDO9eHcig3dtMrEKkzXQowRW5Y7eUzg2+vvVq4H2DOjWwUndvB5sJkhEfTUVE7ID8ZdGJo60kUb/02dZYj+IbkAnMCsqktk0cg/4XFX82hEfRYFeb1arkysFisPU1DOb6QielL/axeTebVplaouYcXY0pFdJt root@8c50fd4c345a"); let rsa_key = test_helpers::create_sample_file_with_content(
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDErJhQxEI0+VvhlXVUyh+vMCm7aXfCA/g633AG8ezD/5EylwchtAr2JCoBWnxn4zV8nI9dMqOgm0jO4IsXpKOjQojv+0VOH7I+cDlBg0tk4hFlvyyS6YviDAfDDln3jYUM+5QNDfQLaZlH2WvcJ3mkDxLVlI9MBX1BAeSmChLxwAvxALp2ncImNQLzDO9eHcig3dtMrEKkzXQowRW5Y7eUzg2+vvVq4H2DOjWwUndvB5sJkhEfTUVE7ID8ZdGJo60kUb/02dZYj+IbkAnMCsqktk0cg/4XFX82hEfRYFeb1arkysFisPU1DOb6QielL/axeTebVplaouYcXY0pFdJt root@8c50fd4c345a",
);
let ssh_config_file = test_helpers::create_sample_file_with_content(format!( let ssh_config_file = test_helpers::create_sample_file_with_content(format!(
r#" r#"
Host test Host test
@@ -34,13 +36,15 @@ Host test
rsa_key.path().display() rsa_key.path().display()
)); ));
assert!(parse_ssh2_config( assert!(
parse_ssh2_config(
ssh_config_file ssh_config_file
.path() .path()
.to_string_lossy() .to_string_lossy()
.to_string() .to_string()
.as_str() .as_str()
) )
.is_ok()); .is_ok()
);
} }
} }
+3 -1
View File
@@ -24,7 +24,9 @@ pub fn create_sample_file_entry() -> (File, NamedTempFile) {
/// Create sample file with default lorem ipsum content /// Create sample file with default lorem ipsum content
pub fn create_sample_file() -> NamedTempFile { pub fn create_sample_file() -> NamedTempFile {
create_sample_file_with_content("Lorem ipsum dolor sit amet, consectetur adipiscing elit.Mauris ultricies consequat eros,nec scelerisque magna imperdiet metus.") create_sample_file_with_content(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.Mauris ultricies consequat eros,nec scelerisque magna imperdiet metus.",
)
} }
/// Create sample file with provided content /// Create sample file with provided content
+4 -4
View File
@@ -65,9 +65,9 @@ mod tests {
fn test_utils_ui_draw_area_in() { fn test_utils_ui_draw_area_in() {
let area: Rect = Rect::new(0, 0, 1024, 512); let area: Rect = Rect::new(0, 0, 1024, 512);
let child: Rect = Popup(Size::Percentage(75), Size::Percentage(30)).draw_in(area); let child: Rect = Popup(Size::Percentage(75), Size::Percentage(30)).draw_in(area);
assert_eq!(child.x, 43); assert_eq!(child.x, 123);
assert_eq!(child.y, 63); assert_eq!(child.y, 179);
assert_eq!(child.width, 272); assert_eq!(child.width, 768);
assert_eq!(child.height, 55); assert_eq!(child.height, 154);
} }
} }