mirror of
https://github.com/veeso/termscp.git
synced 2026-04-02 08:12:19 -07:00
refactor: split auth view helpers by responsibility
This commit is contained in:
File diff suppressed because it is too large
Load Diff
679
src/ui/activities/auth/view/mounting.rs
Normal file
679
src/ui/activities/auth/view/mounting.rs
Normal file
@@ -0,0 +1,679 @@
|
||||
use super::*;
|
||||
use crate::ui::activities::auth::STORE_KEY_RELEASE_NOTES;
|
||||
|
||||
impl AuthActivity {
|
||||
/// Make text span from bookmarks
|
||||
pub(in crate::ui::activities::auth) fn view_bookmarks(&mut self) {
|
||||
let bookmarks: Vec<String> = self
|
||||
.bookmarks_list
|
||||
.iter()
|
||||
.map(|x| {
|
||||
Self::fmt_bookmark(x, self.bookmarks_client().unwrap().get_bookmark(x).unwrap())
|
||||
})
|
||||
.collect();
|
||||
let bookmarks_color = self.theme().auth_bookmarks;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::BookmarksList,
|
||||
Box::new(components::BookmarksList::new(&bookmarks, bookmarks_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
/// View recent connections
|
||||
pub(in crate::ui::activities::auth) fn view_recent_connections(&mut self) {
|
||||
let bookmarks: Vec<String> = self
|
||||
.recents_list
|
||||
.iter()
|
||||
.map(|x| Self::fmt_recent(self.bookmarks_client().unwrap().get_recent(x).unwrap()))
|
||||
.collect();
|
||||
let recents_color = self.theme().auth_recents;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::RecentsList,
|
||||
Box::new(components::RecentsList::new(&bookmarks, recents_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_error<S: AsRef<str>>(&mut self, text: S) {
|
||||
let err_color = self.theme().misc_error_dialog;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::ErrorPopup,
|
||||
Box::new(components::ErrorPopup::new(text, err_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.active(&Id::ErrorPopup) {
|
||||
error!("Failed to activate component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn umount_error(&mut self) {
|
||||
let _ = self.app.umount(&Id::ErrorPopup);
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_info<S: AsRef<str>>(&mut self, text: S) {
|
||||
let color = self.theme().misc_info_dialog;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::InfoPopup,
|
||||
Box::new(components::InfoPopup::new(text, color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.active(&Id::InfoPopup) {
|
||||
error!("Failed to activate component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn umount_info(&mut self) {
|
||||
let _ = self.app.umount(&Id::InfoPopup);
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_wait(&mut self, text: &str) {
|
||||
let wait_color = self.theme().misc_info_dialog;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::WaitPopup,
|
||||
Box::new(components::WaitPopup::new(text, wait_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.active(&Id::WaitPopup) {
|
||||
error!("Failed to activate component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn umount_wait(&mut self) {
|
||||
let _ = self.app.umount(&Id::WaitPopup);
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_size_err(&mut self) {
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::WindowSizeError,
|
||||
Box::new(components::WindowSizeError::new(Color::Red)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.active(&Id::WindowSizeError) {
|
||||
error!("Failed to activate component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn umount_size_err(&mut self) {
|
||||
let _ = self.app.umount(&Id::WindowSizeError);
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_quit(&mut self) {
|
||||
let quit_color = self.theme().misc_quit_dialog;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::QuitPopup,
|
||||
Box::new(components::QuitPopup::new(quit_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.active(&Id::QuitPopup) {
|
||||
error!("Failed to activate component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn umount_quit(&mut self) {
|
||||
let _ = self.app.umount(&Id::QuitPopup);
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_bookmark_del_dialog(&mut self) {
|
||||
let warn_color = self.theme().misc_warn_dialog;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::DeleteBookmarkPopup,
|
||||
Box::new(components::DeleteBookmarkPopup::new(warn_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.active(&Id::DeleteBookmarkPopup) {
|
||||
error!("Failed to activate component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn umount_bookmark_del_dialog(&mut self) {
|
||||
let _ = self.app.umount(&Id::DeleteBookmarkPopup);
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_recent_del_dialog(&mut self) {
|
||||
let warn_color = self.theme().misc_warn_dialog;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::DeleteRecentPopup,
|
||||
Box::new(components::DeleteRecentPopup::new(warn_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.active(&Id::DeleteRecentPopup) {
|
||||
error!("Failed to activate component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn umount_recent_del_dialog(&mut self) {
|
||||
let _ = self.app.umount(&Id::DeleteRecentPopup);
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_bookmark_save_dialog(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
) {
|
||||
let save_color = self.theme().misc_save_dialog;
|
||||
let warn_color = self.theme().misc_warn_dialog;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::BookmarkName,
|
||||
Box::new(components::BookmarkName::new(form_tab, save_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::BookmarkSavePassword,
|
||||
Box::new(components::BookmarkSavePassword::new(form_tab, warn_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.active(&Id::BookmarkName) {
|
||||
error!("Failed to activate component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn umount_bookmark_save_dialog(&mut self) {
|
||||
let _ = self.app.umount(&Id::BookmarkName);
|
||||
let _ = self.app.umount(&Id::BookmarkSavePassword);
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_keybindings(&mut self) {
|
||||
let key_color = self.theme().misc_keys;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::Keybindings,
|
||||
Box::new(components::Keybindings::new(key_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.active(&Id::Keybindings) {
|
||||
error!("Failed to activate component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn umount_help(&mut self) {
|
||||
let _ = self.app.umount(&Id::Keybindings);
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_release_notes(&mut self) {
|
||||
if let Some(ctx) = self.context.as_ref()
|
||||
&& let Some(release_notes) = ctx.store().get_string(STORE_KEY_RELEASE_NOTES)
|
||||
{
|
||||
let info_color = self.theme().misc_info_dialog;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::NewVersionChangelog,
|
||||
Box::new(components::ReleaseNotes::new(release_notes, info_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::InstallUpdatePopup,
|
||||
Box::new(components::InstallUpdatePopup::new(info_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
if let Err(err) = self.app.active(&Id::InstallUpdatePopup) {
|
||||
error!("Failed to activate component: {err}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn umount_release_notes(&mut self) {
|
||||
let _ = self.app.umount(&Id::NewVersionChangelog);
|
||||
let _ = self.app.umount(&Id::InstallUpdatePopup);
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_host_bridge_protocol(
|
||||
&mut self,
|
||||
protocol: HostBridgeProtocol,
|
||||
) {
|
||||
let protocol_color = self.theme().auth_protocol;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::HostBridge(AuthFormId::Protocol),
|
||||
Box::new(components::HostBridgeProtocolRadio::new(
|
||||
protocol,
|
||||
protocol_color,
|
||||
)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_remote_protocol(
|
||||
&mut self,
|
||||
protocol: FileTransferProtocol,
|
||||
) {
|
||||
let protocol_color = self.theme().auth_protocol;
|
||||
if let Err(err) = self.app.remount(
|
||||
Id::Remote(AuthFormId::Protocol),
|
||||
Box::new(components::RemoteProtocolRadio::new(
|
||||
protocol,
|
||||
protocol_color,
|
||||
)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_remote_directory<S: AsRef<str>>(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
remote_path: S,
|
||||
) {
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::RemoteDirectory);
|
||||
let protocol_color = self.theme().auth_protocol;
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputRemoteDirectory::new(
|
||||
remote_path.as_ref(),
|
||||
form_tab,
|
||||
protocol_color,
|
||||
)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_local_directory<S: AsRef<str>>(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
local_path: S,
|
||||
) {
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::LocalDirectory);
|
||||
let color = self.theme().auth_username;
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputLocalDirectory::new(
|
||||
local_path.as_ref(),
|
||||
form_tab,
|
||||
color,
|
||||
)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_address(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
address: &str,
|
||||
) {
|
||||
let addr_color = self.theme().auth_address;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::Address);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputAddress::new(address, form_tab, addr_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_port(&mut self, form_tab: FormTab, port: u16) {
|
||||
let port_color = self.theme().auth_port;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::Port);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputPort::new(port, form_tab, port_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_username(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
username: &str,
|
||||
) {
|
||||
let username_color = self.theme().auth_username;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::Username);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputUsername::new(
|
||||
username,
|
||||
form_tab,
|
||||
username_color,
|
||||
)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_password(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
password: &str,
|
||||
) {
|
||||
let password_color = self.theme().auth_password;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::Password);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputPassword::new(
|
||||
password,
|
||||
form_tab,
|
||||
password_color,
|
||||
)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_s3_bucket(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
bucket: &str,
|
||||
) {
|
||||
let addr_color = self.theme().auth_address;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::S3Bucket);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputS3Bucket::new(bucket, form_tab, addr_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_s3_region(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
region: &str,
|
||||
) {
|
||||
let port_color = self.theme().auth_port;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::S3Region);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputS3Region::new(region, form_tab, port_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_s3_endpoint(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
endpoint: &str,
|
||||
) {
|
||||
let username_color = self.theme().auth_username;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::S3Endpoint);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputS3Endpoint::new(
|
||||
endpoint,
|
||||
form_tab,
|
||||
username_color,
|
||||
)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_s3_profile(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
profile: &str,
|
||||
) {
|
||||
let color = self.theme().auth_password;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::S3Profile);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputS3Profile::new(profile, form_tab, color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_s3_access_key(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
key: &str,
|
||||
) {
|
||||
let color = self.theme().auth_address;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::S3AccessKey);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputS3AccessKey::new(key, form_tab, color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_s3_secret_access_key(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
key: &str,
|
||||
) {
|
||||
let color = self.theme().auth_port;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::S3SecretAccessKey);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputS3SecretAccessKey::new(
|
||||
key, form_tab, color,
|
||||
)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_s3_security_token(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
token: &str,
|
||||
) {
|
||||
let color = self.theme().auth_username;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::S3SecurityToken);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputS3SecurityToken::new(
|
||||
token, form_tab, color,
|
||||
)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_s3_session_token(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
token: &str,
|
||||
) {
|
||||
let color = self.theme().auth_password;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::S3SessionToken);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputS3SessionToken::new(token, form_tab, color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_s3_new_path_style(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
new_path_style: bool,
|
||||
) {
|
||||
let color = self.theme().auth_address;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::S3NewPathStyle);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::RadioS3NewPathStyle::new(
|
||||
new_path_style,
|
||||
form_tab,
|
||||
color,
|
||||
)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_kube_namespace(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
value: &str,
|
||||
) {
|
||||
let color = self.theme().auth_port;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::KubeNamespace);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputKubeNamespace::new(value, form_tab, color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_kube_cluster_url(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
value: &str,
|
||||
) {
|
||||
let color = self.theme().auth_username;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::KubeClusterUrl);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputKubeClusterUrl::new(value, form_tab, color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_kube_username(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
value: &str,
|
||||
) {
|
||||
let color = self.theme().auth_password;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::KubeUsername);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputKubeUsername::new(value, form_tab, color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_kube_client_cert(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
value: &str,
|
||||
) {
|
||||
let color = self.theme().auth_address;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::KubeClientCert);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputKubeClientCert::new(value, form_tab, color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_kube_client_key(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
value: &str,
|
||||
) {
|
||||
let color = self.theme().auth_port;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::KubeClientKey);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputKubeClientKey::new(value, form_tab, color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_smb_share(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
share: &str,
|
||||
) {
|
||||
let color = self.theme().auth_password;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::SmbShare);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputSmbShare::new(share, form_tab, color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(posix)]
|
||||
pub(in crate::ui::activities::auth) fn mount_smb_workgroup(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
workgroup: &str,
|
||||
) {
|
||||
let color = self.theme().auth_address;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::SmbWorkgroup);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputSmbWorkgroup::new(
|
||||
workgroup, form_tab, color,
|
||||
)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn mount_webdav_uri(
|
||||
&mut self,
|
||||
form_tab: FormTab,
|
||||
uri: &str,
|
||||
) {
|
||||
let addr_color = self.theme().auth_address;
|
||||
let id = Self::form_tab_id(form_tab, AuthFormId::WebDAVUri);
|
||||
if let Err(err) = self.app.remount(
|
||||
id,
|
||||
Box::new(components::InputWebDAVUri::new(uri, form_tab, addr_color)),
|
||||
vec![],
|
||||
) {
|
||||
error!("Failed to remount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn form_tab_id(form_tab: FormTab, id: AuthFormId) -> Id {
|
||||
match form_tab {
|
||||
FormTab::HostBridge => Id::HostBridge(id),
|
||||
FormTab::Remote => Id::Remote(id),
|
||||
}
|
||||
}
|
||||
}
|
||||
510
src/ui/activities/auth/view/query.rs
Normal file
510
src/ui/activities/auth/view/query.rs
Normal file
@@ -0,0 +1,510 @@
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
|
||||
use tuirealm::{State, StateValue};
|
||||
|
||||
use super::*;
|
||||
use crate::filetransfer::FileTransferParams;
|
||||
use crate::filetransfer::params::{
|
||||
AwsS3Params, GenericProtocolParams, KubeProtocolParams, ProtocolParams, SmbParams,
|
||||
WebDAVProtocolParams,
|
||||
};
|
||||
|
||||
impl AuthActivity {
|
||||
pub(in crate::ui::activities::auth) fn get_generic_params_input(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> GenericProtocolParams {
|
||||
let addr = self.get_input_addr(form_tab);
|
||||
let port = self.get_input_port(form_tab);
|
||||
let username = self.get_input_username(form_tab);
|
||||
let password = self.get_input_password(form_tab);
|
||||
GenericProtocolParams::default()
|
||||
.address(addr)
|
||||
.port(port)
|
||||
.username(username)
|
||||
.password(password)
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_s3_params_input(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> AwsS3Params {
|
||||
let bucket = self.get_input_s3_bucket(form_tab);
|
||||
let region = self.get_input_s3_region(form_tab);
|
||||
let endpoint = self.get_input_s3_endpoint(form_tab);
|
||||
let profile = self.get_input_s3_profile(form_tab);
|
||||
let access_key = self.get_input_s3_access_key(form_tab);
|
||||
let secret_access_key = self.get_input_s3_secret_access_key(form_tab);
|
||||
let security_token = self.get_input_s3_security_token(form_tab);
|
||||
let session_token = self.get_input_s3_session_token(form_tab);
|
||||
let new_path_style = self.get_input_s3_new_path_style(form_tab);
|
||||
AwsS3Params::new(bucket, region, profile)
|
||||
.endpoint(endpoint)
|
||||
.access_key(access_key)
|
||||
.secret_access_key(secret_access_key)
|
||||
.security_token(security_token)
|
||||
.session_token(session_token)
|
||||
.new_path_style(new_path_style)
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_kube_params_input(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> KubeProtocolParams {
|
||||
let namespace = self.get_input_kube_namespace(form_tab);
|
||||
let cluster_url = self.get_input_kube_cluster_url(form_tab);
|
||||
let username = self.get_input_kube_username(form_tab);
|
||||
let client_cert = self.get_input_kube_client_cert(form_tab);
|
||||
let client_key = self.get_input_kube_client_key(form_tab);
|
||||
KubeProtocolParams {
|
||||
namespace,
|
||||
cluster_url,
|
||||
username,
|
||||
client_cert,
|
||||
client_key,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(posix)]
|
||||
pub(in crate::ui::activities::auth) fn get_smb_params_input(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> SmbParams {
|
||||
let share = self.get_input_smb_share(form_tab);
|
||||
let workgroup = self.get_input_smb_workgroup(form_tab);
|
||||
let address = self.get_input_addr(form_tab);
|
||||
let port = self.get_input_port(form_tab);
|
||||
let username = self.get_input_username(form_tab);
|
||||
let password = self.get_input_password(form_tab);
|
||||
|
||||
SmbParams::new(address, share)
|
||||
.port(port)
|
||||
.username(username)
|
||||
.password(password)
|
||||
.workgroup(workgroup)
|
||||
}
|
||||
|
||||
#[cfg(win)]
|
||||
pub(in crate::ui::activities::auth) fn get_smb_params_input(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> SmbParams {
|
||||
let share = self.get_input_smb_share(form_tab);
|
||||
let address = self.get_input_addr(form_tab);
|
||||
let username = self.get_input_username(form_tab);
|
||||
let password = self.get_input_password(form_tab);
|
||||
|
||||
SmbParams::new(address, share)
|
||||
.username(username)
|
||||
.password(password)
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_webdav_params_input(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> WebDAVProtocolParams {
|
||||
let uri = self.get_webdav_uri(form_tab);
|
||||
let username = self.get_input_username(form_tab).unwrap_or_default();
|
||||
let password = self.get_input_password(form_tab).unwrap_or_default();
|
||||
|
||||
WebDAVProtocolParams {
|
||||
uri,
|
||||
username,
|
||||
password,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_remote_directory(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<PathBuf> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::RemoteDirectory))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => {
|
||||
Some(PathBuf::from(x.as_str()))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_local_directory(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<PathBuf> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::LocalDirectory))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => {
|
||||
Some(PathBuf::from(x.as_str()))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_webdav_uri(&self, form_tab: FormTab) -> String {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::WebDAVUri))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) => x,
|
||||
_ => String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_addr(&self, form_tab: FormTab) -> String {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::Address))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) => x,
|
||||
_ => String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_port(&self, form_tab: FormTab) -> u16 {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::Port))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) => u16::from_str(x.as_str()).unwrap_or_default(),
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_username(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::Username))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_password(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::Password))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_s3_bucket(&self, form_tab: FormTab) -> String {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::S3Bucket))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) => x,
|
||||
_ => String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_s3_region(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::S3Region))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_s3_endpoint(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::S3Endpoint))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_s3_profile(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::S3Profile))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_s3_access_key(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::S3AccessKey))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_s3_secret_access_key(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::S3SecretAccessKey))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_s3_security_token(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::S3SecurityToken))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_s3_session_token(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::S3SessionToken))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_s3_new_path_style(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> bool {
|
||||
matches!(
|
||||
self.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::S3NewPathStyle)),
|
||||
Ok(State::One(StateValue::Usize(0)))
|
||||
)
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_kube_namespace(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::KubeNamespace))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_kube_cluster_url(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::KubeClusterUrl))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_kube_username(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::KubeUsername))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_kube_client_cert(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::KubeClientCert))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_kube_client_key(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::KubeClientKey))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) if !x.is_empty() => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_input_smb_share(&self, form_tab: FormTab) -> String {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::SmbShare))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) => x,
|
||||
_ => String::new(),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(posix)]
|
||||
pub(in crate::ui::activities::auth) fn get_input_smb_workgroup(
|
||||
&self,
|
||||
form_tab: FormTab,
|
||||
) -> Option<String> {
|
||||
match self
|
||||
.app
|
||||
.state(&Self::form_tab_id(form_tab, AuthFormId::SmbWorkgroup))
|
||||
{
|
||||
Ok(State::One(StateValue::String(x))) => Some(x),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_new_bookmark(&self) -> (String, bool) {
|
||||
let name = match self.app.state(&Id::BookmarkName) {
|
||||
Ok(State::One(StateValue::String(name))) => name,
|
||||
_ => String::default(),
|
||||
};
|
||||
if matches!(
|
||||
self.app.state(&Id::BookmarkSavePassword),
|
||||
Ok(State::One(StateValue::Usize(0)))
|
||||
) {
|
||||
(name, true)
|
||||
} else {
|
||||
(name, false)
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn max_input_mask_size(&self) -> u16 {
|
||||
Self::input_mask_size(self.host_bridge_input_mask())
|
||||
.max(Self::input_mask_size(self.remote_input_mask()))
|
||||
+ 3
|
||||
}
|
||||
|
||||
fn input_mask_size(input_mask: InputMask) -> u16 {
|
||||
match input_mask {
|
||||
InputMask::AwsS3
|
||||
| InputMask::Generic
|
||||
| InputMask::Kube
|
||||
| InputMask::Smb
|
||||
| InputMask::WebDAV => 12,
|
||||
InputMask::Localhost => 3,
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn fmt_bookmark(
|
||||
name: &str,
|
||||
b: FileTransferParams,
|
||||
) -> String {
|
||||
let addr = Self::fmt_recent(b);
|
||||
format!("{name} ({addr})")
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn fmt_recent(b: FileTransferParams) -> String {
|
||||
let protocol = b.protocol.to_string().to_lowercase();
|
||||
match b.params {
|
||||
ProtocolParams::AwsS3(s3) => {
|
||||
let profile = match s3.profile {
|
||||
Some(p) => format!("[{p}]"),
|
||||
None => String::default(),
|
||||
};
|
||||
format!(
|
||||
"{}://{}{} ({}) {}",
|
||||
protocol,
|
||||
s3.endpoint.unwrap_or_default(),
|
||||
s3.bucket_name,
|
||||
s3.region.as_deref().unwrap_or("custom"),
|
||||
profile
|
||||
)
|
||||
}
|
||||
ProtocolParams::Generic(params) => {
|
||||
let username = match params.username {
|
||||
None => String::default(),
|
||||
Some(u) => format!("{u}@"),
|
||||
};
|
||||
format!(
|
||||
"{}://{}{}:{}",
|
||||
protocol, username, params.address, params.port
|
||||
)
|
||||
}
|
||||
ProtocolParams::Kube(params) => {
|
||||
format!(
|
||||
"{}://{}{}",
|
||||
protocol,
|
||||
params
|
||||
.namespace
|
||||
.as_deref()
|
||||
.map(|x| format!("/{x}"))
|
||||
.unwrap_or_else(|| String::from("default")),
|
||||
params
|
||||
.cluster_url
|
||||
.as_deref()
|
||||
.map(|x| format!("@{x}"))
|
||||
.unwrap_or_default()
|
||||
)
|
||||
}
|
||||
#[cfg(posix)]
|
||||
ProtocolParams::Smb(params) => {
|
||||
let username = match params.username {
|
||||
None => String::default(),
|
||||
Some(u) => format!("{u}@"),
|
||||
};
|
||||
format!(
|
||||
"\\\\{username}{}:{}\\{}",
|
||||
params.address, params.port, params.share
|
||||
)
|
||||
}
|
||||
#[cfg(win)]
|
||||
ProtocolParams::Smb(params) => {
|
||||
let username = match params.username {
|
||||
None => String::default(),
|
||||
Some(u) => format!("{u}@"),
|
||||
};
|
||||
format!("\\\\{username}{}\\{}", params.address, params.share)
|
||||
}
|
||||
ProtocolParams::WebDAV(params) => params.uri,
|
||||
}
|
||||
}
|
||||
}
|
||||
512
src/ui/activities/auth/view/visible.rs
Normal file
512
src/ui/activities/auth/view/visible.rs
Normal file
@@ -0,0 +1,512 @@
|
||||
use tuirealm::{Sub, SubClause, SubEventClause};
|
||||
|
||||
use super::*;
|
||||
|
||||
impl AuthActivity {
|
||||
pub(in crate::ui::activities::auth) fn get_host_bridge_generic_params_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(&Id::HostBridge(AuthFormId::RemoteDirectory)) => [
|
||||
Id::HostBridge(AuthFormId::Port),
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::LocalDirectory)) => [
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
Id::HostBridge(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::HostBridge(AuthFormId::Address),
|
||||
Id::HostBridge(AuthFormId::Port),
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_remote_generic_params_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(&Id::Remote(AuthFormId::RemoteDirectory)) => [
|
||||
Id::Remote(AuthFormId::Port),
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::LocalDirectory)) => [
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
Id::Remote(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::Remote(AuthFormId::Address),
|
||||
Id::Remote(AuthFormId::Port),
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_host_bridge_localhost_view(&self) -> [Id; 1] {
|
||||
[Id::HostBridge(AuthFormId::LocalDirectory)]
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_host_bridge_s3_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(&Id::HostBridge(AuthFormId::S3AccessKey)) => [
|
||||
Id::HostBridge(AuthFormId::S3Region),
|
||||
Id::HostBridge(AuthFormId::S3Endpoint),
|
||||
Id::HostBridge(AuthFormId::S3Profile),
|
||||
Id::HostBridge(AuthFormId::S3AccessKey),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::S3SecretAccessKey)) => [
|
||||
Id::HostBridge(AuthFormId::S3Endpoint),
|
||||
Id::HostBridge(AuthFormId::S3Profile),
|
||||
Id::HostBridge(AuthFormId::S3AccessKey),
|
||||
Id::HostBridge(AuthFormId::S3SecretAccessKey),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::S3SecurityToken)) => [
|
||||
Id::HostBridge(AuthFormId::S3Profile),
|
||||
Id::HostBridge(AuthFormId::S3AccessKey),
|
||||
Id::HostBridge(AuthFormId::S3SecretAccessKey),
|
||||
Id::HostBridge(AuthFormId::S3SecurityToken),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::S3SessionToken)) => [
|
||||
Id::HostBridge(AuthFormId::S3AccessKey),
|
||||
Id::HostBridge(AuthFormId::S3SecretAccessKey),
|
||||
Id::HostBridge(AuthFormId::S3SecurityToken),
|
||||
Id::HostBridge(AuthFormId::S3SessionToken),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::S3NewPathStyle)) => [
|
||||
Id::HostBridge(AuthFormId::S3SecretAccessKey),
|
||||
Id::HostBridge(AuthFormId::S3SecurityToken),
|
||||
Id::HostBridge(AuthFormId::S3SessionToken),
|
||||
Id::HostBridge(AuthFormId::S3NewPathStyle),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::RemoteDirectory)) => [
|
||||
Id::HostBridge(AuthFormId::S3SecurityToken),
|
||||
Id::HostBridge(AuthFormId::S3SessionToken),
|
||||
Id::HostBridge(AuthFormId::S3NewPathStyle),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::LocalDirectory)) => [
|
||||
Id::HostBridge(AuthFormId::S3SessionToken),
|
||||
Id::HostBridge(AuthFormId::S3NewPathStyle),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
Id::HostBridge(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::HostBridge(AuthFormId::S3Bucket),
|
||||
Id::HostBridge(AuthFormId::S3Region),
|
||||
Id::HostBridge(AuthFormId::S3Endpoint),
|
||||
Id::HostBridge(AuthFormId::S3Profile),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_remote_s3_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(&Id::Remote(AuthFormId::S3AccessKey)) => [
|
||||
Id::Remote(AuthFormId::S3Region),
|
||||
Id::Remote(AuthFormId::S3Endpoint),
|
||||
Id::Remote(AuthFormId::S3Profile),
|
||||
Id::Remote(AuthFormId::S3AccessKey),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::S3SecretAccessKey)) => [
|
||||
Id::Remote(AuthFormId::S3Endpoint),
|
||||
Id::Remote(AuthFormId::S3Profile),
|
||||
Id::Remote(AuthFormId::S3AccessKey),
|
||||
Id::Remote(AuthFormId::S3SecretAccessKey),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::S3SecurityToken)) => [
|
||||
Id::Remote(AuthFormId::S3Profile),
|
||||
Id::Remote(AuthFormId::S3AccessKey),
|
||||
Id::Remote(AuthFormId::S3SecretAccessKey),
|
||||
Id::Remote(AuthFormId::S3SecurityToken),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::S3SessionToken)) => [
|
||||
Id::Remote(AuthFormId::S3AccessKey),
|
||||
Id::Remote(AuthFormId::S3SecretAccessKey),
|
||||
Id::Remote(AuthFormId::S3SecurityToken),
|
||||
Id::Remote(AuthFormId::S3SessionToken),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::S3NewPathStyle)) => [
|
||||
Id::Remote(AuthFormId::S3SecretAccessKey),
|
||||
Id::Remote(AuthFormId::S3SecurityToken),
|
||||
Id::Remote(AuthFormId::S3SessionToken),
|
||||
Id::Remote(AuthFormId::S3NewPathStyle),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::RemoteDirectory)) => [
|
||||
Id::Remote(AuthFormId::S3SecurityToken),
|
||||
Id::Remote(AuthFormId::S3SessionToken),
|
||||
Id::Remote(AuthFormId::S3NewPathStyle),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::LocalDirectory)) => [
|
||||
Id::Remote(AuthFormId::S3SessionToken),
|
||||
Id::Remote(AuthFormId::S3NewPathStyle),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
Id::Remote(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::Remote(AuthFormId::S3Bucket),
|
||||
Id::Remote(AuthFormId::S3Region),
|
||||
Id::Remote(AuthFormId::S3Endpoint),
|
||||
Id::Remote(AuthFormId::S3Profile),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_host_bridge_kube_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(&Id::HostBridge(AuthFormId::KubeClientCert)) => [
|
||||
Id::HostBridge(AuthFormId::KubeNamespace),
|
||||
Id::HostBridge(AuthFormId::KubeClusterUrl),
|
||||
Id::HostBridge(AuthFormId::KubeUsername),
|
||||
Id::HostBridge(AuthFormId::KubeClientCert),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::KubeClientKey)) => [
|
||||
Id::HostBridge(AuthFormId::KubeClusterUrl),
|
||||
Id::HostBridge(AuthFormId::KubeUsername),
|
||||
Id::HostBridge(AuthFormId::KubeClientCert),
|
||||
Id::HostBridge(AuthFormId::KubeClientKey),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::RemoteDirectory)) => [
|
||||
Id::HostBridge(AuthFormId::KubeUsername),
|
||||
Id::HostBridge(AuthFormId::KubeClientCert),
|
||||
Id::HostBridge(AuthFormId::KubeClientKey),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::LocalDirectory)) => [
|
||||
Id::HostBridge(AuthFormId::KubeClientCert),
|
||||
Id::HostBridge(AuthFormId::KubeClientKey),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
Id::HostBridge(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::HostBridge(AuthFormId::KubeNamespace),
|
||||
Id::HostBridge(AuthFormId::KubeClusterUrl),
|
||||
Id::HostBridge(AuthFormId::KubeUsername),
|
||||
Id::HostBridge(AuthFormId::KubeClientCert),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_remote_kube_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(&Id::Remote(AuthFormId::KubeClientCert)) => [
|
||||
Id::Remote(AuthFormId::KubeNamespace),
|
||||
Id::Remote(AuthFormId::KubeClusterUrl),
|
||||
Id::Remote(AuthFormId::KubeUsername),
|
||||
Id::Remote(AuthFormId::KubeClientCert),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::KubeClientKey)) => [
|
||||
Id::Remote(AuthFormId::KubeClusterUrl),
|
||||
Id::Remote(AuthFormId::KubeUsername),
|
||||
Id::Remote(AuthFormId::KubeClientCert),
|
||||
Id::Remote(AuthFormId::KubeClientKey),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::RemoteDirectory)) => [
|
||||
Id::Remote(AuthFormId::KubeUsername),
|
||||
Id::Remote(AuthFormId::KubeClientCert),
|
||||
Id::Remote(AuthFormId::KubeClientKey),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::LocalDirectory)) => [
|
||||
Id::Remote(AuthFormId::KubeClientCert),
|
||||
Id::Remote(AuthFormId::KubeClientKey),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
Id::Remote(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::Remote(AuthFormId::KubeNamespace),
|
||||
Id::Remote(AuthFormId::KubeClusterUrl),
|
||||
Id::Remote(AuthFormId::KubeUsername),
|
||||
Id::Remote(AuthFormId::KubeClientCert),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(posix)]
|
||||
pub(in crate::ui::activities::auth) fn get_host_bridge_smb_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(
|
||||
&Id::HostBridge(AuthFormId::Address)
|
||||
| &Id::HostBridge(AuthFormId::Port)
|
||||
| &Id::HostBridge(AuthFormId::SmbShare)
|
||||
| &Id::HostBridge(AuthFormId::Username),
|
||||
) => [
|
||||
Id::HostBridge(AuthFormId::Address),
|
||||
Id::HostBridge(AuthFormId::Port),
|
||||
Id::HostBridge(AuthFormId::SmbShare),
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::Password)) => [
|
||||
Id::HostBridge(AuthFormId::Port),
|
||||
Id::HostBridge(AuthFormId::SmbShare),
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::SmbWorkgroup)) => [
|
||||
Id::HostBridge(AuthFormId::SmbShare),
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
Id::HostBridge(AuthFormId::SmbWorkgroup),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::RemoteDirectory)) => [
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
Id::HostBridge(AuthFormId::SmbWorkgroup),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::LocalDirectory)) => [
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
Id::HostBridge(AuthFormId::SmbWorkgroup),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
Id::HostBridge(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::HostBridge(AuthFormId::Address),
|
||||
Id::HostBridge(AuthFormId::Port),
|
||||
Id::HostBridge(AuthFormId::SmbShare),
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(posix)]
|
||||
pub(in crate::ui::activities::auth) fn get_remote_smb_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(
|
||||
&Id::Remote(AuthFormId::Address)
|
||||
| &Id::Remote(AuthFormId::Port)
|
||||
| &Id::Remote(AuthFormId::SmbShare)
|
||||
| &Id::Remote(AuthFormId::Username),
|
||||
) => [
|
||||
Id::Remote(AuthFormId::Address),
|
||||
Id::Remote(AuthFormId::Port),
|
||||
Id::Remote(AuthFormId::SmbShare),
|
||||
Id::Remote(AuthFormId::Username),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::Password)) => [
|
||||
Id::Remote(AuthFormId::Port),
|
||||
Id::Remote(AuthFormId::SmbShare),
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::SmbWorkgroup)) => [
|
||||
Id::Remote(AuthFormId::SmbShare),
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
Id::Remote(AuthFormId::SmbWorkgroup),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::RemoteDirectory)) => [
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
Id::Remote(AuthFormId::SmbWorkgroup),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::LocalDirectory)) => [
|
||||
Id::Remote(AuthFormId::Password),
|
||||
Id::Remote(AuthFormId::SmbWorkgroup),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
Id::Remote(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::Remote(AuthFormId::Address),
|
||||
Id::Remote(AuthFormId::Port),
|
||||
Id::Remote(AuthFormId::SmbShare),
|
||||
Id::Remote(AuthFormId::Username),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(win)]
|
||||
pub(in crate::ui::activities::auth) fn get_host_bridge_smb_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(
|
||||
&Id::HostBridge(AuthFormId::Address)
|
||||
| &Id::HostBridge(AuthFormId::Password)
|
||||
| &Id::HostBridge(AuthFormId::SmbShare)
|
||||
| &Id::HostBridge(AuthFormId::Username),
|
||||
) => [
|
||||
Id::HostBridge(AuthFormId::Address),
|
||||
Id::HostBridge(AuthFormId::SmbShare),
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::RemoteDirectory)) => [
|
||||
Id::HostBridge(AuthFormId::SmbShare),
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
Some(&Id::HostBridge(AuthFormId::LocalDirectory)) => [
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
Id::HostBridge(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::HostBridge(AuthFormId::Address),
|
||||
Id::HostBridge(AuthFormId::SmbShare),
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(win)]
|
||||
pub(in crate::ui::activities::auth) fn get_remote_smb_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(
|
||||
&Id::Remote(AuthFormId::Address)
|
||||
| &Id::Remote(AuthFormId::Password)
|
||||
| &Id::Remote(AuthFormId::SmbShare)
|
||||
| &Id::Remote(AuthFormId::Username),
|
||||
) => [
|
||||
Id::Remote(AuthFormId::Address),
|
||||
Id::Remote(AuthFormId::SmbShare),
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::RemoteDirectory)) => [
|
||||
Id::Remote(AuthFormId::SmbShare),
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
Some(&Id::Remote(AuthFormId::LocalDirectory)) => [
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
Id::Remote(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::Remote(AuthFormId::Address),
|
||||
Id::Remote(AuthFormId::SmbShare),
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_host_bridge_webdav_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(&Id::HostBridge(AuthFormId::LocalDirectory)) => [
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
Id::HostBridge(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::HostBridge(AuthFormId::WebDAVUri),
|
||||
Id::HostBridge(AuthFormId::Username),
|
||||
Id::HostBridge(AuthFormId::Password),
|
||||
Id::HostBridge(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_remote_webdav_view(&self) -> [Id; 4] {
|
||||
match self.app.focus() {
|
||||
Some(&Id::Remote(AuthFormId::LocalDirectory)) => [
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
Id::Remote(AuthFormId::LocalDirectory),
|
||||
],
|
||||
_ => [
|
||||
Id::Remote(AuthFormId::WebDAVUri),
|
||||
Id::Remote(AuthFormId::Username),
|
||||
Id::Remote(AuthFormId::Password),
|
||||
Id::Remote(AuthFormId::RemoteDirectory),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn init_global_listener(&mut self) {
|
||||
use tuirealm::event::{Key, KeyEvent, KeyModifiers};
|
||||
|
||||
if let Err(err) = self.app.mount(
|
||||
Id::GlobalListener,
|
||||
Box::<components::GlobalListener>::default(),
|
||||
vec![
|
||||
Sub::new(
|
||||
SubEventClause::Keyboard(KeyEvent {
|
||||
code: Key::Esc,
|
||||
modifiers: KeyModifiers::NONE,
|
||||
}),
|
||||
Self::no_popup_mounted_clause(),
|
||||
),
|
||||
Sub::new(
|
||||
SubEventClause::Keyboard(KeyEvent {
|
||||
code: Key::Function(10),
|
||||
modifiers: KeyModifiers::NONE,
|
||||
}),
|
||||
Self::no_popup_mounted_clause(),
|
||||
),
|
||||
Sub::new(
|
||||
SubEventClause::Keyboard(KeyEvent {
|
||||
code: Key::Char('c'),
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
}),
|
||||
Self::no_popup_mounted_clause(),
|
||||
),
|
||||
Sub::new(
|
||||
SubEventClause::Keyboard(KeyEvent {
|
||||
code: Key::Char('h'),
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
}),
|
||||
Self::no_popup_mounted_clause(),
|
||||
),
|
||||
Sub::new(
|
||||
SubEventClause::Keyboard(KeyEvent {
|
||||
code: Key::Function(1),
|
||||
modifiers: KeyModifiers::NONE,
|
||||
}),
|
||||
Self::no_popup_mounted_clause(),
|
||||
),
|
||||
Sub::new(
|
||||
SubEventClause::Keyboard(KeyEvent {
|
||||
code: Key::Char('r'),
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
}),
|
||||
Self::no_popup_mounted_clause(),
|
||||
),
|
||||
Sub::new(
|
||||
SubEventClause::Keyboard(KeyEvent {
|
||||
code: Key::Char('s'),
|
||||
modifiers: KeyModifiers::CONTROL,
|
||||
}),
|
||||
Self::no_popup_mounted_clause(),
|
||||
),
|
||||
Sub::new(SubEventClause::WindowResize, SubClause::Always),
|
||||
],
|
||||
) {
|
||||
error!("Failed to mount component: {err}");
|
||||
}
|
||||
}
|
||||
|
||||
pub(in crate::ui::activities::auth) fn get_current_form_tab(&self) -> FormTab {
|
||||
match self.app.focus() {
|
||||
Some(&Id::HostBridge(_)) => FormTab::HostBridge,
|
||||
_ => FormTab::Remote,
|
||||
}
|
||||
}
|
||||
|
||||
fn no_popup_mounted_clause() -> SubClause<Id> {
|
||||
tuirealm::subclause_and_not!(
|
||||
Id::ErrorPopup,
|
||||
Id::InfoPopup,
|
||||
Id::Keybindings,
|
||||
Id::DeleteBookmarkPopup,
|
||||
Id::DeleteRecentPopup,
|
||||
Id::InstallUpdatePopup,
|
||||
Id::BookmarkSavePassword,
|
||||
Id::WaitPopup
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user