Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
39e6806
add a spot in the code for favorited Resources to go
ReactorScram Jul 19, 2024
ebbf20f
refactor and add unit tests
ReactorScram Jul 19, 2024
ed69dd2
save favorites to disk
ReactorScram Jul 19, 2024
79aa22a
Update GUI.tsx
ReactorScram Jul 19, 2024
ebbb30d
Merge remote-tracking branch 'origin/main' into feat/tauri-favorites-…
ReactorScram Jul 22, 2024
cbdcaf9
move things around
ReactorScram Jul 22, 2024
6d852bf
comment
ReactorScram Jul 22, 2024
d27eeef
extract str consts
ReactorScram Jul 22, 2024
feb4059
Merge remote-tracking branch 'origin/main' into feat/tauri-favorites-…
ReactorScram Jul 23, 2024
dd43be5
satisfy clippy
ReactorScram Jul 23, 2024
195dd05
Merge remote-tracking branch 'origin/main' into feat/tauri-favorites-…
ReactorScram Jul 23, 2024
5ecff52
only consider the user to have favorites if any favorite is in the menu
ReactorScram Jul 23, 2024
6cea0f2
refactor
ReactorScram Jul 23, 2024
c02f031
refactor(gui-client): refactor menu so it's testable
ReactorScram Jul 26, 2024
61ead52
Merge branch 'refactor/tauri-menu' into feat/tauri-favorites-menu
ReactorScram Jul 26, 2024
93b6f48
remove keyboard accelerators
ReactorScram Jul 26, 2024
a3de1f7
Merge branch 'refactor/tauri-menu' into feat/tauri-favorites-menu
ReactorScram Jul 26, 2024
5010aad
fix missing dep
ReactorScram Jul 26, 2024
c8dca5c
Merge remote-tracking branch 'origin/main' into feat/tauri-favorites-…
ReactorScram Jul 30, 2024
9bf991f
Merge remote-tracking branch 'origin/main' into feat/tauri-favorites-…
ReactorScram Jul 30, 2024
5230a46
Merge remote-tracking branch 'origin/main' into feat/tauri-favorites-…
ReactorScram Jul 31, 2024
415b311
Merge branch 'main' into feat/tauri-favorites-menu
ReactorScram Aug 1, 2024
92defc3
Merge branch 'main' into feat/tauri-favorites-menu
ReactorScram Aug 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/gui-client/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ atomicwrites = "0.4.3"
chrono = { workspace = true }
clap = { version = "4.5", features = ["derive", "env"] }
connlib-client-shared = { workspace = true }
connlib-shared = { workspace = true }
crash-handler = "0.6.2"
firezone-bin-shared = { workspace = true }
firezone-headless-client = { path = "../../headless-client" }
Expand Down
18 changes: 18 additions & 0 deletions rust/gui-client/src-tauri/src/client/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,8 @@ impl Controller {
tracing::debug!(
"Applied new settings. Log level will take effect immediately for the GUI and later for the IPC service."
);
// Refresh the menu in case the favorites were reset.
self.refresh_system_tray_menu()?;
}
Req::ClearLogs => logging::clear_logs_inner()
.await
Expand Down Expand Up @@ -574,6 +576,10 @@ impl Controller {
.context("Couldn't hide Welcome window")?;
}
}
Req::SystemTrayMenu(TrayMenuEvent::AddFavorite(resource_id)) => {
self.advanced_settings.favorite_resources.insert(resource_id);
self.refresh_favorite_resources().await?;
Comment thread
ReactorScram marked this conversation as resolved.
},
Req::SystemTrayMenu(TrayMenuEvent::AdminPortal) => tauri::api::shell::open(
&self.app.shell_scope(),
&self.advanced_settings.auth_base_url,
Expand All @@ -599,6 +605,10 @@ impl Controller {
Status::TunnelReady{..} => tracing::error!("Can't cancel sign-in, the tunnel is already up. This is a logic error in the code."),
}
}
Req::SystemTrayMenu(TrayMenuEvent::RemoveFavorite(resource_id)) => {
self.advanced_settings.favorite_resources.remove(&resource_id);
self.refresh_favorite_resources().await?;
}
Req::SystemTrayMenu(TrayMenuEvent::ShowWindow(window)) => {
self.show_window(window)?;
// When the About or Settings windows are hidden / shown, log the
Expand Down Expand Up @@ -695,6 +705,13 @@ impl Controller {
}
}

/// Saves the current settings (including favorites) to disk and refreshes the tray menu
async fn refresh_favorite_resources(&mut self) -> Result<()> {
settings::save(&self.advanced_settings).await?;
self.refresh_system_tray_menu()?;
Ok(())
}

/// Builds a new system tray menu and applies it to the app
fn refresh_system_tray_menu(&mut self) -> Result<()> {
// TODO: Refactor `Controller` and the auth module so that "Are we logged in?"
Expand All @@ -709,6 +726,7 @@ impl Controller {
Status::TunnelReady { resources } => {
system_tray::AppState::SignedIn(system_tray::SignedIn {
actor_name: &auth_session.actor_name,
favorite_resources: &self.advanced_settings.favorite_resources,
resources,
})
}
Expand Down
Loading