Add sync status route
This commit is contained in:
@@ -30,6 +30,7 @@ impl ElyShell {
|
||||
"ely://settings/plugins" => self.render_plugins_page(snapshot, cx),
|
||||
"ely://settings/profiles" => self.render_profiles_page(snapshot, cx),
|
||||
"ely://settings/sync" => self.render_sync_page(snapshot),
|
||||
"ely://sync/status" => self.render_sync_page(snapshot),
|
||||
_ => render_default_page(tab),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ fn internal_page_title(url: &str) -> Option<&'static str> {
|
||||
"ely://settings/plugins" => Some("Plugin Settings"),
|
||||
"ely://settings/profiles" => Some("Profile Settings"),
|
||||
"ely://settings/sync" => Some("Sync Settings"),
|
||||
"ely://sync/status" => Some("Sync Status"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
@@ -90,8 +91,8 @@ pub(crate) fn settings_url() -> Result<UrlText, CoreError> {
|
||||
internal_page_url("ely://settings")
|
||||
}
|
||||
|
||||
pub(crate) fn sync_url() -> Result<UrlText, CoreError> {
|
||||
internal_page_url("ely://settings/sync")
|
||||
pub(crate) fn sync_status_url() -> Result<UrlText, CoreError> {
|
||||
internal_page_url("ely://sync/status")
|
||||
}
|
||||
|
||||
pub(crate) fn settings_page_url(query: &str) -> Result<Option<UrlText>, CoreError> {
|
||||
|
||||
@@ -4,7 +4,8 @@ use crate::{
|
||||
CoreError,
|
||||
navigation::{
|
||||
downloads_url, history_url, move_tab_space_name, new_profile_name, new_space_name,
|
||||
search_url, settings_page_url, settings_url, space_icon, switch_profile_name, sync_url,
|
||||
search_url, settings_page_url, settings_url, space_icon, switch_profile_name,
|
||||
sync_status_url,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -110,7 +111,7 @@ impl BrowserCore {
|
||||
Ok(true)
|
||||
}
|
||||
"sync" | "open-sync-status" | "open sync status" => {
|
||||
self.open_tab(sync_url()?);
|
||||
self.open_tab(sync_status_url()?);
|
||||
Ok(true)
|
||||
}
|
||||
"close-tab" => {
|
||||
|
||||
@@ -97,7 +97,7 @@ fn open_settings_command_opens_settings_page() -> Result<(), Box<dyn Error>> {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn open_sync_status_command_opens_sync_settings_page() -> Result<(), Box<dyn Error>> {
|
||||
fn open_sync_status_command_opens_sync_status_page() -> Result<(), Box<dyn Error>> {
|
||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||
|
||||
core.set_command_query(">open-sync-status");
|
||||
@@ -105,8 +105,8 @@ fn open_sync_status_command_opens_sync_settings_page() -> Result<(), Box<dyn Err
|
||||
let active_tab = core.active_tab()?;
|
||||
|
||||
assert_eq!(intent, Some(CommandIntent::Command("open-sync-status".to_string())));
|
||||
assert_eq!(active_tab.title(), "Sync Settings");
|
||||
assert_eq!(active_tab.url().as_str(), "ely://settings/sync");
|
||||
assert_eq!(active_tab.title(), "Sync Status");
|
||||
assert_eq!(active_tab.url().as_str(), "ely://sync/status");
|
||||
assert_eq!(core.snapshot()?.command_query, "");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user