Skip to content

Commit

Permalink
Search fixes (#134)
Browse files Browse the repository at this point in the history
* Search fixes

* Fix small instance ui

* fix javaw issue

* menu fix

* Add confirm modal for deletion

* fix build
  • Loading branch information
Geometrically committed Jun 11, 2023
1 parent e836738 commit 3535f0c
Show file tree
Hide file tree
Showing 24 changed files with 783 additions and 563 deletions.
2 changes: 1 addition & 1 deletion theseus/src/api/jre.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ pub async fn auto_install_java(java_version: u32) -> crate::Result<PathBuf> {
"Failed to extract java zip".to_string(),
))
})?;
emit_loading(&loading_bar, 100.0, Some("Done extracting java")).await?;
emit_loading(&loading_bar, 10.0, Some("Done extracting java")).await?;
Ok(path
.join(
download
Expand Down
2 changes: 1 addition & 1 deletion theseus/src/event/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub async fn emit_loading(
);
}

// Emit event to tauri
//Emit event to tauri
#[cfg(feature = "tauri")]
event_state
.app
Expand Down
78 changes: 35 additions & 43 deletions theseus/src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,51 +94,43 @@ impl Drop for LoadingBarId {
let _event = LoadingBarType::StateInit;
let _message = "finished".to_string();
tokio::spawn(async move {
if let Ok(event_state) = crate::EventState::get().await {
{
let mut bars = event_state.loading_bars.write().await;
bars.remove(&loader_uuid);
if let Ok(event_state) = EventState::get().await {
let mut bars = event_state.loading_bars.write().await;

#[cfg(any(feature = "tauri", feature = "cli"))]
if let Some(bar) = bars.remove(&loader_uuid) {
#[cfg(feature = "tauri")]
{
let loader_uuid = bar.loading_bar_uuid;
let event = bar.bar_type.clone();
let fraction = bar.current / bar.total;

use tauri::Manager;
let _ = event_state.app.emit_all(
"loading",
LoadingPayload {
fraction: None,
message: "Completed".to_string(),
event,
loader_uuid,
},
);
tracing::debug!(
"Exited at {fraction} for loading bar: {:?}",
loader_uuid
);
}

// Emit event to indicatif progress bar arc
#[cfg(feature = "cli")]
{
let cli_progress_bar = bar.cli_progress_bar.clone();
cli_progress_bar.finish();
}
}
}
});
}
}

// When Loading bar is dropped, should attempt to throw out one last event to indicate that the loading bar is done
#[cfg(feature = "tauri")]
impl Drop for LoadingBar {
fn drop(&mut self) {
let loader_uuid = self.loading_bar_uuid;
let event = self.bar_type.clone();
let fraction = self.current / self.total;

#[cfg(feature = "cli")]
let cli_progress_bar = self.cli_progress_bar.clone();

tokio::spawn(async move {
#[cfg(feature = "tauri")]
{
use tauri::Manager;
if let Ok(event_state) = crate::EventState::get().await {
let _ = event_state.app.emit_all(
"loading",
LoadingPayload {
fraction: None,
message: "Completed".to_string(),
event,
loader_uuid,
},
);
tracing::debug!(
"Exited at {fraction} for loading bar: {:?}",
loader_uuid
);
}
}
// Emit event to indicatif progress bar arc
#[cfg(feature = "cli")]
{
cli_progress_bar.finish();
#[cfg(not(any(feature = "tauri", feature = "cli")))]
bars.remove(&loader_uuid);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion theseus_gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dayjs": "^1.11.7",
"floating-vue": "^2.0.0-beta.20",
"ofetch": "^1.0.1",
"omorphia": "^0.4.22",
"omorphia": "^0.4.24",
"pinia": "^2.1.3",
"vite-svg-loader": "^4.0.0",
"vue": "^3.3.4",
Expand Down
8 changes: 4 additions & 4 deletions theseus_gui/pnpm-lock.yaml

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

Binary file removed theseus_gui/src-tauri/icons/32x32.png
Binary file not shown.
1 change: 0 additions & 1 deletion theseus_gui/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
},
"externalBin": [],
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
Expand Down
6 changes: 3 additions & 3 deletions theseus_gui/src/components/ui/AccountsCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<p>Selected</p>
</div>
<Button v-tooltip="'Log out'" icon-only color="raised" @click="logout(selectedAccount.id)">
<XIcon />
<TrashIcon />
</Button>
</div>
<div v-else class="logged-out account">
Expand All @@ -41,7 +41,7 @@
<p>{{ account.username }}</p>
</Button>
<Button v-tooltip="'Log out'" icon-only @click="logout(account.id)">
<XIcon />
<TrashIcon />
</Button>
</div>
</div>
Expand All @@ -54,7 +54,7 @@
</template>
<script setup>
import { Avatar, Button, Card, PlusIcon, XIcon, UsersIcon, LogInIcon } from 'omorphia'
import { Avatar, Button, Card, PlusIcon, TrashIcon, UsersIcon, LogInIcon } from 'omorphia'
import { ref, defineProps, computed, onMounted, onBeforeUnmount } from 'vue'
import {
users,
Expand Down
5 changes: 4 additions & 1 deletion theseus_gui/src/components/ui/Breadcrumbs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
<div v-for="breadcrumb in breadcrumbs" :key="breadcrumb.name" class="breadcrumbs__item">
<router-link
v-if="breadcrumb.link"
:to="breadcrumb.link.replace('{id}', encodeURIComponent($route.params.id))"
:to="{
path: breadcrumb.link.replace('{id}', encodeURIComponent($route.params.id)),
query: breadcrumb.query,
}"
>{{
breadcrumb.name.charAt(0) === '?'
? breadcrumbData.getName(breadcrumb.name.slice(1))
Expand Down
Loading

0 comments on commit 3535f0c

Please sign in to comment.