From 38f0a0cac1a2741f5fc1b1e4dec5a88d44702c1a Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Mon, 29 Jan 2024 08:54:15 +0100 Subject: [PATCH] Query local node for project availability instead of seed node --- src/views/projects/Sidebar.svelte | 22 +++++++++---------- src/views/projects/Sidebar/ContextHelp.svelte | 8 ++++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/views/projects/Sidebar.svelte b/src/views/projects/Sidebar.svelte index ee7d7e55a..95c2a0379 100644 --- a/src/views/projects/Sidebar.svelte +++ b/src/views/projects/Sidebar.svelte @@ -3,7 +3,7 @@ import type { BaseUrl, Project } from "@httpd-client"; import { cacheQueryProject } from "@app/lib/projects"; - import { httpdStore } from "@app/lib/httpd"; + import { httpdStore, api } from "@app/lib/httpd"; import { isLocal } from "@app/lib/utils"; import { onMount } from "svelte"; @@ -37,12 +37,10 @@ let localProject: "notFound" | "found" | undefined = undefined; $: hideContextHelp = isLocal(baseUrl.hostname) && $httpdStore.state === "authenticated"; - $: loadingContextHelp = - $httpdStore.state !== "stopped" && localProject === undefined; httpdStore.subscribe(async () => { if ($httpdStore.state !== "stopped" && !queryingLocalProject) { - await cacheQueryProject(baseUrl, project.id); + await cacheQueryProject(api.baseUrl, project.id); } }); @@ -63,7 +61,7 @@ async function detectLocalProject(): Promise { queryingLocalProject = true; - localProject = await cacheQueryProject(baseUrl, project.id); + localProject = await cacheQueryProject(api.baseUrl, project.id); queryingLocalProject = false; } @@ -252,7 +250,7 @@
{#if !hideContextHelp && expanded} - {#if loadingContextHelp} + {#if !localProject}
@@ -263,9 +261,9 @@ {localProject} {baseUrl} projectId={project.id} - hideLocalButton={isLocal(baseUrl.hostname)} - disableLocalButton={$httpdStore.state !== "authenticated" || - localProject !== "found"} /> + hideLocalButton={isLocal(baseUrl.hostname) || + localProject !== "found"} + disableLocalButton={$httpdStore.state !== "authenticated"} />
{/if} {/if} @@ -300,7 +298,7 @@ {#if !hideContextHelp} - {#if loadingContextHelp} + {#if !localProject}
@@ -322,9 +320,9 @@ {baseUrl} popover projectId={project.id} - hideLocalButton={isLocal(baseUrl.hostname)} - disableLocalButton={$httpdStore.state !== "authenticated" || + hideLocalButton={isLocal(baseUrl.hostname) || localProject !== "found"} + disableLocalButton={$httpdStore.state !== "authenticated"} slot="popover" /> {/if} diff --git a/src/views/projects/Sidebar/ContextHelp.svelte b/src/views/projects/Sidebar/ContextHelp.svelte index d70325b70..960ae8c34 100644 --- a/src/views/projects/Sidebar/ContextHelp.svelte +++ b/src/views/projects/Sidebar/ContextHelp.svelte @@ -5,6 +5,7 @@ import { isLocal } from "@app/lib/utils"; import Button from "@app/components/Button.svelte"; + import Command from "@app/components/Command.svelte"; import ExternalLink from "@app/components/ExternalLink.svelte"; import IconSmall from "@app/components/IconSmall.svelte"; import Link from "@app/components/Link.svelte"; @@ -35,10 +36,11 @@
Click the Connect button in the top right corner to get started.
{:else if localProject === "notFound"}
Project not available locally
-
- This project hasn't been found on your local node. Click the Clone button - in the top right corner to get a local copy. +
+ This project hasn't been found on your local node. To get a local copy + start seeding it using the following command.
+ {:else if $httpdStore.state === "running" && localProject === "found"}
Not authenticated
To make changes you need to authenticate yourself.