diff --git a/cmd/pro/update_provider.go b/cmd/pro/update_provider.go index d05a2cf56..db5a94ca5 100644 --- a/cmd/pro/update_provider.go +++ b/cmd/pro/update_provider.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/loft-sh/devpod/cmd/pro/flags" + providercmd "github.com/loft-sh/devpod/cmd/provider" "github.com/loft-sh/devpod/pkg/config" "github.com/loft-sh/devpod/pkg/platform" "github.com/loft-sh/devpod/pkg/workspace" @@ -73,5 +74,10 @@ func (cmd *UpdateProviderCmd) Run(ctx context.Context, args []string) error { return fmt.Errorf("update provider %s: %w", provider.Name, err) } + err = providercmd.ConfigureProvider(ctx, provider, devPodConfig.DefaultContext, []string{}, false, false, nil, log.Discard) + if err != nil { + return fmt.Errorf("configure provider, please retry with 'devpod provider use %s --reconfigure': %w", provider.Name, err) + } + return nil } diff --git a/cmd/up.go b/cmd/up.go index 775090190..969c6da58 100644 --- a/cmd/up.go +++ b/cmd/up.go @@ -1216,7 +1216,7 @@ func checkProviderUpdate(devPodConfig *config.Config, proInstance *provider2.Pro if v1.Compare(v2) == 0 { return nil } - log.Infof("New provider version available, attempting to update %s", proInstance.Provider) + log.Infof("New provider version available, attempting to update %s from %s to %s", proInstance.Provider, p.Config.Version, newVersion) providerSource, err := workspace2.ResolveProviderSource(devPodConfig, proInstance.Provider, log) if err != nil { diff --git a/desktop/src/components/Layout/ProSwitcher.tsx b/desktop/src/components/Layout/ProSwitcher.tsx index e3e05316a..d44f87078 100644 --- a/desktop/src/components/Layout/ProSwitcher.tsx +++ b/desktop/src/components/Layout/ProSwitcher.tsx @@ -1,7 +1,7 @@ import { client } from "@/client" import { useProInstances, useProviders, useSettings } from "@/contexts" import { CheckCircle, CircleWithArrow, DevPodProBadge, ExclamationTriangle, Plus } from "@/icons" -import { exists, useLoginProModal, useReLoginProModal } from "@/lib" +import { canHealthCheck, exists, useLoginProModal, useReLoginProModal } from "@/lib" import { Routes } from "@/routes" import { TProID, TProInstance, TProInstances, TProviderConfig } from "@/types" import { useDeleteProviderModal } from "@/views/Providers/useDeleteProviderModal" @@ -128,7 +128,7 @@ function ProPopoverContent({ return acc } - if (!curr.providerConfig.exec?.proxy?.["health"]) { + if (!canHealthCheck(curr.providerConfig)) { acc.legacyProInstances.push(curr) return acc @@ -148,7 +148,6 @@ function ProPopoverContent({ } ) }, [proInstances, providers]) - // TODO: Filter pro instances by the ones that support health check return ( <> diff --git a/desktop/src/lib/helpers.ts b/desktop/src/lib/helpers.ts index 92046fe2a..2cc5c0e89 100644 --- a/desktop/src/lib/helpers.ts +++ b/desktop/src/lib/helpers.ts @@ -1,4 +1,4 @@ -import { TIDE, TLogOutput } from "../types" +import { TIDE, TLogOutput, TProvider } from "../types" import { ChildProcess } from "@tauri-apps/plugin-shell" import { Err, Failed, Return } from "./result" import { TActionObj } from "../contexts" @@ -164,3 +164,7 @@ export function deepCopy(obj: T): T | undefined { return JSON.parse(JSON.stringify(obj)) } + +export function canHealthCheck(providerConfig: TProvider["config"]): boolean { + return !!providerConfig?.exec?.proxy?.["health"] +} diff --git a/desktop/src/lib/pro/useConnectionStatus.tsx b/desktop/src/lib/pro/useConnectionStatus.tsx index cb83ef30c..2d0a5a8e0 100644 --- a/desktop/src/lib/pro/useConnectionStatus.tsx +++ b/desktop/src/lib/pro/useConnectionStatus.tsx @@ -13,7 +13,6 @@ export function useConnectionStatus(): TConnectionStatus { queryFn: async () => { try { const res = await client.checkHealth() - console.log(res) let state: TConnectionStatus["state"] = "disconnected" if (res.err) { return { state } diff --git a/desktop/src/views/Providers/ListProviders.tsx b/desktop/src/views/Providers/ListProviders.tsx index 833848749..3632217f1 100644 --- a/desktop/src/views/Providers/ListProviders.tsx +++ b/desktop/src/views/Providers/ListProviders.tsx @@ -1,7 +1,7 @@ import { Button, Text, VStack, Wrap, WrapItem } from "@chakra-ui/react" import { useMemo } from "react" import { useProviders } from "../../contexts" -import { exists } from "../../lib" +import { canHealthCheck, exists } from "../../lib" import { TProvider, TProviderID } from "../../types" import { useSetupProviderModal } from "../Providers/useSetupProviderModal" import { ProviderCard } from "./ProviderCard" @@ -16,7 +16,7 @@ export function ListProviders() { } return Object.entries(providers) - .filter(([, details]) => details.state?.initialized) + .filter(([, details]) => details.state?.initialized && !canHealthCheck(details.config)) .map(([id, data]) => { return { id, data } }) diff --git a/desktop/src/views/Workspaces/CreateWorkspace/CreateWorkspace.tsx b/desktop/src/views/Workspaces/CreateWorkspace/CreateWorkspace.tsx index 2268a4dc5..fdf1b5bdc 100644 --- a/desktop/src/views/Workspaces/CreateWorkspace/CreateWorkspace.tsx +++ b/desktop/src/views/Workspaces/CreateWorkspace/CreateWorkspace.tsx @@ -37,7 +37,7 @@ import { RECOMMENDED_PROVIDER_SOURCES, SIDEBAR_WIDTH } from "../../../constants" import { useProvider, useProviders, useWorkspace, useWorkspaces } from "../../../contexts" import { Plus } from "../../../icons" import { CommunitySvg, ProviderPlaceholderSvg } from "../../../images" -import { exists, getKeys, isEmpty, useFormErrors } from "../../../lib" +import { canHealthCheck, exists, getKeys, isEmpty, useFormErrors } from "../../../lib" import { Routes } from "../../../routes" import { TIDE, TWorkspace, TWorkspaceSourceType } from "../../../types" import { useIDEs } from "../../../useIDEs" @@ -112,7 +112,7 @@ export function CreateWorkspace() { } const installed = Object.entries(providers) - .filter(([, p]) => !!p.state?.initialized) + .filter(([, p]) => !!p.state?.initialized && !canHealthCheck(p.config)) .map(([key, value]) => ({ name: key, ...value })) return {