diff --git a/web-admin/src/routes/[organization]/[project]/-/edit/+layout.svelte b/web-admin/src/routes/[organization]/[project]/-/edit/+layout.svelte index 77dc7c67b8a..76865e2e0ff 100644 --- a/web-admin/src/routes/[organization]/[project]/-/edit/+layout.svelte +++ b/web-admin/src/routes/[organization]/[project]/-/edit/+layout.svelte @@ -34,7 +34,11 @@ import { setCloudReadonlyNotice } from "@rilldata/web-common/features/entity-management/actions/protected-files.ts"; import { isProjectWelcomePage } from "@rilldata/web-admin/features/navigation/nav-utils.ts"; import WelcomeRedirector from "@rilldata/web-admin/features/welcome/project/WelcomeRedirector.svelte"; +<<<<<<< Updated upstream import { InfoIcon } from "lucide-svelte"; +======= + import RemoteProjectManager from "@rilldata/web-common/features/project/RemoteProjectManager.svelte"; +>>>>>>> Stashed changes $: organization = $page.params.organization; $: project = $page.params.project; @@ -175,6 +179,7 @@ editContext={true} /> + {/if} - import { page } from "$app/stores"; import type { ConnectError } from "@connectrpc/connect"; import { isMergeConflictError } from "@rilldata/web-common/features/project/deploy/github-utils.ts"; import MergeConflictResolutionDialog from "@rilldata/web-common/features/project/MergeConflictResolutionDialog.svelte"; import ProjectContainsRemoteChangesDialog from "@rilldata/web-common/features/project/ProjectContainsRemoteChangesDialog.svelte"; import { eventBus } from "@rilldata/web-common/lib/event-bus/event-bus.ts"; import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient.ts"; - import type { GitStatusResponse } from "@rilldata/web-common/proto/gen/rill/local/v1/api_pb.ts"; + import { getLocalServiceGitStatusQueryKey } from "@rilldata/web-common/runtime-client/local-service"; import { - createLocalServiceGitPull, - createLocalServiceGitStatus, - getLocalServiceGitStatusQueryKey, - } from "@rilldata/web-common/runtime-client/local-service"; + createRuntimeServiceGitPullMutation, + createRuntimeServiceGitStatus, + getRuntimeServiceGitStatusQueryKey, + type V1GitStatusResponse, + } from "@rilldata/web-common/runtime-client"; + import { useRuntimeClient } from "@rilldata/web-common/runtime-client/v2"; - const gitStatusQuery = createLocalServiceGitStatus(); - const gitPullMutation = createLocalServiceGitPull(); + const runtimeClient = useRuntimeClient(); + + const gitStatusQuery = createRuntimeServiceGitStatus(runtimeClient, {}); + const gitPullMutation = createRuntimeServiceGitPullMutation( + runtimeClient, + {}, + ); let remoteChangeDialog = false; let mergeConflictResolutionDialog = false; - $: inDeployPage = $page.route.id?.startsWith("/(misc)/deploy") ? true : false; $: if ($gitStatusQuery.data) { processGithubStatus($gitStatusQuery.data); @@ -27,16 +32,14 @@ $: ({ isPending: githubPullPending, error: githubPullError } = $gitPullMutation); let errorFromGitCommand: ConnectError | null = null; - $: error = githubPullError ?? errorFromGitCommand; + $: error = (githubPullError ?? errorFromGitCommand) as ConnectError | null; - function processGithubStatus(status: GitStatusResponse) { - remoteChangeDialog = status.remoteCommits > 0; + function processGithubStatus(status: V1GitStatusResponse) { + remoteChangeDialog = !!status.remoteCommits; } async function handleFetchRemoteCommits() { - if (inDeployPage) return; // Do not show the modal in deploy pages - - if ($gitStatusQuery.data!.localCommits > 0) { + if ($gitStatusQuery.data?.localCommits) { // Since we can't really merge remote commits with local commits, // we just show the user the merge conflicts dialog for confirmation to clear it. // We could directly show it since the data is in gitStatusQuery, but it feels like weird UX. @@ -51,7 +54,10 @@ // TODO: download diff once API is ready void queryClient.invalidateQueries({ - queryKey: getLocalServiceGitStatusQueryKey(), + queryKey: getRuntimeServiceGitStatusQueryKey( + runtimeClient.instanceId, + {}, + ), }); remoteChangeDialog = false; diff --git a/web-local/src/routes/+layout.svelte b/web-local/src/routes/+layout.svelte index 48748e23cd4..6a6ea30eee1 100644 --- a/web-local/src/routes/+layout.svelte +++ b/web-local/src/routes/+layout.svelte @@ -103,6 +103,7 @@ isPreviewMode && showPreviewNav($page.url.pathname) && !onDeployPage; $: onWelcomePage = route.id?.startsWith("/(misc)/welcome"); + $: onDeployPage = route.id?.startsWith("/(misc)/deploy"); @@ -119,7 +120,7 @@ {#if shouldShowPreviewNav} {/if} - {#if $deploy} + {#if $deploy && !onDeployPage} {/if} {/if}