fix(app): disable add project when given server is offline (#34294)
This commit is contained in:
parent
dfeb1b5051
commit
6ee817d041
1 changed files with 5 additions and 1 deletions
|
|
@ -302,6 +302,7 @@ export function NewHome() {
|
||||||
|
|
||||||
function selectProject(conn: ServerConnection.Any, directory: string) {
|
function selectProject(conn: ServerConnection.Any, directory: string) {
|
||||||
const key = ServerConnection.key(conn)
|
const key = ServerConnection.key(conn)
|
||||||
|
if (global.servers.health[key]?.healthy === false) return
|
||||||
if (
|
if (
|
||||||
!global
|
!global
|
||||||
.ensureServerCtx(conn)
|
.ensureServerCtx(conn)
|
||||||
|
|
@ -767,15 +768,18 @@ function HomeProjectRow(props: {
|
||||||
clearNotifications: (server: ServerConnection.Any, project: LocalProject) => void
|
clearNotifications: (server: ServerConnection.Any, project: LocalProject) => void
|
||||||
language: ReturnType<typeof useLanguage>
|
language: ReturnType<typeof useLanguage>
|
||||||
}) {
|
}) {
|
||||||
|
const global = useGlobal()
|
||||||
|
const serverUnreachable = () => global.servers.health[ServerConnection.key(props.server)]?.healthy === false
|
||||||
const [state, setState] = createStore({ menuOpen: false })
|
const [state, setState] = createStore({ menuOpen: false })
|
||||||
return (
|
return (
|
||||||
<div class="group/project relative flex h-7 min-w-0 items-center rounded-[6px]">
|
<div class="group/project relative flex h-7 min-w-0 items-center rounded-[6px]">
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
data-component="home-project-row"
|
data-component="home-project-row"
|
||||||
class={`${HOME_PROJECT_NAV_ROW} pr-16`}
|
class={`${HOME_PROJECT_NAV_ROW} pr-16 disabled:opacity-60`}
|
||||||
data-selected={props.selected ? "" : undefined}
|
data-selected={props.selected ? "" : undefined}
|
||||||
aria-current={props.selected ? "page" : undefined}
|
aria-current={props.selected ? "page" : undefined}
|
||||||
|
disabled={serverUnreachable()}
|
||||||
onClick={() => props.selectProject(props.server, props.project.worktree)}
|
onClick={() => props.selectProject(props.server, props.project.worktree)}
|
||||||
>
|
>
|
||||||
<HomeProjectAvatar project={props.project} />
|
<HomeProjectAvatar project={props.project} />
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue