@@ -2,17 +2,11 @@ import { v1 } from "@docker/extension-api-client-types";
22import { useMutation , useQuery , useQueryClient } from "@tanstack/react-query" ;
33import { useCallback , useEffect , useMemo , useState } from "react" ;
44import { parse , stringify } from "yaml" ;
5- import {
6- CATALOG_URL ,
7- REGISTRY_YAML
8- } from "../Constants" ;
5+ import { CATALOG_URL , REGISTRY_YAML } from "../Constants" ;
96import { writeToPromptsVolume } from "../FileUtils" ;
107import { getRegistry , syncRegistryWithConfig } from "../Registry" ;
118import Secrets from "../Secrets" ;
12- import {
13- CatalogItemRichened ,
14- CatalogItemWithName
15- } from "../types/catalog" ;
9+ import { CatalogItemRichened , CatalogItemWithName } from "../types/catalog" ;
1610import { getTemplateForItem , useConfig } from "./useConfig" ;
1711import { useSecrets } from "./useSecrets" ;
1812
@@ -43,7 +37,7 @@ function useCatalog(client: v1.DockerDesktopClient) {
4337 Boolean ( item . config ) &&
4438 ( neverOnceConfigured ||
4539 JSON . stringify ( itemConfigValue ) ===
46- JSON . stringify ( baseConfigTemplate ) ) ;
40+ JSON . stringify ( baseConfigTemplate ) ) ;
4741
4842 const missingASecret = secretsWithAssignment . some (
4943 ( secret ) => ! secret . assigned
@@ -152,6 +146,7 @@ function useRegistry(client: v1.DockerDesktopClient) {
152146 isLoading : registryLoading ,
153147 } = useQuery ( {
154148 queryKey : [ "registry" ] ,
149+ networkMode : "always" ,
155150 queryFn : async ( ) => {
156151 setCanRegister ( false ) ;
157152 try {
@@ -171,7 +166,7 @@ function useRegistry(client: v1.DockerDesktopClient) {
171166 setCanRegister ( true ) ;
172167 throw error ;
173168 }
174- }
169+ } ,
175170 } ) ;
176171
177172 useQuery ( {
@@ -214,7 +209,11 @@ function useRegistry(client: v1.DockerDesktopClient) {
214209 mutationFn : async ( newRegistry : {
215210 [ key : string ] : { ref : string ; config ?: any } ;
216211 } ) => {
217- await writeToPromptsVolume ( client , REGISTRY_YAML , stringify ( { registry : newRegistry } ) ) ;
212+ await writeToPromptsVolume (
213+ client ,
214+ REGISTRY_YAML ,
215+ stringify ( { registry : newRegistry } )
216+ ) ;
218217
219218 return newRegistry ;
220219 } ,
@@ -252,7 +251,11 @@ export function useCatalogOperations(client: v1.DockerDesktopClient) {
252251 [ item . name ] : { ref : item . ref } ,
253252 } ;
254253
255- await writeToPromptsVolume ( client , REGISTRY_YAML , stringify ( { registry : newRegistry } ) ) ;
254+ await writeToPromptsVolume (
255+ client ,
256+ REGISTRY_YAML ,
257+ stringify ( { registry : newRegistry } )
258+ ) ;
256259 return { success : true , newRegistry } ;
257260 } catch ( error ) {
258261 client . desktopUI . toast . error (
@@ -281,7 +284,11 @@ export function useCatalogOperations(client: v1.DockerDesktopClient) {
281284 delete currentRegistry [ item . name ] ;
282285 }
283286
284- await writeToPromptsVolume ( client , REGISTRY_YAML , stringify ( { registry : currentRegistry } ) ) ;
287+ await writeToPromptsVolume (
288+ client ,
289+ REGISTRY_YAML ,
290+ stringify ( { registry : currentRegistry } )
291+ ) ;
285292
286293 return { success : true , newRegistry : currentRegistry } ;
287294 } catch ( error ) {
0 commit comments