Wire elyspace import export UI
This commit is contained in:
@@ -206,6 +206,10 @@ pub(crate) fn plugin_settings_url() -> Result<UrlText, CoreError> {
|
||||
internal_page_url("ely://settings/plugins")
|
||||
}
|
||||
|
||||
pub(crate) fn space_settings_url() -> Result<UrlText, CoreError> {
|
||||
internal_page_url("ely://settings/spaces")
|
||||
}
|
||||
|
||||
pub(crate) fn plugin_detail_url(plugin_id: &PluginId) -> Result<UrlText, CoreError> {
|
||||
let route = format!("ely://plugin/{}", plugin_id.as_str());
|
||||
internal_page_url(&route)
|
||||
|
||||
@@ -11,8 +11,9 @@ use crate::{
|
||||
move_tab_space_name, new_private_profile_name, new_profile_name, new_space_name, note_body,
|
||||
notes_url, plugin_detail_url, plugin_settings_url, plugins_url, reading_list_url,
|
||||
reading_progress_percent, rename_tab_group_name, search_url, settings_page_url,
|
||||
settings_url, shortcut_settings_url, space_icon, split_group_name, switch_profile_name,
|
||||
sync_status_url, tab_group_color_hex, tab_group_name, tab_note_body, task_manager_url,
|
||||
settings_url, shortcut_settings_url, space_icon, space_settings_url, split_group_name,
|
||||
switch_profile_name, sync_status_url, tab_group_color_hex, tab_group_name, tab_note_body,
|
||||
task_manager_url,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -278,6 +279,21 @@ impl BrowserCore {
|
||||
self.open_tab(plugin_settings_url()?);
|
||||
Ok(true)
|
||||
}
|
||||
"export-space" | "export space" | "export-active-space" | "export active space" => {
|
||||
self.open_tab(space_settings_url()?);
|
||||
Ok(true)
|
||||
}
|
||||
"import-space"
|
||||
| "import space"
|
||||
| "import-space-active-profile"
|
||||
| "import space active profile"
|
||||
| "import-space-with-profiles"
|
||||
| "import space with profiles"
|
||||
| "import-space-preserve-profiles"
|
||||
| "import space preserve profiles" => {
|
||||
self.open_tab(space_settings_url()?);
|
||||
Ok(true)
|
||||
}
|
||||
"site-settings" | "open-site-settings" | "open site settings" => {
|
||||
let Some(url) = self.active_tab_site_settings_url()? else {
|
||||
return Ok(false);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
use std::error::Error;
|
||||
|
||||
use ely_browser_core::{BrowserCore, InitialBrowserConfig};
|
||||
use ely_domain::CommandIntent;
|
||||
|
||||
#[test]
|
||||
fn export_space_command_opens_space_settings_page() -> Result<(), Box<dyn Error>> {
|
||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||
|
||||
core.set_command_query(">export-space");
|
||||
let intent = core.submit_command()?;
|
||||
let active_tab = core.active_tab()?;
|
||||
|
||||
assert_eq!(intent, Some(CommandIntent::Command("export-space".to_string())));
|
||||
assert_eq!(active_tab.title(), "Space Settings");
|
||||
assert_eq!(active_tab.url().as_str(), "ely://settings/spaces");
|
||||
assert_eq!(core.snapshot()?.command_query, "");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn import_space_command_opens_space_settings_page() -> Result<(), Box<dyn Error>> {
|
||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||
|
||||
core.set_command_query(">import-space-with-profiles");
|
||||
let intent = core.submit_command()?;
|
||||
let active_tab = core.active_tab()?;
|
||||
|
||||
assert_eq!(intent, Some(CommandIntent::Command("import-space-with-profiles".to_string())));
|
||||
assert_eq!(active_tab.title(), "Space Settings");
|
||||
assert_eq!(active_tab.url().as_str(), "ely://settings/spaces");
|
||||
assert_eq!(core.snapshot()?.command_query, "");
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user