Misc improvements and fixes (#109)

* now utilizing tracing better

* better tracing

* fix mac vs pc oppositional env var issue

* modified loading package

* added droppable loadingbarid that sends completion message

* loading bar

* regressed bug on mac

* fixed non-updated loading bar on playground

* Loading bar improvements

---------

Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
Wyatt Verchere
2023-05-08 12:14:08 -07:00
committed by GitHub
parent c79d5c32a6
commit 65c1942037
33 changed files with 726 additions and 294 deletions

View File

@@ -47,6 +47,8 @@ where
}
// Lists active progress bars
// Create a new HashMap with the same keys
// Values provided should not be used directly, as they are not guaranteed to be up-to-date
#[tauri::command]
pub async fn progress_bars_list(
) -> Result<std::collections::HashMap<uuid::Uuid, theseus::LoadingBar>> {
@@ -64,6 +66,16 @@ macro_rules! impl_serialize {
S: Serializer,
{
match self {
// For the Theseus variant, we add a special display for the error,
// to view the spans if subscribed to them (which is information that is lost when serializing)
TheseusSerializableError::Theseus(theseus_error) => {
$crate::error::display_tracing_error(theseus_error);
let mut state = serializer.serialize_struct("Theseus", 2)?;
state.serialize_field("field_name", "Theseus")?;
state.serialize_field("message", &theseus_error.to_string())?;
state.end()
}
$(
TheseusSerializableError::$variant(message) => {
let mut state = serializer.serialize_struct(stringify!($variant), 2)?;
@@ -80,7 +92,6 @@ macro_rules! impl_serialize {
// Use the macro to implement Serialize for TheseusSerializableError
impl_serialize! {
Theseus,
IO,
NoProfileFound,
}

View File

@@ -5,8 +5,12 @@ use theseus::prelude::*;
// Creates a pack from a version ID (returns a path to the created profile)
// invoke('pack_install_version_id', version_id)
#[tauri::command]
pub async fn pack_install_version_id(version_id: String) -> Result<PathBuf> {
let res = pack::install_pack_from_version_id(version_id).await?;
pub async fn pack_install_version_id(
version_id: String,
pack_title: Option<String>,
) -> Result<PathBuf> {
let res =
pack::install_pack_from_version_id(version_id, pack_title).await?;
Ok(res)
}

View File

@@ -15,6 +15,7 @@ pub struct FrontendSettings {
pub default_user: Option<uuid::Uuid>,
pub hooks: Hooks,
pub max_concurrent_downloads: usize,
pub max_concurrent_writes: usize,
pub version: u32,
pub collapsed_navigation: bool,
}
@@ -39,6 +40,7 @@ pub async fn settings_get() -> Result<FrontendSettings> {
default_user: backend_settings.default_user,
hooks: backend_settings.hooks,
max_concurrent_downloads: backend_settings.max_concurrent_downloads,
max_concurrent_writes: backend_settings.max_concurrent_writes,
version: backend_settings.version,
collapsed_navigation: backend_settings.collapsed_navigation,
};
@@ -77,6 +79,7 @@ pub async fn settings_set(settings: FrontendSettings) -> Result<()> {
default_user: settings.default_user,
hooks: settings.hooks,
max_concurrent_downloads: settings.max_concurrent_downloads,
max_concurrent_writes: settings.max_concurrent_writes,
version: settings.version,
collapsed_navigation: settings.collapsed_navigation,
};