build: migrate to tui-realm 4.0

Upgrade tuirealm (3.x -> 4.0.0), tui-realm-stdlib (3 -> 4), tui-term
(0.2 -> 0.3). Apply all breaking changes from the 4.0 migration guide
across the termscp UI.

Key changes:

- Root-level re-exports removed; imports moved to module-qualified
  paths (`tuirealm::application`, `::component`, `::event`, `::props`,
  `::state`, `::subscription`, `::listener`, `::ratatui`). Same for
  stdlib component types (`tui_realm_stdlib::components::*`).
- `MockComponent` trait renamed to `Component`; old `Component` trait
  renamed to `AppComponent`. `#[derive(MockComponent)]` is now
  `#[derive(Component)]`. `Component::on` now takes `&Event<_>`.
- `TextSpan` replaced with `SpanStatic`/`LineStatic`/`TextStatic`
  (ratatui-based); tuple `(String, Alignment)` titles replaced with
  the new `Title` builder; `Alignment` split into
  `HorizontalAlignment`/`VerticalAlignment`; stdlib components use
  `.alignment_horizontal` instead of `.alignment`.
- `State::One`/`PropPayload::One` -> `Single`. `CmdResult::None`
  -> `NoChange`. `Props::get_or` removed; `Props::get` now returns a
  borrowed `Option<&AttrValue>` (call sites switched to
  `.and_then(AttrValue::as_*)`). `Component::query` returns
  `Option<QueryResult<'a>>`.
- `Attribute::HighlightedColor` -> `HighlightStyle` (a full `Style`).
  `.highlighted_*` helpers renamed to `.highlight_*`.
- `PollStrategy::UpTo(n)` now requires a `Duration`; tick timeout moved
  from `EventListenerCfg::poll_timeout` into `PollStrategy`.
- `TerminalBridge` removed; `Context` now holds
  `CrosstermTerminalAdapter` directly and enables raw mode + alternate
  screen explicitly. The `TerminalAdapter` trait is imported where its
  methods are used.
- `Update` trait removed; activity `update` methods are plain inherent
  functions.
- `ProgressBar` replaced by stdlib `Gauge`. Paragraph `.wrap` renamed
  to `.wrap_trim`; `.text` now takes an `Into<Text>`. Stdlib `List` row
  items are now individual lines (`Vec<Span>` per row) rather than a
  `Table` of spans; custom `FileList`/`Log` convert between the two
  models.
- Radio builders drop `.foreground(color)` so unselected items render
  with the terminal default foreground, and set
  `highlight_style(Style::default().fg(color).add_modifier(REVERSED))`
  so the selected entry is visibly highlighted only with the theme
  color.
- Custom `FileList` keeps the selected row highlighted with the full
  highlight style when focused and falls back to a foreground-only
  style when unfocused.
- Theme loading is now backwards compatible: `Theme` uses a custom
  `Deserialize` through an intermediate `ThemeFile` with optional
  fields, so missing keys, unknown values or legacy aliases
  (`transfer_progress_bar_full`/`_partial`) fall back to defaults on a
  per-field basis instead of failing the whole load.
