chore: download java if its missing, remove notifications for a while
This commit is contained in:
parent
18554785ae
commit
65cceba2b3
3 changed files with 23 additions and 8 deletions
|
|
@ -43,7 +43,7 @@ function RouteComponent() {
|
|||
|
||||
setEdit(!edit);
|
||||
}
|
||||
|
||||
/*
|
||||
const { set, remove } = useNotifications();
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -55,20 +55,23 @@ function RouteComponent() {
|
|||
const { cluster_name } = e.ingress_type.PrepareCluster;
|
||||
let cid = `cluster-${cluster_name}`;
|
||||
|
||||
if (e.percent === null) {
|
||||
remove(cid);
|
||||
return;
|
||||
}
|
||||
|
||||
set(cid, {
|
||||
title: 'Preparing Cluster',
|
||||
message: e.message,
|
||||
fraction: e.percent,
|
||||
});
|
||||
|
||||
if (e.percent === e.total)
|
||||
remove(cid);
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
return () => unlisten?.();
|
||||
}, [set, remove]);
|
||||
|
||||
*/
|
||||
return (
|
||||
<Sidebar.Page>
|
||||
<h1>Overview</h1>
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ function ClusterCard({
|
|||
mc_loader,
|
||||
mc_version,
|
||||
icon_url,
|
||||
stage,
|
||||
}: ClusterModel) {
|
||||
const launch = useCommand('launchCluster', () => bindings.core.launchCluster(id, null), {
|
||||
enabled: false,
|
||||
|
|
@ -183,9 +184,11 @@ function ClusterCard({
|
|||
return (
|
||||
<>
|
||||
<Link
|
||||
disabled={stage === 'downloading'}
|
||||
search={{
|
||||
id,
|
||||
}} to="/app/cluster"
|
||||
}}
|
||||
to="/app/cluster"
|
||||
>
|
||||
<div
|
||||
className="group relative h-[152px] flex flex-col rounded-xl border border-component-border/5 bg-component-bg active:bg-component-bg-pressed hover:bg-component-bg-hover"
|
||||
|
|
|
|||
|
|
@ -179,9 +179,17 @@ pub async fn prepare_java(major: u32) -> LauncherResult<java_versions::Model> {
|
|||
}
|
||||
}
|
||||
|
||||
tracing::warn!("no java installations found on the system, please install java manually or use the launcher to download it");
|
||||
tracing::warn!("no java installations found on the system, attempting to download java {}", major);
|
||||
|
||||
// TODO: java runtime not found - should prob download
|
||||
let java_path = install_java_from_major(major).await?;
|
||||
let java_info = check_java_runtime(&java_path, false).await?;
|
||||
|
||||
dao::insert_java(java_path, java_info).await?;
|
||||
|
||||
if let Some(java) = dao::get_latest_java_by_major(major).await? {
|
||||
send_ingress(&id, 100.0).await?;
|
||||
return Ok(java);
|
||||
}
|
||||
|
||||
Err(JavaError::MissingJava.into())
|
||||
}
|
||||
|
|
@ -409,6 +417,7 @@ pub async fn install_java_package(package: JavaPackage) -> LauncherResult<PathBu
|
|||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let java_version = package.java_version.iter().map(|v| v.to_string()).collect::<Vec<_>>().join(".");
|
||||
base_path = base_path
|
||||
.join(format!("zulu-{java_version}.jre"))
|
||||
.join("Contents")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue