Add sync settings status page
This commit is contained in:
@@ -90,6 +90,10 @@ 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 settings_page_url(query: &str) -> Result<Option<UrlText>, CoreError> {
|
||||
let normalized_query = query.trim().to_ascii_lowercase();
|
||||
let Some(url) = settings_page_route(&normalized_query) else {
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::collections::BTreeMap;
|
||||
|
||||
use ely_domain::{
|
||||
ArchivedTab, BrowserTab, DomainError, DownloadEntry, DownloadPolicy, HistoryEntry, Profile,
|
||||
ProfileId, ProfileKind, Space, SpaceId, TabId, UrlText,
|
||||
ProfileId, ProfileKind, Space, SpaceId, SyncStatus, TabId, UrlText,
|
||||
};
|
||||
|
||||
use crate::CoreError;
|
||||
@@ -12,6 +12,7 @@ mod downloads;
|
||||
mod history;
|
||||
mod plugins;
|
||||
mod profiles;
|
||||
mod sync;
|
||||
mod tabs;
|
||||
|
||||
pub use plugins::{InstalledPlugin, PluginAuditAction, PluginAuditEvent};
|
||||
@@ -47,6 +48,7 @@ pub struct BrowserSnapshot {
|
||||
pub plugin_audit_events: Vec<PluginAuditEvent>,
|
||||
pub spaces: Vec<Space>,
|
||||
pub profiles: Vec<Profile>,
|
||||
pub sync_status: SyncStatus,
|
||||
pub active_tab_id: TabId,
|
||||
pub active_space_id: SpaceId,
|
||||
pub active_profile_id: ProfileId,
|
||||
@@ -201,6 +203,7 @@ impl BrowserCore {
|
||||
plugin_audit_events: self.plugin_audit_events.clone(),
|
||||
spaces: self.spaces.clone(),
|
||||
profiles: self.profiles.clone(),
|
||||
sync_status: self.sync_status(),
|
||||
tabs: self.visible_tabs(),
|
||||
active_tab_id: self.active_tab_id.clone(),
|
||||
active_space_id: self.active_space_id.clone(),
|
||||
|
||||
@@ -4,7 +4,7 @@ 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,
|
||||
search_url, settings_page_url, settings_url, space_icon, switch_profile_name, sync_url,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -109,6 +109,10 @@ impl BrowserCore {
|
||||
self.open_tab(settings_url()?);
|
||||
Ok(true)
|
||||
}
|
||||
"sync" | "open-sync-status" | "open sync status" => {
|
||||
self.open_tab(sync_url()?);
|
||||
Ok(true)
|
||||
}
|
||||
"close-tab" => {
|
||||
self.close_active_tab()?;
|
||||
Ok(true)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
use ely_domain::{SyncObjectKind, SyncObjectState, SyncObjectStatus, SyncStatus};
|
||||
|
||||
use super::BrowserCore;
|
||||
|
||||
impl BrowserCore {
|
||||
pub(super) fn sync_status(&self) -> SyncStatus {
|
||||
SyncStatus::signed_out(vec![
|
||||
SyncObjectStatus::new(
|
||||
SyncObjectKind::Spaces,
|
||||
self.spaces.len(),
|
||||
SyncObjectState::LocalOnly,
|
||||
),
|
||||
SyncObjectStatus::new(
|
||||
SyncObjectKind::Tabs,
|
||||
self.tabs.len(),
|
||||
SyncObjectState::LocalOnly,
|
||||
),
|
||||
SyncObjectStatus::new(
|
||||
SyncObjectKind::Profiles,
|
||||
self.profiles.len(),
|
||||
SyncObjectState::LocalOnly,
|
||||
),
|
||||
SyncObjectStatus::new(
|
||||
SyncObjectKind::History,
|
||||
self.history_entries.len(),
|
||||
SyncObjectState::PrivacyControlled,
|
||||
),
|
||||
SyncObjectStatus::new(
|
||||
SyncObjectKind::PluginSettings,
|
||||
self.installed_plugins.len(),
|
||||
SyncObjectState::LocalOnly,
|
||||
),
|
||||
])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user