This commit is contained in:
Christian Visintin
2026-04-19 01:54:46 +05:30
parent 9160c52cb0
commit 6252df2959
78 changed files with 2127 additions and 1588 deletions
@@ -1,9 +1,9 @@
use tuirealm::component::{AppComponent, Component};
use tuirealm::event::NoUserEvent;
use tuirealm::{Component, MockComponent};
use super::*;
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputAddress {
component: Input,
form_tab: FormTab,
@@ -19,8 +19,11 @@ impl InputAddress {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("127.0.0.1", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Remote host", Alignment::Left)
.placeholder(tuirealm::props::SpanStatic::styled(
"127.0.0.1",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(Title::from("Remote host").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(host),
form_tab,
@@ -28,8 +31,8 @@ impl InputAddress {
}
}
impl Component<Msg, NoUserEvent> for InputAddress {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputAddress {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::AddressBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::AddressBlurDown)),
@@ -44,7 +47,7 @@ impl Component<Msg, NoUserEvent> for InputAddress {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputPort {
component: Input,
form_tab: FormTab,
@@ -60,18 +63,21 @@ impl InputPort {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("22", Style::default().fg(Color::Rgb(128, 128, 128)))
.placeholder(tuirealm::props::SpanStatic::styled(
"22",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.input_type(InputType::UnsignedInteger)
.input_len(5)
.title("Port number", Alignment::Left)
.title(Title::from("Port number").alignment(HorizontalAlignment::Left))
.value(port.to_string()),
form_tab,
}
}
}
impl Component<Msg, NoUserEvent> for InputPort {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputPort {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::PortBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::PortBlurDown)),
@@ -86,7 +92,7 @@ impl Component<Msg, NoUserEvent> for InputPort {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputUsername {
component: Input,
form_tab: FormTab,
@@ -102,8 +108,11 @@ impl InputUsername {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("root", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Username", Alignment::Left)
.placeholder(tuirealm::props::SpanStatic::styled(
"root",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(Title::from("Username").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(username),
form_tab,
@@ -111,8 +120,8 @@ impl InputUsername {
}
}
impl Component<Msg, NoUserEvent> for InputUsername {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputUsername {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::UsernameBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::UsernameBlurDown)),
@@ -127,7 +136,7 @@ impl Component<Msg, NoUserEvent> for InputUsername {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputPassword {
component: Input,
form_tab: FormTab,
@@ -143,7 +152,7 @@ impl InputPassword {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.title("Password", Alignment::Left)
.title(Title::from("Password").alignment(HorizontalAlignment::Left))
.input_type(InputType::Password('*'))
.value(password),
form_tab,
@@ -151,8 +160,8 @@ impl InputPassword {
}
}
impl Component<Msg, NoUserEvent> for InputPassword {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputPassword {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::PasswordBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::PasswordBlurDown)),
+40 -26
View File
@@ -1,9 +1,9 @@
use tuirealm::component::{AppComponent, Component};
use tuirealm::event::NoUserEvent;
use tuirealm::{Component, MockComponent};
use super::*;
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputKubeNamespace {
component: Input,
form_tab: FormTab,
@@ -19,8 +19,11 @@ impl InputKubeNamespace {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("namespace", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Pod namespace (optional)", Alignment::Left)
.placeholder(tuirealm::props::SpanStatic::styled(
"namespace",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(Title::from("Pod namespace (optional)").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(bucket),
form_tab,
@@ -28,8 +31,8 @@ impl InputKubeNamespace {
}
}
impl Component<Msg, NoUserEvent> for InputKubeNamespace {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputKubeNamespace {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::KubeNamespaceBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::KubeNamespaceBlurDown)),
@@ -44,7 +47,7 @@ impl Component<Msg, NoUserEvent> for InputKubeNamespace {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputKubeClusterUrl {
component: Input,
form_tab: FormTab,
@@ -60,11 +63,13 @@ impl InputKubeClusterUrl {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder(
.placeholder(tuirealm::props::SpanStatic::styled(
"cluster url",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(
Title::from("Kube cluster url (optional)").alignment(HorizontalAlignment::Left),
)
.title("Kube cluster url (optional)", Alignment::Left)
.input_type(InputType::Text)
.value(bucket),
form_tab,
@@ -72,8 +77,8 @@ impl InputKubeClusterUrl {
}
}
impl Component<Msg, NoUserEvent> for InputKubeClusterUrl {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputKubeClusterUrl {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::KubeClusterUrlBlurDown)),
FormTab::HostBridge => {
@@ -90,7 +95,7 @@ impl Component<Msg, NoUserEvent> for InputKubeClusterUrl {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputKubeUsername {
component: Input,
form_tab: FormTab,
@@ -106,8 +111,11 @@ impl InputKubeUsername {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("username", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Kube username (optional)", Alignment::Left)
.placeholder(tuirealm::props::SpanStatic::styled(
"username",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(Title::from("Kube username (optional)").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(bucket),
form_tab,
@@ -115,8 +123,8 @@ impl InputKubeUsername {
}
}
impl Component<Msg, NoUserEvent> for InputKubeUsername {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputKubeUsername {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::KubeUsernameBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::KubeUsernameBlurDown)),
@@ -131,7 +139,7 @@ impl Component<Msg, NoUserEvent> for InputKubeUsername {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputKubeClientCert {
component: Input,
form_tab: FormTab,
@@ -147,11 +155,14 @@ impl InputKubeClientCert {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder(
.placeholder(tuirealm::props::SpanStatic::styled(
"/home/user/.kube/client.crt",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(
Title::from("Kube client cert path (optional)")
.alignment(HorizontalAlignment::Left),
)
.title("Kube client cert path (optional)", Alignment::Left)
.input_type(InputType::Text)
.value(bucket),
form_tab,
@@ -159,8 +170,8 @@ impl InputKubeClientCert {
}
}
impl Component<Msg, NoUserEvent> for InputKubeClientCert {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputKubeClientCert {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::KubeClientCertBlurDown)),
FormTab::HostBridge => {
@@ -177,7 +188,7 @@ impl Component<Msg, NoUserEvent> for InputKubeClientCert {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputKubeClientKey {
component: Input,
form_tab: FormTab,
@@ -193,11 +204,14 @@ impl InputKubeClientKey {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder(
.placeholder(tuirealm::props::SpanStatic::styled(
"/home/user/.kube/client.key",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(
Title::from("Kube client key path (optional)")
.alignment(HorizontalAlignment::Left),
)
.title("Kube client key path (optional)", Alignment::Left)
.input_type(InputType::Text)
.value(bucket),
form_tab,
@@ -205,8 +219,8 @@ impl InputKubeClientKey {
}
}
impl Component<Msg, NoUserEvent> for InputKubeClientKey {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputKubeClientKey {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::KubeClientKeyBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::KubeClientKeyBlurDown)),
+23 -11
View File
@@ -1,9 +1,9 @@
use tuirealm::component::{AppComponent, Component};
use tuirealm::event::NoUserEvent;
use tuirealm::{Component, MockComponent};
use super::*;
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputRemoteDirectory {
component: Input,
form_tab: FormTab,
@@ -19,8 +19,14 @@ impl InputRemoteDirectory {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("/home/foo", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Default remote working directory", Alignment::Left)
.placeholder(tuirealm::props::SpanStatic::styled(
"/home/foo",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(
Title::from("Default remote working directory")
.alignment(HorizontalAlignment::Left),
)
.input_type(InputType::Text)
.value(remote_dir),
form_tab,
@@ -28,8 +34,8 @@ impl InputRemoteDirectory {
}
}
impl Component<Msg, NoUserEvent> for InputRemoteDirectory {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputRemoteDirectory {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::RemoteDirectoryBlurDown)),
FormTab::HostBridge => {
@@ -46,7 +52,7 @@ impl Component<Msg, NoUserEvent> for InputRemoteDirectory {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputLocalDirectory {
component: Input,
form_tab: FormTab,
@@ -62,8 +68,14 @@ impl InputLocalDirectory {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("/home/foo", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Default local working directory", Alignment::Left)
.placeholder(tuirealm::props::SpanStatic::styled(
"/home/foo",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(
Title::from("Default local working directory")
.alignment(HorizontalAlignment::Left),
)
.input_type(InputType::Text)
.value(local_dir),
form_tab,
@@ -71,8 +83,8 @@ impl InputLocalDirectory {
}
}
impl Component<Msg, NoUserEvent> for InputLocalDirectory {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputLocalDirectory {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::LocalDirectoryBlurDown)),
FormTab::HostBridge => {
@@ -1,11 +1,14 @@
use tuirealm::command::{Cmd, CmdResult, Direction};
use tuirealm::component::{AppComponent, Component};
use tuirealm::event::{Event, Key, KeyEvent, NoUserEvent};
use tuirealm::props::{Alignment, BorderType, Borders, Color};
use tuirealm::{Component, MockComponent, State, StateValue};
use tuirealm::props::{
BorderType, Borders, Color, HorizontalAlignment, Style, TextModifiers, Title,
};
use tuirealm::state::{State, StateValue};
use super::*;
#[derive(MockComponent)]
#[derive(Component)]
pub struct RemoteProtocolRadio {
component: Radio,
}
@@ -14,6 +17,11 @@ impl RemoteProtocolRadio {
pub fn new(default_protocol: FileTransferProtocol, color: Color) -> Self {
Self {
component: Radio::default()
.highlight_style(
Style::default()
.fg(color)
.add_modifier(TextModifiers::REVERSED),
)
.borders(
Borders::default()
.color(color)
@@ -24,9 +32,8 @@ impl RemoteProtocolRadio {
} else {
vec!["SFTP", "SCP", "FTP", "FTPS", "S3", "Kube", "WebDAV"].into_iter()
})
.foreground(color)
.rewind(true)
.title("Protocol", Alignment::Left)
.title(Title::from("Protocol").alignment(HorizontalAlignment::Left))
.value(Self::protocol_enum_to_opt(default_protocol)),
}
}
@@ -58,8 +65,8 @@ impl RemoteProtocolRadio {
}
}
impl Component<Msg, NoUserEvent> for RemoteProtocolRadio {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for RemoteProtocolRadio {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let result = match ev {
Event::Keyboard(KeyEvent {
code: Key::Left, ..
@@ -86,7 +93,7 @@ impl Component<Msg, NoUserEvent> for RemoteProtocolRadio {
};
match result {
CmdResult::Changed(State::One(StateValue::Usize(choice))) => Some(Msg::Form(
CmdResult::Changed(State::Single(StateValue::Usize(choice))) => Some(Msg::Form(
FormMsg::RemoteProtocolChanged(Self::protocol_opt_to_enum(choice)),
)),
_ => Some(Msg::None),
@@ -94,7 +101,7 @@ impl Component<Msg, NoUserEvent> for RemoteProtocolRadio {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct HostBridgeProtocolRadio {
component: Radio,
}
@@ -103,6 +110,11 @@ impl HostBridgeProtocolRadio {
pub fn new(protocol: HostBridgeProtocol, color: Color) -> Self {
Self {
component: Radio::default()
.highlight_style(
Style::default()
.fg(color)
.add_modifier(TextModifiers::REVERSED),
)
.borders(
Borders::default()
.color(color)
@@ -134,9 +146,8 @@ impl HostBridgeProtocolRadio {
]
.into_iter()
})
.foreground(color)
.rewind(true)
.title("Host type", Alignment::Left)
.title(Title::from("Host type").alignment(HorizontalAlignment::Left))
.value(Self::protocol_to_opt(protocol)),
}
}
@@ -195,8 +206,8 @@ impl HostBridgeProtocolRadio {
}
}
impl Component<Msg, NoUserEvent> for HostBridgeProtocolRadio {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for HostBridgeProtocolRadio {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let result = match ev {
Event::Keyboard(KeyEvent {
code: Key::Left, ..
@@ -223,7 +234,7 @@ impl Component<Msg, NoUserEvent> for HostBridgeProtocolRadio {
};
match result {
CmdResult::Changed(State::One(StateValue::Usize(choice))) => Some(Msg::Form(
CmdResult::Changed(State::Single(StateValue::Usize(choice))) => Some(Msg::Form(
FormMsg::HostBridgeProtocolChanged(Self::protocol_opt_to_enum(choice)),
)),
_ => Some(Msg::None),
+60 -44
View File
@@ -1,10 +1,10 @@
use tuirealm::command::{Cmd, Direction};
use tuirealm::component::{AppComponent, Component};
use tuirealm::event::{Event, Key, KeyEvent, NoUserEvent};
use tuirealm::{Component, MockComponent};
use super::*;
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputS3Bucket {
component: Input,
form_tab: FormTab,
@@ -20,8 +20,11 @@ impl InputS3Bucket {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("my-bucket", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Bucket name", Alignment::Left)
.placeholder(tuirealm::props::SpanStatic::styled(
"my-bucket",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(Title::from("Bucket name").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(bucket),
form_tab,
@@ -29,8 +32,8 @@ impl InputS3Bucket {
}
}
impl Component<Msg, NoUserEvent> for InputS3Bucket {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputS3Bucket {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::S3BucketBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::S3BucketBlurDown)),
@@ -45,7 +48,7 @@ impl Component<Msg, NoUserEvent> for InputS3Bucket {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputS3Region {
component: Input,
form_tab: FormTab,
@@ -61,8 +64,11 @@ impl InputS3Region {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("eu-west-1", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Region", Alignment::Left)
.placeholder(tuirealm::props::SpanStatic::styled(
"eu-west-1",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(Title::from("Region").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(region),
form_tab,
@@ -70,8 +76,8 @@ impl InputS3Region {
}
}
impl Component<Msg, NoUserEvent> for InputS3Region {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputS3Region {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::S3RegionBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::S3RegionBlurDown)),
@@ -86,7 +92,7 @@ impl Component<Msg, NoUserEvent> for InputS3Region {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputS3Endpoint {
component: Input,
form_tab: FormTab,
@@ -102,11 +108,11 @@ impl InputS3Endpoint {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder(
.placeholder(tuirealm::props::SpanStatic::styled(
"http://localhost:9000",
Style::default().fg(Color::Rgb(128, 128, 128)),
)
.title("Endpoint", Alignment::Left)
))
.title(Title::from("Endpoint").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(endpoint),
form_tab,
@@ -114,8 +120,8 @@ impl InputS3Endpoint {
}
}
impl Component<Msg, NoUserEvent> for InputS3Endpoint {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputS3Endpoint {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::S3EndpointBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::S3EndpointBlurDown)),
@@ -130,7 +136,7 @@ impl Component<Msg, NoUserEvent> for InputS3Endpoint {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct RadioS3NewPathStyle {
component: Radio,
form_tab: FormTab,
@@ -140,23 +146,27 @@ impl RadioS3NewPathStyle {
pub fn new(new_path_style: bool, form_tab: FormTab, color: Color) -> Self {
Self {
component: Radio::default()
.highlight_style(
Style::default()
.fg(color)
.add_modifier(TextModifiers::REVERSED),
)
.borders(
Borders::default()
.color(color)
.modifiers(BorderType::Rounded),
)
.choices(["Yes", "No"])
.foreground(color)
.rewind(true)
.title("New path style", Alignment::Left)
.title(Title::from("New path style").alignment(HorizontalAlignment::Left))
.value(usize::from(!new_path_style)),
form_tab,
}
}
}
impl Component<Msg, NoUserEvent> for RadioS3NewPathStyle {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for RadioS3NewPathStyle {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
match ev {
Event::Keyboard(KeyEvent {
code: Key::Left, ..
@@ -199,7 +209,7 @@ impl Component<Msg, NoUserEvent> for RadioS3NewPathStyle {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputS3Profile {
component: Input,
form_tab: FormTab,
@@ -215,8 +225,11 @@ impl InputS3Profile {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("default", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Profile", Alignment::Left)
.placeholder(tuirealm::props::SpanStatic::styled(
"default",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(Title::from("Profile").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(profile),
form_tab,
@@ -224,8 +237,8 @@ impl InputS3Profile {
}
}
impl Component<Msg, NoUserEvent> for InputS3Profile {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputS3Profile {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::S3ProfileBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::S3ProfileBlurDown)),
@@ -240,7 +253,7 @@ impl Component<Msg, NoUserEvent> for InputS3Profile {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputS3AccessKey {
component: Input,
form_tab: FormTab,
@@ -256,8 +269,11 @@ impl InputS3AccessKey {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("AKIA...", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Access key", Alignment::Left)
.placeholder(tuirealm::props::SpanStatic::styled(
"AKIA...",
Style::default().fg(Color::Rgb(128, 128, 128)),
))
.title(Title::from("Access key").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(access_key),
form_tab,
@@ -265,8 +281,8 @@ impl InputS3AccessKey {
}
}
impl Component<Msg, NoUserEvent> for InputS3AccessKey {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputS3AccessKey {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::S3AccessKeyBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::S3AccessKeyBlurDown)),
@@ -281,7 +297,7 @@ impl Component<Msg, NoUserEvent> for InputS3AccessKey {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputS3SecretAccessKey {
component: Input,
form_tab: FormTab,
@@ -297,7 +313,7 @@ impl InputS3SecretAccessKey {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.title("Secret access key", Alignment::Left)
.title(Title::from("Secret access key").alignment(HorizontalAlignment::Left))
.input_type(InputType::Password('*'))
.value(secret_access_key),
form_tab,
@@ -305,8 +321,8 @@ impl InputS3SecretAccessKey {
}
}
impl Component<Msg, NoUserEvent> for InputS3SecretAccessKey {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputS3SecretAccessKey {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::S3SecretAccessKeyBlurDown)),
FormTab::HostBridge => {
@@ -325,7 +341,7 @@ impl Component<Msg, NoUserEvent> for InputS3SecretAccessKey {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputS3SecurityToken {
component: Input,
form_tab: FormTab,
@@ -341,7 +357,7 @@ impl InputS3SecurityToken {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.title("Security token", Alignment::Left)
.title(Title::from("Security token").alignment(HorizontalAlignment::Left))
.input_type(InputType::Password('*'))
.value(security_token),
form_tab,
@@ -349,8 +365,8 @@ impl InputS3SecurityToken {
}
}
impl Component<Msg, NoUserEvent> for InputS3SecurityToken {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputS3SecurityToken {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::S3SecurityTokenBlurDown)),
FormTab::HostBridge => {
@@ -367,7 +383,7 @@ impl Component<Msg, NoUserEvent> for InputS3SecurityToken {
}
}
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputS3SessionToken {
component: Input,
form_tab: FormTab,
@@ -383,7 +399,7 @@ impl InputS3SessionToken {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.title("Session token", Alignment::Left)
.title(Title::from("Session token").alignment(HorizontalAlignment::Left))
.input_type(InputType::Password('*'))
.value(session_token),
form_tab,
@@ -391,8 +407,8 @@ impl InputS3SessionToken {
}
}
impl Component<Msg, NoUserEvent> for InputS3SessionToken {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputS3SessionToken {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::S3SessionTokenBlurDown)),
FormTab::HostBridge => {
@@ -1,9 +1,9 @@
use tuirealm::component::{AppComponent, Component};
use tuirealm::event::NoUserEvent;
use tuirealm::{Component, MockComponent};
use super::*;
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputSmbShare {
component: Input,
form_tab: FormTab,
@@ -19,7 +19,7 @@ impl InputSmbShare {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.title("Share", Alignment::Left)
.title(Title::from("Share").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(host),
form_tab,
@@ -27,8 +27,8 @@ impl InputSmbShare {
}
}
impl Component<Msg, NoUserEvent> for InputSmbShare {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputSmbShare {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::SmbShareBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::SmbShareBlurDown)),
@@ -44,7 +44,7 @@ impl Component<Msg, NoUserEvent> for InputSmbShare {
}
#[cfg(posix)]
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputSmbWorkgroup {
component: Input,
form_tab: FormTab,
@@ -61,7 +61,7 @@ impl InputSmbWorkgroup {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.title("Workgroup", Alignment::Left)
.title(Title::from("Workgroup").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(host),
form_tab,
@@ -70,8 +70,8 @@ impl InputSmbWorkgroup {
}
#[cfg(posix)]
impl Component<Msg, NoUserEvent> for InputSmbWorkgroup {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputSmbWorkgroup {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::SmbWorkgroupDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::SmbWorkgroupDown)),
@@ -1,9 +1,9 @@
use tuirealm::component::{AppComponent, Component};
use tuirealm::event::NoUserEvent;
use tuirealm::{Component, MockComponent};
use super::*;
#[derive(MockComponent)]
#[derive(Component)]
pub struct InputWebDAVUri {
component: Input,
form_tab: FormTab,
@@ -19,11 +19,11 @@ impl InputWebDAVUri {
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder(
.placeholder(tuirealm::props::SpanStatic::styled(
"http://localhost:8080",
Style::default().fg(Color::Rgb(128, 128, 128)),
)
.title("HTTP url", Alignment::Left)
))
.title(Title::from("HTTP url").alignment(HorizontalAlignment::Left))
.input_type(InputType::Text)
.value(host),
form_tab,
@@ -31,8 +31,8 @@ impl InputWebDAVUri {
}
}
impl Component<Msg, NoUserEvent> for InputWebDAVUri {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
impl AppComponent<Msg, NoUserEvent> for InputWebDAVUri {
fn on(&mut self, ev: &Event<NoUserEvent>) -> Option<Msg> {
let on_key_down = match self.form_tab {
FormTab::Remote => Msg::Ui(UiMsg::Remote(UiAuthFormMsg::WebDAVUriBlurDown)),
FormTab::HostBridge => Msg::Ui(UiMsg::HostBridge(UiAuthFormMsg::WebDAVUriBlurDown)),